summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-05-10 21:03:03 +0300
committerLauri Ojansivu <x@xet7.org>2019-05-10 21:03:03 +0300
commitac0f13ad1891d576ba5bf662daaab7676a8fc74f (patch)
treebf426e2d761228b7cc76f4d305608da93240f49f /models
parent34b1654077c791e583c9d9dbbc4e73c910b7d373 (diff)
parentab4dab2ade0577d4eb344f8b940e3b8ccafbe626 (diff)
downloadwekan-ac0f13ad1891d576ba5bf662daaab7676a8fc74f.tar.gz
wekan-ac0f13ad1891d576ba5bf662daaab7676a8fc74f.tar.bz2
wekan-ac0f13ad1891d576ba5bf662daaab7676a8fc74f.zip
Merge branch 'edge' into meteor-1.8
Diffstat (limited to 'models')
-rw-r--r--models/boards.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js
index b07d9e27..396d90fb 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -867,6 +867,22 @@ if (Meteor.isServer) {
} else throw new Meteor.Error('error-board-doesNotExist');
},
});
+
+ Meteor.methods({
+ archiveBoard(boardId) {
+ check(boardId, String);
+ const board = Boards.findOne(boardId);
+ if (board) {
+ const userId = Meteor.userId();
+ const index = board.memberIndex(userId);
+ if (index >= 0) {
+ board.archive();
+ return true;
+ } else throw new Meteor.Error('error-board-notAMember');
+ } else throw new Meteor.Error('error-board-doesNotExist');
+ },
+ });
+
}
if (Meteor.isServer) {