mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Merge pull request #3471 from matrix-org/matthew/room_name
put the room name in the title tag
This commit is contained in:
commit
76d691c373
@ -271,6 +271,10 @@ export default createReactClass({
|
||||
|
||||
this.focusComposer = false;
|
||||
|
||||
// object field used for tracking the status info appended to the title tag.
|
||||
// we don't do it as react state as i'm scared about triggering needless react refreshes.
|
||||
this.subTitleStatus = '';
|
||||
|
||||
// this can technically be done anywhere but doing this here keeps all
|
||||
// the routing url path logic together.
|
||||
if (this.onAliasClick) {
|
||||
@ -1297,6 +1301,7 @@ export default createReactClass({
|
||||
collapsedRhs: false,
|
||||
currentRoomId: null,
|
||||
});
|
||||
this.subTitleStatus = '';
|
||||
this._setPageSubtitle();
|
||||
},
|
||||
|
||||
@ -1312,6 +1317,7 @@ export default createReactClass({
|
||||
collapsedRhs: false,
|
||||
currentRoomId: null,
|
||||
});
|
||||
this.subTitleStatus = '';
|
||||
this._setPageSubtitle();
|
||||
},
|
||||
|
||||
@ -1706,6 +1712,7 @@ export default createReactClass({
|
||||
if (this.props.onNewScreen) {
|
||||
this.props.onNewScreen(screen);
|
||||
}
|
||||
this._setPageSubtitle();
|
||||
},
|
||||
|
||||
onAliasClick: function(event, alias) {
|
||||
@ -1821,7 +1828,13 @@ export default createReactClass({
|
||||
},
|
||||
|
||||
_setPageSubtitle: function(subtitle='') {
|
||||
document.title = `${SdkConfig.get().brand || 'Riot'} ${subtitle}`;
|
||||
if (this.state.currentRoomId) {
|
||||
const room = MatrixClientPeg.get().getRoom(this.state.currentRoomId);
|
||||
if (room) {
|
||||
subtitle = `| ${ room.name }`;
|
||||
}
|
||||
}
|
||||
document.title = `${SdkConfig.get().brand || 'Riot'} ${subtitle} ${this.subTitleStatus}`;
|
||||
},
|
||||
|
||||
updateStatusIndicator: function(state, prevState) {
|
||||
@ -1832,15 +1845,15 @@ export default createReactClass({
|
||||
PlatformPeg.get().setNotificationCount(notifCount);
|
||||
}
|
||||
|
||||
let subtitle = '';
|
||||
this.subTitleStatus = '';
|
||||
if (state === "ERROR") {
|
||||
subtitle += `[${_t("Offline")}] `;
|
||||
this.subTitleStatus += `[${_t("Offline")}] `;
|
||||
}
|
||||
if (notifCount > 0) {
|
||||
subtitle += `[${notifCount}]`;
|
||||
this.subTitleStatus += `[${notifCount}]`;
|
||||
}
|
||||
|
||||
this._setPageSubtitle(subtitle);
|
||||
this._setPageSubtitle();
|
||||
},
|
||||
|
||||
onCloseAllSettings() {
|
||||
|
Loading…
Reference in New Issue
Block a user