Last active
February 21, 2024 19:43
-
-
Save iaindooley/7b743ecdf7c7c40e21a3827c73201af9 to your computer and use it in GitHub Desktop.
Allow moves from users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function restrictMovesOutOfLists(notification) | |
{ | |
var notif = new Notification(notification); | |
var card = notif.movedCard(); | |
bounceBackIfNotAllowed("from "+notif.listBefore().name(),notif.member().name()); | |
} | |
function restrictMovesIntoLists(notification) | |
{ | |
var notif = new Notification(notification); | |
var card = notif.movedCard(); | |
bounceBackIfNotAllowed("into "+notif.listAfter().name(),notif.member().name()); | |
} | |
function bounceBackIfNotAllowed(permission_name,member_name) | |
{ | |
try | |
{ | |
new Trellinator() | |
.board("Mover Permissions") | |
.list(permission_name) | |
.cards().findByName(member_name); | |
} | |
catch(e) | |
{ | |
Notification.expectException(InvalidDataException,e); | |
card.moveToList(notif.listBefore()).postComment("Oops! You're not allowed to move cards"+permission_name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment