mirror of
https://github.com/wekan/wekan.git
synced 2026-02-21 07:24:07 +01:00
Use sync code in allow/deny for 2.x
This commit is contained in:
parent
f934aea2a5
commit
e77be37450
28 changed files with 594 additions and 410 deletions
|
|
@ -118,7 +118,7 @@ if (Meteor.isServer) {
|
|||
if (activity.userId) {
|
||||
// No need send notification to user of activity
|
||||
// participants = _.union(participants, [activity.userId]);
|
||||
const user = activity.user();
|
||||
const user = await activity.user();
|
||||
if (user) {
|
||||
if (user.getName()) {
|
||||
params.user = user.getName();
|
||||
|
|
@ -146,7 +146,7 @@ if (Meteor.isServer) {
|
|||
params.boardId = activity.boardId;
|
||||
}
|
||||
if (activity.oldBoardId) {
|
||||
const oldBoard = activity.oldBoard();
|
||||
const oldBoard = await activity.oldBoard();
|
||||
if (oldBoard) {
|
||||
watchers = _.union(watchers, oldBoard.watchers || []);
|
||||
params.oldBoard = oldBoard.title;
|
||||
|
|
@ -155,10 +155,10 @@ if (Meteor.isServer) {
|
|||
}
|
||||
if (activity.memberId) {
|
||||
participants = _.union(participants, [activity.memberId]);
|
||||
params.member = activity.member().getName();
|
||||
params.member = (await activity.member()).getName();
|
||||
}
|
||||
if (activity.listId) {
|
||||
const list = activity.list();
|
||||
const list = await activity.list();
|
||||
if (list) {
|
||||
if (list.watchers !== undefined) {
|
||||
watchers = _.union(watchers, list.watchers || []);
|
||||
|
|
@ -168,7 +168,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
if (activity.oldListId) {
|
||||
const oldList = activity.oldList();
|
||||
const oldList = await activity.oldList();
|
||||
if (oldList) {
|
||||
watchers = _.union(watchers, oldList.watchers || []);
|
||||
params.oldList = oldList.title;
|
||||
|
|
@ -176,7 +176,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
if (activity.oldSwimlaneId) {
|
||||
const oldSwimlane = activity.oldSwimlane();
|
||||
const oldSwimlane = await activity.oldSwimlane();
|
||||
if (oldSwimlane) {
|
||||
watchers = _.union(watchers, oldSwimlane.watchers || []);
|
||||
params.oldSwimlane = oldSwimlane.title;
|
||||
|
|
@ -184,7 +184,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
if (activity.cardId) {
|
||||
const card = activity.card();
|
||||
const card = await activity.card();
|
||||
participants = _.union(participants, [card.userId], card.members || []);
|
||||
watchers = _.union(watchers, card.watchers || []);
|
||||
params.card = card.title;
|
||||
|
|
@ -193,12 +193,12 @@ if (Meteor.isServer) {
|
|||
params.cardId = activity.cardId;
|
||||
}
|
||||
if (activity.swimlaneId) {
|
||||
const swimlane = activity.swimlane();
|
||||
const swimlane = await activity.swimlane();
|
||||
params.swimlane = swimlane.title;
|
||||
params.swimlaneId = activity.swimlaneId;
|
||||
}
|
||||
if (activity.commentId) {
|
||||
const comment = activity.comment();
|
||||
const comment = await activity.comment();
|
||||
params.comment = comment.text;
|
||||
let hasMentions = false; // Track if comment has @mentions
|
||||
if (board) {
|
||||
|
|
@ -257,7 +257,7 @@ if (Meteor.isServer) {
|
|||
hasMentions = true;
|
||||
} else if (activity.cardId && username === 'card_members') {
|
||||
// mentions all card members if assigned
|
||||
const card = activity.card();
|
||||
const card = await activity.card();
|
||||
if (card && card.members && card.members.length > 0) {
|
||||
// Filter to only valid users who are board members
|
||||
const validMembers = [];
|
||||
|
|
@ -273,7 +273,7 @@ if (Meteor.isServer) {
|
|||
hasMentions = true;
|
||||
} else if (activity.cardId && username === 'card_assignees') {
|
||||
// mentions all assignees of the current card
|
||||
const card = activity.card();
|
||||
const card = await activity.card();
|
||||
if (card && card.assignees && card.assignees.length > 0) {
|
||||
// Filter to only valid users who are board members
|
||||
const validAssignees = [];
|
||||
|
|
@ -310,7 +310,7 @@ if (Meteor.isServer) {
|
|||
params.attachmentId = activity.attachmentId;
|
||||
}
|
||||
if (activity.checklistId) {
|
||||
const checklist = activity.checklist();
|
||||
const checklist = await activity.checklist();
|
||||
if (checklist) {
|
||||
if (checklist.title) {
|
||||
params.checklist = checklist.title;
|
||||
|
|
@ -318,7 +318,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
if (activity.checklistItemId) {
|
||||
const checklistItem = activity.checklistItem();
|
||||
const checklistItem = await activity.checklistItem();
|
||||
if (checklistItem) {
|
||||
if (checklistItem.title) {
|
||||
params.checklistItem = checklistItem.title;
|
||||
|
|
@ -326,7 +326,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
if (activity.customFieldId) {
|
||||
const customField = activity.customField();
|
||||
const customField = await activity.customField();
|
||||
if (customField) {
|
||||
if (customField.name) {
|
||||
params.customField = customField.name;
|
||||
|
|
@ -338,7 +338,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
// Label activity did not work yet, unable to edit labels when tried this.
|
||||
if (activity.labelId) {
|
||||
const label = activity.label();
|
||||
const label = await activity.label();
|
||||
if (label) {
|
||||
if (label.name) {
|
||||
params.label = label.name;
|
||||
|
|
@ -368,10 +368,8 @@ if (Meteor.isServer) {
|
|||
try {
|
||||
const atype = activity.activityType;
|
||||
if (new RegExp(BIGEVENTS).exec(atype)) {
|
||||
watchers = _.union(
|
||||
watchers,
|
||||
board.activeMembers().map((member) => member.userId),
|
||||
); // notify all active members for important events
|
||||
const activeMemberIds = _.filter(board.members, m => m.isActive === true).map(m => m.userId);
|
||||
watchers = _.union(watchers, activeMemberIds); // notify all active members for important events
|
||||
}
|
||||
} catch (e) {
|
||||
// passed env var BIGEVENTS_PATTERN is not a valid regex
|
||||
|
|
@ -396,7 +394,7 @@ if (Meteor.isServer) {
|
|||
);
|
||||
}
|
||||
}
|
||||
Notifications.getUsers(watchers).forEach((user) => {
|
||||
(await Notifications.getUsers(watchers)).forEach((user) => {
|
||||
// Skip if user is undefined or doesn't have an _id (e.g., deleted user or invalid ID)
|
||||
if (!user || !user._id) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue