File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1014,10 +1014,17 @@ export default class ChatRoom extends Listenable {
10141014 * @param subject
10151015 */
10161016 setSubject ( subject ) {
1017+ const valueToProcess = subject ? subject . trim ( ) : subject ;
1018+
1019+ if ( valueToProcess === this . subject ) {
1020+ // subject already set to the new value
1021+ return ;
1022+ }
1023+
10171024 const msg = $msg ( { to : this . roomjid ,
10181025 type : 'groupchat' } ) ;
10191026
1020- msg . c ( 'subject' , subject ) ;
1027+ msg . c ( 'subject' , valueToProcess ) ;
10211028 this . connection . send ( msg ) ;
10221029 }
10231030
@@ -1201,6 +1208,7 @@ export default class ChatRoom extends Listenable {
12011208 const subjectText = subject . text ( ) ;
12021209
12031210 if ( subjectText || subjectText === '' ) {
1211+ this . subject = subjectText . trim ( ) ;
12041212 this . eventEmitter . emit ( XMPPEvents . SUBJECT_CHANGED , subjectText ) ;
12051213 logger . log ( `Subject is changed to ${ subjectText } ` ) ;
12061214 }
You can’t perform that action at this time.
0 commit comments