From a88ac6113e5f7f428d0f021bbcb213cc517c177e Mon Sep 17 00:00:00 2001 From: nztqa Date: Sun, 1 Oct 2017 12:43:15 +0900 Subject: Rename notice -> announcement --- models/announcements.js | 36 ++++++++++++++++++++++++++++++++++++ models/notices.js | 36 ------------------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 models/announcements.js delete mode 100644 models/notices.js (limited to 'models') diff --git a/models/announcements.js b/models/announcements.js new file mode 100644 index 00000000..2cb1e1b7 --- /dev/null +++ b/models/announcements.js @@ -0,0 +1,36 @@ +Announcements = new Mongo.Collection('announcements'); + +Announcements.attachSchema(new SimpleSchema({ + enabled: { + type: Boolean, + defaultValue: false, + }, + title: { + type: String, + optional: true, + }, + body: { + type: String, + optional: true, + }, + sort: { + type: Number, + decimal: true, + }, +})); + +Announcements.allow({ + update(userId) { + const user = Users.findOne(userId); + return user && user.isAdmin; + }, +}); + +if (Meteor.isServer) { + Meteor.startup(() => { + const announcements = Announcements.findOne({}); + if(!announcements){ + Announcements.insert({enabled: false, sort: 0}); + } + }); +} diff --git a/models/notices.js b/models/notices.js deleted file mode 100644 index d62f6797..00000000 --- a/models/notices.js +++ /dev/null @@ -1,36 +0,0 @@ -Notices = new Mongo.Collection('notices'); - -Notices.attachSchema(new SimpleSchema({ - enabled: { - type: Boolean, - defaultValue: false, - }, - title: { - type: String, - optional: true, - }, - body: { - type: String, - optional: true, - }, - sort: { - type: Number, - decimal: true, - }, -})); - -Notices.allow({ - update(userId) { - const user = Users.findOne(userId); - return user && user.isAdmin; - }, -}); - -if (Meteor.isServer) { - Meteor.startup(() => { - const notices = Notices.findOne({}); - if(!notices){ - Notices.insert({enabled: false, sort: 0}); - } - }); -} -- cgit v1.2.3-1-g7c22