This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/components/views/messages Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { Relations } from 'matrix-js-sdk/src/models/relations';
20
20
import { M_BEACON_INFO } from 'matrix-js-sdk/src/@types/beacon' ;
21
21
import { M_LOCATION } from 'matrix-js-sdk/src/@types/location' ;
22
22
import { M_POLL_START } from "matrix-events-sdk" ;
23
+ import { MatrixEventEvent } from "matrix-js-sdk/src/models/event" ;
23
24
24
25
import SettingsStore from "../../../settings/SettingsStore" ;
25
26
import { Mjolnir } from "../../../mjolnir/Mjolnir" ;
@@ -73,7 +74,12 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
73
74
}
74
75
}
75
76
77
+ public componentDidMount ( ) : void {
78
+ this . props . mxEvent . addListener ( MatrixEventEvent . Decrypted , this . onDecrypted ) ;
79
+ }
80
+
76
81
public componentWillUnmount ( ) {
82
+ this . props . mxEvent . removeListener ( MatrixEventEvent . Decrypted , this . onDecrypted ) ;
77
83
this . mediaHelper ?. destroy ( ) ;
78
84
}
79
85
@@ -118,6 +124,14 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
118
124
return this . mediaHelper ;
119
125
}
120
126
127
+ private onDecrypted = ( ) : void => {
128
+ // Recheck MediaEventHelper eligibility as it can change when the event gets decrypted
129
+ if ( MediaEventHelper . isEligible ( this . props . mxEvent ) ) {
130
+ this . mediaHelper ?. destroy ( ) ;
131
+ this . mediaHelper = new MediaEventHelper ( this . props . mxEvent ) ;
132
+ }
133
+ } ;
134
+
121
135
private onTileUpdate = ( ) => {
122
136
this . forceUpdate ( ) ;
123
137
} ;
You can’t perform that action at this time.
0 commit comments