Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created April 30, 2019 23:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iaindooley/741872516f9ff3ab376701488a0c8e89 to your computer and use it in GitHub Desktop.
Save iaindooley/741872516f9ff3ab376701488a0c8e89 to your computer and use it in GitHub Desktop.
Remove trello attachments
function removeTrelloAttachments(notification)
{
new Notification(notification)
.addedCard()
.attachments(/https:\/\/trello-attachments.s3.amazonaws.com\/.*/)
.each(function(att)
{
att.remove();
});
}
@motz182
Copy link

motz182 commented Sep 2, 2019

hello I really liked your code, and I need to archive the list where the function is being performed after moving the card to another list.
A problem happens that I can't solve.
If I move a letter or chart (which contains important attachments) unintentionally back to the list containing automation these are all deleted.
Can you help me?
Sorry for my bad english, I'm learning.

@iaindooley
Copy link
Author

Hi there, you can check out the full documentation for Trellinator here:

https://www.theprocedurepeople.com/trellinator-automate-trello/docs/module-TrellinatorCore.Notification.html

The above function will remove all file attachments from any card when it is added to any list. You could pass a list name (or regex) into the addedCard method to only trigger when cards are moved to certain lists.

You could also do something like:

if(notif.boardBefore().id() != notif.board().id())

meaning you can take the action only when a card is moved to this board from another board, rather than being moved between two lists in the same board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment