@@ -17,6 +17,7 @@ limitations under the License.
17
17
import React from "react" ;
18
18
import classNames from "classnames" ;
19
19
import { MatrixEvent } from "matrix-js-sdk/src/matrix" ;
20
+ import { Optional } from "matrix-events-sdk/lib/types" ;
20
21
21
22
import { mediaFromMxc } from "../../../customisations/Media" ;
22
23
import { _t } from "../../../languageHandler" ;
@@ -25,7 +26,6 @@ import dis from "../../../dispatcher/dispatcher";
25
26
import ReactionsRowButtonTooltip from "./ReactionsRowButtonTooltip" ;
26
27
import AccessibleButton from "../elements/AccessibleButton" ;
27
28
import MatrixClientContext from "../../../contexts/MatrixClientContext" ;
28
- import SettingsStore from "../../../settings/SettingsStore" ;
29
29
import { REACTION_SHORTCODE_KEY } from "./ReactionsRow" ;
30
30
interface IProps {
31
31
// The event we're displaying reactions for
@@ -40,6 +40,8 @@ interface IProps {
40
40
myReactionEvent ?: MatrixEvent ;
41
41
// Whether to prevent quick-reactions by clicking on this reaction
42
42
disabled ?: boolean ;
43
+ // Whether to render custom image reactions
44
+ customReactionImagesEnabled ?: boolean ;
43
45
}
44
46
45
47
interface IState {
@@ -103,20 +105,23 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
103
105
content = { content }
104
106
reactionEvents = { reactionEvents }
105
107
visible = { this . state . tooltipVisible }
108
+ customReactionImagesEnabled = { this . props . customReactionImagesEnabled }
106
109
/>
107
110
) ;
108
111
}
109
112
110
113
const room = this . context . getRoom ( mxEvent . getRoomId ( ) ) ;
111
- const customReactionImagesEnabled = SettingsStore . getValue ( "feature_render_reaction_images" ) ;
112
114
let label : string | undefined ;
113
- let customReactionName : string | undefined ;
115
+ let customReactionName : Optional < string > ;
114
116
if ( room ) {
115
117
const senders : string [ ] = [ ] ;
116
118
for ( const reactionEvent of reactionEvents ) {
117
119
const member = room . getMember ( reactionEvent . getSender ( ) ! ) ;
118
120
senders . push ( member ?. name || reactionEvent . getSender ( ) ! ) ;
119
- if ( customReactionImagesEnabled && REACTION_SHORTCODE_KEY . findIn ( reactionEvent . getContent ( ) ) ) {
121
+ if (
122
+ this . props . customReactionImagesEnabled &&
123
+ REACTION_SHORTCODE_KEY . findIn ( reactionEvent . getContent ( ) )
124
+ ) {
120
125
customReactionName = REACTION_SHORTCODE_KEY . findIn ( reactionEvent . getContent ( ) ) ;
121
126
}
122
127
}
@@ -137,7 +142,7 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
137
142
{ content }
138
143
</ span >
139
144
) ;
140
- if ( customReactionImagesEnabled && content . startsWith ( "mxc://" ) ) {
145
+ if ( this . props . customReactionImagesEnabled && content . startsWith ( "mxc://" ) ) {
141
146
const imageSrc = mediaFromMxc ( content ) . srcHttp ;
142
147
if ( imageSrc ) {
143
148
reactionContent = (
0 commit comments