summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authornztqa <nztqa@users.noreply.github.com>2017-09-28 16:57:04 +0900
committernztqa <nztqa@users.noreply.github.com>2017-09-28 16:57:04 +0900
commitaa1876f94c71d252d427f298e9b37c87f2fe4127 (patch)
tree6540ff8c3af1875edc6e1f0d2ce7d9480b86bdb8 /models
parenteb945f26a3be316fb2ae4452d6db45a11f8b91d4 (diff)
downloadwekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.tar.gz
wekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.tar.bz2
wekan-aa1876f94c71d252d427f298e9b37c87f2fe4127.zip
Add message from service administrator
Diffstat (limited to 'models')
-rw-r--r--models/notices.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/models/notices.js b/models/notices.js
new file mode 100644
index 00000000..d62f6797
--- /dev/null
+++ b/models/notices.js
@@ -0,0 +1,36 @@
+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});
+ }
+ });
+}