mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
- Fix Outgoing Webhook messages for Checlists, Checklist Items, Card comments, Add/Remove CustomField to board.
Not yet fixed is Outgoing Webhook message about setting CustomField value. Thanks to xet7 ! Related #1969
This commit is contained in:
parent
7c89336ea9
commit
5283ba9ebb
6 changed files with 82 additions and 19 deletions
|
|
@ -117,6 +117,29 @@ function customFieldCreation(userId, doc){
|
|||
});
|
||||
}
|
||||
|
||||
function customFieldDeletion(userId, doc){
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'deleteCustomField',
|
||||
boardId: doc.boardIds[0], // We are creating a customField, it has only one boardId
|
||||
customFieldId: doc._id,
|
||||
});
|
||||
}
|
||||
|
||||
// This has some bug, it does not show edited customField value at Outgoing Webhook,
|
||||
// instead it shows undefined, and no listId and swimlaneId.
|
||||
function customFieldEdit(userId, doc){
|
||||
const card = Cards.findOne(doc.cardId);
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'editCustomField',
|
||||
boardId: doc.boardIds[0], // We are creating a customField, it has only one boardId
|
||||
customFieldId: doc._id,
|
||||
listId: card.listId,
|
||||
swimlaneId: card.swimlaneId,
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
CustomFields._collection._ensureIndex({ boardIds: 1 });
|
||||
|
|
@ -133,9 +156,12 @@ if (Meteor.isServer) {
|
|||
{$pull: {'customFields': {'_id': doc._id}}},
|
||||
{multi: true}
|
||||
);
|
||||
customFieldEdit(userId, doc);
|
||||
Activities.remove({
|
||||
customFieldId: doc._id,
|
||||
boardId: modifier.$pull.boardIds,
|
||||
listId: card.listId,
|
||||
swimlaneId: card.swimlaneId,
|
||||
});
|
||||
} else if (_.contains(fieldNames, 'boardIds') && modifier.$push) {
|
||||
Activities.insert({
|
||||
|
|
@ -148,6 +174,7 @@ if (Meteor.isServer) {
|
|||
});
|
||||
|
||||
CustomFields.before.remove((userId, doc) => {
|
||||
customFieldDeletion(userId, doc);
|
||||
Activities.remove({
|
||||
customFieldId: doc._id,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue