summaryrefslogtreecommitdiffstats
path: root/models/boards.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/boards.js')
-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) {