Merge pull request #1127 from matrix-org/t3chguy/reset_favicon_on_logout
reset page subtitle and favicon on_logged_outpull/21833/head
commit
72e73c05ac
|
@ -17,6 +17,8 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import dis from './dispatcher';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for classes that provide platform-specific functionality
|
* Base class for classes that provide platform-specific functionality
|
||||||
* eg. Setting an application badge or displaying notifications
|
* eg. Setting an application badge or displaying notifications
|
||||||
|
@ -27,6 +29,16 @@ export default class BasePlatform {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.notificationCount = 0;
|
this.notificationCount = 0;
|
||||||
this.errorDidOccur = false;
|
this.errorDidOccur = false;
|
||||||
|
|
||||||
|
dis.register(this._onAction.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
_onAction(payload: Object) {
|
||||||
|
switch (payload.action) {
|
||||||
|
case 'on_logged_out':
|
||||||
|
this.setNotificationCount(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used primarily for Analytics
|
// Used primarily for Analytics
|
||||||
|
|
|
@ -999,6 +999,7 @@ module.exports = React.createClass({
|
||||||
page_type: PageTypes.RoomDirectory,
|
page_type: PageTypes.RoomDirectory,
|
||||||
});
|
});
|
||||||
this._teamToken = null;
|
this._teamToken = null;
|
||||||
|
this._setPageSubtitle();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1323,6 +1324,10 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setPageSubtitle: function(subtitle='') {
|
||||||
|
document.title = `Riot ${subtitle}`;
|
||||||
|
},
|
||||||
|
|
||||||
updateStatusIndicator: function(state, prevState) {
|
updateStatusIndicator: function(state, prevState) {
|
||||||
let notifCount = 0;
|
let notifCount = 0;
|
||||||
|
|
||||||
|
@ -1343,15 +1348,15 @@ module.exports = React.createClass({
|
||||||
PlatformPeg.get().setNotificationCount(notifCount);
|
PlatformPeg.get().setNotificationCount(notifCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
let title = "Riot ";
|
let subtitle = '';
|
||||||
if (state === "ERROR") {
|
if (state === "ERROR") {
|
||||||
title += `[${_t("Offline")}] `;
|
subtitle += `[${_t("Offline")}] `;
|
||||||
}
|
}
|
||||||
if (notifCount > 0) {
|
if (notifCount > 0) {
|
||||||
title += `[${notifCount}]`;
|
subtitle += `[${notifCount}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.title = title;
|
this._setPageSubtitle(subtitle);
|
||||||
},
|
},
|
||||||
|
|
||||||
onUserSettingsClose: function() {
|
onUserSettingsClose: function() {
|
||||||
|
|
Loading…
Reference in New Issue