diff options
author | Lauri Ojansivu <x@xet7.org> | 2016-11-20 23:31:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 23:31:50 +0200 |
commit | 1ad41072010fb59fdbace80a0aa049634074dac1 (patch) | |
tree | f3c444b06c6b38d80028d524d6e041c8a48de40e /models | |
parent | 693f615136319e0e6da370294270272691713f94 (diff) | |
parent | 4359f66ecee8003f0fa625fd5e293ba38cc133e3 (diff) | |
download | wekan-1ad41072010fb59fdbace80a0aa049634074dac1.tar.gz wekan-1ad41072010fb59fdbace80a0aa049634074dac1.tar.bz2 wekan-1ad41072010fb59fdbace80a0aa049634074dac1.zip |
Merge pull request #19 from mario-orlicky/hide-system-messages
New change settings option and possibility to hide system messagaes
Diffstat (limited to 'models')
-rw-r--r-- | models/users.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/models/users.js b/models/users.js index bdc5ddfe..a65a2566 100644 --- a/models/users.js +++ b/models/users.js @@ -59,6 +59,10 @@ Users.attachSchema(new SimpleSchema({ type: String, optional: true, }, + 'profile.hiddenSystemMessages': { + type: Boolean, + optional: true, + }, 'profile.initials': { type: String, optional: true, @@ -151,6 +155,11 @@ Users.helpers({ return _.contains(notifications, activityId); }, + hasHiddenSystemMessages() { + const profile = this.profile || {}; + return profile.hiddenSystemMessages || false; + }, + getEmailBuffer() { const {emailBuffer = []} = this.profile; return emailBuffer; @@ -231,6 +240,14 @@ Users.mutations({ this.addTag(tag); }, + toggleSystem(value = false) { + return { + $set: { + 'profile.hiddenSystemMessages': !value, + }, + }; + }, + addNotification(activityId) { return { $addToSet: { @@ -278,6 +295,10 @@ Meteor.methods({ Users.update(this.userId, {$set: { username }}); } }, + toggleSystemMessages() { + const user = Meteor.user(); + user.toggleSystem(user.hasHiddenSystemMessages()); + }, }); if (Meteor.isServer) { |