@@ -55,23 +55,15 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
55
55
const client = MatrixClientPeg . get ( ) ;
56
56
const room = client . getRoom ( props . roomId ) ;
57
57
if ( ! room ) throw new Error ( `Expected a room for ID: ${ props . roomId } ` ) ;
58
-
58
+ //TODO: Decrypt the shortcodes and emotes if they are encrypted
59
59
let emotesEvent = room . currentState . getStateEvents ( "m.room.emotes" , "" ) ;
60
- //console.log(room.currentState);
61
60
let emotes : Dictionary < string > ;
62
61
emotes = emotesEvent ? ( emotesEvent . getContent ( ) || { } ) : { } ;
63
62
let value = { } ;
64
63
for ( let emote in emotes ) {
65
64
value [ emote ] = emote ;
66
65
}
67
- //TODO: Decrypt the shortcodes and emotes if they are encrypted
68
- // if (emotes) {
69
- // console.log(room.roomId);
70
- // console.log(room.name);
71
- // console.log(emotes);
72
- // }
73
- //if (avatarUrl) avatarUrl = mediaFromMxc(avatarUrl).getSquareThumbnailHttp(96);
74
- //emotes={}
66
+
75
67
this . state = {
76
68
emotes : emotes ,
77
69
EmoteFieldsTouched : { } ,
@@ -128,7 +120,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
128
120
let cleanemotes = { }
129
121
let deletedItems = this . state . deletedItems ;
130
122
let value = { }
131
- //console.log(e.currentTarget.getAttribute("name"));
132
123
let id = e . currentTarget . getAttribute ( "id" )
133
124
for ( let emote in this . state . emotes ) {
134
125
if ( emote != id ) {
@@ -141,13 +132,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
141
132
}
142
133
143
134
this . setState ( { deleted : true , emotes : cleanemotes , deletedItems : deletedItems , value : value } )
144
- // document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
145
- // field.setAttribute("value",(field as HTMLInputElement).id);
146
- // field.setAttribute("defaultValue",(field as HTMLInputElement).id);
147
- // })
148
- // for(let DOMid in this.state.emotes){
149
- // document.getElementById(DOMid).setAttribute("value",DOMid);
150
- // }
151
135
return ;
152
136
153
137
}
@@ -163,7 +147,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
163
147
// TODO: What do we do about errors?
164
148
165
149
if ( this . state . emotes || ( this . state . newEmoteFileAdded && this . state . newEmoteCodeAdded ) ) {
166
- //const emotes = await client.uploadContent(this.state.emotes);
167
150
//TODO: Encrypt the shortcode and the image data before uploading
168
151
if ( this . state . newEmoteFileAdded && this . state . newEmoteCodeAdded ) {
169
152
const newEmote = await client . uploadContent ( this . state . newEmoteFile ) ;
@@ -178,12 +161,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
178
161
if ( this . state . EmoteFieldsTouched . hasOwnProperty ( shortcode ) ) {
179
162
emotesMxcs [ this . state . EmoteFieldsTouched [ shortcode ] ] = this . state . emotes [ shortcode ] ;
180
163
value [ this . state . EmoteFieldsTouched [ shortcode ] ] = this . state . EmoteFieldsTouched [ shortcode ] ;
181
-
182
- // document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
183
- // if((field as HTMLInputElement).name===shortcode){
184
- // (field as HTMLInputElement).name= this.state.EmoteFieldsTouched[shortcode];
185
- // }
186
- // })
187
164
}
188
165
189
166
else {
@@ -193,7 +170,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
193
170
194
171
} ;
195
172
}
196
- //console.log(emotesMxcs);
197
173
newState . value = value ;
198
174
await client . sendStateEvent ( this . props . roomId , 'm.room.emotes' , emotesMxcs , "" ) ;
199
175
this . emoteUpload . current . value = "" ;
@@ -205,21 +181,13 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
205
181
newState . deleted = false ;
206
182
newState . deletedItems = { } ;
207
183
208
- /*newState.avatarUrl = mediaFromMxc(uri).getSquareThumbnailHttp(96);
209
- newState.originalAvatarUrl = newState.avatarUrl;
210
- newState.avatarFile = null;*/
211
- } /*else if (this.state.originalAvatarUrl !== this.state.avatarUrl) {
212
- await client.sendStateEvent(this.props.roomId, 'm.room.avatar', {}, '');
213
- }*/
184
+ }
214
185
this . setState ( newState as IState ) ;
215
186
} ;
216
187
217
188
218
189
private onEmoteChange = ( e : React . ChangeEvent < HTMLInputElement > ) : void => {
219
190
const id = e . target . getAttribute ( "id" ) ;
220
- //e.target.setAttribute("value", e.target.value);
221
- //const newEmotes = { ...this.state.emotes, [value]: value };
222
- //let newState=this.state.emotes;
223
191
let b = this . state . value
224
192
b [ id ] = e . target . value ;
225
193
this . setState ( { value : b , EmoteFieldsTouched : { ...this . state . EmoteFieldsTouched , [ id ] : e . target . value } } ) ;
@@ -306,7 +274,7 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
306
274
307
275
/>
308
276
< img className = "mx_EmoteSettings_uploadedEmoteImage" src = {
309
- mediaFromMxc ( this . state . emotes [ emotecode ] ) . srcHttp //.getSquareThumbnailHttp(96)
277
+ mediaFromMxc ( this . state . emotes [ emotecode ] ) . srcHttp
310
278
} />
311
279
< div className = "mx_EmoteSettings_uploadButton" >
312
280
< AccessibleButton
0 commit comments