From 828f6ea321020eda77fea399df52889e2081dfac Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Fri, 10 May 2019 20:50:53 +0300 Subject: - Add Feature: Move board to Archive button at each board at All Boards page. Thanks to xet7 ! Related #2389 --- models/boards.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'models/boards.js') 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) { -- cgit v1.2.3-1-g7c22