@@ -55,23 +55,15 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
5555 const client = MatrixClientPeg . get ( ) ;
5656 const room = client . getRoom ( props . roomId ) ;
5757 if ( ! room ) throw new Error ( `Expected a room for ID: ${ props . roomId } ` ) ;
58-
58+ //TODO: Decrypt the shortcodes and emotes if they are encrypted
5959 let emotesEvent = room . currentState . getStateEvents ( "m.room.emotes" , "" ) ;
60- //console.log(room.currentState);
6160 let emotes : Dictionary < string > ;
6261 emotes = emotesEvent ? ( emotesEvent . getContent ( ) || { } ) : { } ;
6362 let value = { } ;
6463 for ( let emote in emotes ) {
6564 value [ emote ] = emote ;
6665 }
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+
7567 this . state = {
7668 emotes : emotes ,
7769 EmoteFieldsTouched : { } ,
@@ -128,7 +120,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
128120 let cleanemotes = { }
129121 let deletedItems = this . state . deletedItems ;
130122 let value = { }
131- //console.log(e.currentTarget.getAttribute("name"));
132123 let id = e . currentTarget . getAttribute ( "id" )
133124 for ( let emote in this . state . emotes ) {
134125 if ( emote != id ) {
@@ -141,13 +132,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
141132 }
142133
143134 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- // }
151135 return ;
152136
153137 }
@@ -163,7 +147,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
163147 // TODO: What do we do about errors?
164148
165149 if ( this . state . emotes || ( this . state . newEmoteFileAdded && this . state . newEmoteCodeAdded ) ) {
166- //const emotes = await client.uploadContent(this.state.emotes);
167150 //TODO: Encrypt the shortcode and the image data before uploading
168151 if ( this . state . newEmoteFileAdded && this . state . newEmoteCodeAdded ) {
169152 const newEmote = await client . uploadContent ( this . state . newEmoteFile ) ;
@@ -178,12 +161,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
178161 if ( this . state . EmoteFieldsTouched . hasOwnProperty ( shortcode ) ) {
179162 emotesMxcs [ this . state . EmoteFieldsTouched [ shortcode ] ] = this . state . emotes [ shortcode ] ;
180163 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- // })
187164 }
188165
189166 else {
@@ -193,7 +170,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
193170
194171 } ;
195172 }
196- //console.log(emotesMxcs);
197173 newState . value = value ;
198174 await client . sendStateEvent ( this . props . roomId , 'm.room.emotes' , emotesMxcs , "" ) ;
199175 this . emoteUpload . current . value = "" ;
@@ -205,21 +181,13 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
205181 newState . deleted = false ;
206182 newState . deletedItems = { } ;
207183
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+ }
214185 this . setState ( newState as IState ) ;
215186 } ;
216187
217188
218189 private onEmoteChange = ( e : React . ChangeEvent < HTMLInputElement > ) : void => {
219190 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;
223191 let b = this . state . value
224192 b [ id ] = e . target . value ;
225193 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> {
306274
307275 />
308276 < img className = "mx_EmoteSettings_uploadedEmoteImage" src = {
309- mediaFromMxc ( this . state . emotes [ emotecode ] ) . srcHttp //.getSquareThumbnailHttp(96)
277+ mediaFromMxc ( this . state . emotes [ emotecode ] ) . srcHttp
310278 } />
311279 < div className = "mx_EmoteSettings_uploadButton" >
312280 < AccessibleButton
0 commit comments