aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/notice-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/notice-controller.js')
-rw-r--r--app/scripts/notice-controller.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
index 57aad40c5..bc545127e 100644
--- a/app/scripts/notice-controller.js
+++ b/app/scripts/notice-controller.js
@@ -1,4 +1,5 @@
const EventEmitter = require('events').EventEmitter
+const semver = require('semver')
const extend = require('xtend')
const ObservableStore = require('obs-store')
const hardCodedNotices = require('../../notices/notices.json')
@@ -8,6 +9,7 @@ module.exports = class NoticeController extends EventEmitter {
constructor (opts) {
super()
this.noticePoller = null
+ this.version = opts.version
const initState = extend({
noticesList: [],
}, opts.initState)
@@ -51,7 +53,13 @@ module.exports = class NoticeController extends EventEmitter {
}
updateNoticesList () {
- return this._retrieveNoticeData().then((newNotices) => {
+ return this._retrieveNoticeData().then((hardNotices) => {
+ const newNotices = hardNotices.filter((newNotice) => {
+ if ('version' in newNotice) {
+ return semver.satisfies(this.version, newNotice.version)
+ }
+ return true
+ })
var oldNotices = this.getNoticesList()
var combinedNotices = this._mergeNotices(oldNotices, newNotices)
return Promise.resolve(this.setNoticesList(combinedNotices))