use renamed decrypt event method

This commit is contained in:
Germain Souquet 2021-05-18 13:01:38 +01:00
parent 1cfd4b6e1a
commit f9f10de0da
5 changed files with 8 additions and 14 deletions

View file

@ -51,7 +51,7 @@ class FilePanel extends React.Component {
if (toStartOfTimeline || !data || !data.liveEvent || ev.isRedacted()) return;
const client = MatrixClientPeg.get();
client.decryptEvent(ev);
client.decryptEventIfNeeded(ev);
if (ev.isBeingDecrypted()) {
this.decryptingEvents.add(ev.getId());

View file

@ -1149,10 +1149,8 @@ class TimelinePanel extends React.Component {
arrayFastClone(events)
.reverse()
.forEach(event => {
if (event.shouldAttemptDecryption()) {
const client = MatrixClientPeg.get();
client.decryptEvent(event);
}
const client = MatrixClientPeg.get();
client.decryptEventIfNeeded(event);
});
const firstVisibleEventIndex = this._checkForPreJoinUISI(events);

View file

@ -124,10 +124,8 @@ export default class MessageActionBar extends React.PureComponent {
this.props.mxEvent.on("Event.status", this.onSent);
}
if (this.props.mxEvent.shouldAttemptDecryption()) {
const client = MatrixClientPeg.get();
client.decryptEvent(this.props.mxEvent);
}
const client = MatrixClientPeg.get();
client.decryptEventIfNeeded(this.props.mxEvent);
if (this.props.mxEvent.isBeingDecrypted()) {
this.props.mxEvent.once("Event.decrypted", this.onDecrypted);

View file

@ -39,9 +39,7 @@ export default class ViewSourceEvent extends React.PureComponent {
const {mxEvent} = this.props;
const client = MatrixClientPeg.get();
if (mxEvent.shouldAttemptDecryption()) {
client.decryptEvent(mxEvent);
}
client.decryptEventIfNeeded(mxEvent);
if (mxEvent.isBeingDecrypted()) {
mxEvent.once("Event.decrypted", () => this.forceUpdate());

View file

@ -189,7 +189,7 @@ export default class EventIndex extends EventEmitter {
return;
}
await client.decryptEvent(ev);
await client.decryptEventIfNeeded(ev);
await this.addLiveEventToIndex(ev);
}
@ -517,7 +517,7 @@ export default class EventIndex extends EventEmitter {
const decryptionPromises = matrixEvents
.filter(event => event.isEncrypted())
.map(event => {
return client.decryptEvent(event, {
return client.decryptEventIfNeeded(event, {
isRetry: true,
emit: false,
});