diff options
author | 2019-05-23 12:12:03 +0200 | |
---|---|---|
committer | 2019-05-23 12:12:03 +0200 | |
commit | 1b167e04a92dc1563514e68b26d762aef8e7f522 (patch) | |
tree | 0c6fc85597a60b1d34c686baf4b4c5b9b527e68b /src | |
parent | Update slack notification webhook (diff) | |
parent | support multilingual announcements (diff) | |
download | ferdium-app-1b167e04a92dc1563514e68b26d762aef8e7f522.tar.gz ferdium-app-1b167e04a92dc1563514e68b26d762aef8e7f522.tar.zst ferdium-app-1b167e04a92dc1563514e68b26d762aef8e7f522.zip |
Merge pull request #1443 from meetfranz/feature/multilingual-announcements
support multilingual announcements
Diffstat (limited to 'src')
-rw-r--r-- | src/features/announcements/store.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/features/announcements/store.js b/src/features/announcements/store.js index 0d2b68ccf..ad78a0979 100644 --- a/src/features/announcements/store.js +++ b/src/features/announcements/store.js | |||
@@ -29,7 +29,15 @@ export class AnnouncementsStore extends FeatureStore { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | @computed get announcement() { | 31 | @computed get announcement() { |
32 | return getAnnouncementRequest.result; | 32 | if (!this.stores || !getAnnouncementRequest.result) return null; |
33 | const { locale, defaultLocale } = this.stores.app; | ||
34 | const announcement = getAnnouncementRequest.result; | ||
35 | // User locale | ||
36 | if (announcement[locale]) return announcement[locale]; | ||
37 | // Default locale | ||
38 | if (announcement[defaultLocale]) return announcement[defaultLocale]; | ||
39 | // No locales specified | ||
40 | return announcement; | ||
33 | } | 41 | } |
34 | 42 | ||
35 | @computed get areNewsAvailable() { | 43 | @computed get areNewsAvailable() { |
@@ -121,8 +129,8 @@ export class AnnouncementsStore extends FeatureStore { | |||
121 | _fetchAnnouncements = () => { | 129 | _fetchAnnouncements = () => { |
122 | const targetVersion = this.targetVersion || this.currentVersion; | 130 | const targetVersion = this.targetVersion || this.currentVersion; |
123 | if (!targetVersion) return; | 131 | if (!targetVersion) return; |
124 | getChangelogRequest.execute(targetVersion); | 132 | getChangelogRequest.reset().execute(targetVersion); |
125 | getAnnouncementRequest.execute(targetVersion); | 133 | getAnnouncementRequest.reset().execute(targetVersion); |
126 | }; | 134 | }; |
127 | 135 | ||
128 | _showAnnouncementOnRouteMatch = () => { | 136 | _showAnnouncementOnRouteMatch = () => { |