aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/FeaturesStore.js10
-rw-r--r--src/stores/GlobalErrorStore.js6
-rw-r--r--src/stores/ServicesStore.js24
3 files changed, 29 insertions, 11 deletions
diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js
index 8e0134d7f..fdb502b6b 100644
--- a/src/stores/FeaturesStore.js
+++ b/src/stores/FeaturesStore.js
@@ -9,13 +9,10 @@ import workspaces from '../features/workspaces';
9import quickSwitch from '../features/quickSwitch'; 9import quickSwitch from '../features/quickSwitch';
10import nightlyBuilds from '../features/nightlyBuilds'; 10import nightlyBuilds from '../features/nightlyBuilds';
11import publishDebugInfo from '../features/publishDebugInfo'; 11import publishDebugInfo from '../features/publishDebugInfo';
12import settingsWS from '../features/settingsWS';
13import communityRecipes from '../features/communityRecipes'; 12import communityRecipes from '../features/communityRecipes';
14import todos from '../features/todos'; 13import todos from '../features/todos';
15import appearance from '../features/appearance'; 14import appearance from '../features/appearance';
16 15
17import { DEFAULT_FEATURES_CONFIG } from '../config';
18
19export default class FeaturesStore extends Store { 16export default class FeaturesStore extends Store {
20 @observable defaultFeaturesRequest = new CachedRequest( 17 @observable defaultFeaturesRequest = new CachedRequest(
21 this.api.features, 18 this.api.features,
@@ -27,7 +24,7 @@ export default class FeaturesStore extends Store {
27 'features', 24 'features',
28 ); 25 );
29 26
30 @observable features = { ...DEFAULT_FEATURES_CONFIG }; 27 @observable features = { };
31 28
32 async setup() { 29 async setup() {
33 this.registerReactions([ 30 this.registerReactions([
@@ -41,12 +38,12 @@ export default class FeaturesStore extends Store {
41 38
42 @computed get anonymousFeatures() { 39 @computed get anonymousFeatures() {
43 return ( 40 return (
44 this.defaultFeaturesRequest.execute().result || DEFAULT_FEATURES_CONFIG 41 this.defaultFeaturesRequest.execute().result || {}
45 ); 42 );
46 } 43 }
47 44
48 _updateFeatures = () => { 45 _updateFeatures = () => {
49 const features = { ...DEFAULT_FEATURES_CONFIG }; 46 const features = { };
50 if (this.stores.user.isLoggedIn) { 47 if (this.stores.user.isLoggedIn) {
51 let requestResult = {}; 48 let requestResult = {};
52 try { 49 try {
@@ -77,7 +74,6 @@ export default class FeaturesStore extends Store {
77 quickSwitch(); 74 quickSwitch();
78 nightlyBuilds(); 75 nightlyBuilds();
79 publishDebugInfo(); 76 publishDebugInfo();
80 settingsWS(this.stores, this.actions);
81 communityRecipes(this.stores, this.actions); 77 communityRecipes(this.stores, this.actions);
82 todos(this.stores, this.actions); 78 todos(this.stores, this.actions);
83 appearance(this.stores); 79 appearance(this.stores);
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js
index 7cbfdc608..9c851d6f2 100644
--- a/src/stores/GlobalErrorStore.js
+++ b/src/stores/GlobalErrorStore.js
@@ -64,7 +64,7 @@ export default class GlobalErrorStore extends Store {
64 this.response = {}; 64 this.response = {};
65 } 65 }
66 if (this.error.status === 401) { 66 if (this.error.status === 401) {
67 window.ferdi.stores.app.authRequestFailed = true; 67 window['ferdi'].stores.app.authRequestFailed = true;
68 // this.actions.user.logout({ serverLogout: true }); 68 // this.actions.user.logout({ serverLogout: true });
69 } 69 }
70 } 70 }
@@ -78,10 +78,10 @@ export default class GlobalErrorStore extends Store {
78 }, 78 },
79 error: this.error, 79 error: this.error,
80 response: this.response, 80 response: this.response,
81 server: window.ferdi.stores.settings.app.server, 81 server: window['ferdi'].stores.settings.app.server,
82 }); 82 });
83 } else { 83 } else {
84 window.ferdi.stores.app.authRequestFailed = false; 84 window['ferdi'].stores.app.authRequestFailed = false;
85 } 85 }
86 }); 86 });
87} 87}
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 4f7ad7442..926ee36f0 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -82,6 +82,7 @@ export default class ServicesStore extends Store {
82 this.actions.service.setUnreadMessageCount.listen( 82 this.actions.service.setUnreadMessageCount.listen(
83 this._setUnreadMessageCount.bind(this), 83 this._setUnreadMessageCount.bind(this),
84 ); 84 );
85 this.actions.service.setDialogTitle.listen(this._setDialogTitle.bind(this));
85 this.actions.service.openWindow.listen(this._openWindow.bind(this)); 86 this.actions.service.openWindow.listen(this._openWindow.bind(this));
86 this.actions.service.filter.listen(this._filter.bind(this)); 87 this.actions.service.filter.listen(this._filter.bind(this));
87 this.actions.service.resetFilter.listen(this._resetFilter.bind(this)); 88 this.actions.service.resetFilter.listen(this._resetFilter.bind(this));
@@ -646,6 +647,12 @@ export default class ServicesStore extends Store {
646 service.unreadIndirectMessageCount = count.indirect; 647 service.unreadIndirectMessageCount = count.indirect;
647 } 648 }
648 649
650 @action _setDialogTitle({ serviceId, dialogTitle }) {
651 const service = this.one(serviceId);
652
653 service.dialogTitle = dialogTitle;
654 }
655
649 @action _setWebviewReference({ serviceId, webview }) { 656 @action _setWebviewReference({ serviceId, webview }) {
650 const service = this.one(serviceId); 657 const service = this.one(serviceId);
651 658
@@ -683,6 +690,9 @@ export default class ServicesStore extends Store {
683 // TODO: add checks to not focus service when router path is /settings or /auth 690 // TODO: add checks to not focus service when router path is /settings or /auth
684 const service = this.active; 691 const service = this.active;
685 if (service) { 692 if (service) {
693 document.title = `Ferdi - ${service.name} ${
694 service.dialogTitle ? ` - ${service.dialogTitle}` : ''
695 } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`;
686 this._focusService({ serviceId: service.id }); 696 this._focusService({ serviceId: service.id });
687 if (this.stores.settings.app.splitMode && !focusEvent) { 697 if (this.stores.settings.app.splitMode && !focusEvent) {
688 setTimeout(() => { 698 setTimeout(() => {
@@ -741,6 +751,16 @@ export default class ServicesStore extends Store {
741 751
742 break; 752 break;
743 } 753 }
754 case 'active-dialog-title': {
755 debug(`Received active dialog title from '${serviceId}'`, args[0]);
756
757 this.actions.service.setDialogTitle({
758 serviceId,
759 dialogTitle: args[0],
760 });
761
762 break;
763 }
744 case 'notification': { 764 case 'notification': {
745 const { options } = args[0]; 765 const { options } = args[0];
746 766
@@ -1063,7 +1083,9 @@ export default class ServicesStore extends Store {
1063 const service = this.active; 1083 const service = this.active;
1064 if (service) { 1084 if (service) {
1065 this.actions.service.focusService({ serviceId: service.id }); 1085 this.actions.service.focusService({ serviceId: service.id });
1066 document.title = `Ferdi - ${service.name}`; 1086 document.title = `Ferdi - ${service.name} ${
1087 service.dialogTitle ? ` - ${service.dialogTitle}` : ''
1088 } ${service._webview ? `- ${service._webview.getTitle()}` : ''}`;
1067 } else { 1089 } else {
1068 debug('No service is active'); 1090 debug('No service is active');
1069 } 1091 }