@@ -125,6 +125,18 @@ export default class ChatStateStore implements DispatchListener {
125
125
this . publicChannels . load ( ) ;
126
126
}
127
127
} ) ;
128
+
129
+ autorun ( ( ) => {
130
+ if ( this . isChatMounted ) {
131
+ const selectedChannelOrType = this . selectedChannelOrType ;
132
+ const channelName = selectedChannelOrType instanceof Channel
133
+ ? selectedChannelOrType . name
134
+ : trans ( `chat.channels.${ selectedChannelOrType ?? 'none' } ` ) ;
135
+
136
+ // FIXME: channelName on sendto=
137
+ core . browserTitleWithNotificationCount . title = `${ channelName } · ${ trans ( 'page_title.main.chat_controller._' ) } ` ;
138
+ }
139
+ } ) ;
128
140
}
129
141
130
142
// Only up to one join/create channel operation should be allowed to be running at any time.
@@ -305,23 +317,19 @@ export default class ChatStateStore implements DispatchListener {
305
317
private updateUrl ( channel : Channel | AddChannelType , mode : 'advanceHistory' | 'replaceHistory' | null ) {
306
318
if ( mode == null ) return ;
307
319
308
- let channelName : string ;
309
320
let hash = '' ;
310
321
let params : Record < 'channel_id' | 'sendto' , string | null | undefined > ;
311
322
312
323
if ( typeof channel === 'string' ) {
313
- channelName = trans ( `chat.channels.${ channel } ` ) ;
314
324
hash = channel ;
315
325
params = { channel_id : null , sendto : null } ;
316
326
} else {
317
- channelName = channel . name ;
318
327
params = channel . newPmChannel
319
328
? { channel_id : null , sendto : channel . pmTarget ?. toString ( ) }
320
329
: { channel_id : channel . channelId . toString ( ) , sendto : null } ;
321
330
322
331
}
323
332
324
333
Turbolinks . controller [ mode ] ( updateQueryString ( null , params , hash ) ) ;
325
- core . browserTitleWithNotificationCount . title = `${ channelName } · ${ trans ( 'page_title.main.chat_controller._' ) } ` ;
326
334
}
327
335
}
0 commit comments