Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Last active February 21, 2024 19:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/7b743ecdf7c7c40e21a3827c73201af9 to your computer and use it in GitHub Desktop.
Save iaindooley/7b743ecdf7c7c40e21a3827c73201af9 to your computer and use it in GitHub Desktop.
Allow moves from users
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