Utils of canModifyCard and canModifyBoard + move this general functions to Utils class

This commit is contained in:
Martin Filser 2022-01-11 19:26:59 +01:00
parent b29ec93c34
commit 583f114c68
10 changed files with 28 additions and 135 deletions

View file

@ -212,18 +212,10 @@ BlazeComponent.extendComponent({
);
});
function userIsMember() {
return (
Meteor.user() &&
Meteor.user().isBoardMember() &&
!Meteor.user().isCommentOnly()
);
}
// If there is no data in the board (ie, no lists) we autofocus the list
// creation form by clicking on the corresponding element.
const currentBoard = Boards.findOne(Session.get('currentBoard'));
if (userIsMember() && currentBoard.lists().count() === 0) {
if (Utils.canModifyBoard() && currentBoard.lists().count() === 0) {
boardComponent.openNewListForm();
}
},