mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 23:42:12 +00:00
Fix failing test
This commit is contained in:
parent
3a6c296883
commit
4cccaf33e2
1 changed files with 22 additions and 21 deletions
|
|
@ -578,28 +578,29 @@ schema.methods.sendChat = function sendChat (options = {}) {
|
|||
if (this.type === 'party' && user) {
|
||||
sendChatPushNotifications(user, this, newChatMessage, mentions, translate);
|
||||
}
|
||||
mentionedMembers.forEach((member) => {
|
||||
if (member._id === user._id) return;
|
||||
const pushNotifPrefs = member.preferences.pushNotifications;
|
||||
if (this.type === 'party') {
|
||||
if (pushNotifPrefs.mentionParty !== true) {
|
||||
return;
|
||||
if (mentionedMembers) {
|
||||
mentionedMembers.forEach((member) => {
|
||||
if (member._id === user._id) return;
|
||||
const pushNotifPrefs = member.preferences.pushNotifications;
|
||||
if (this.type === 'party') {
|
||||
if (pushNotifPrefs.mentionParty !== true) {
|
||||
return;
|
||||
}
|
||||
} else if (member.guilds && member.guilds.includes(this._id)) {
|
||||
if (pushNotifPrefs.mentionJoinedGuild !== true) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (this.privacy !== 'public') {
|
||||
return;
|
||||
}
|
||||
if (pushNotifPrefs.mentionUnjoinedGuild !== true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (member.guilds && member.guilds.includes(this._id)) {
|
||||
if (pushNotifPrefs.mentionJoinedGuild !== true) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (this.privacy !== 'public') {
|
||||
return;
|
||||
}
|
||||
if (pushNotifPrefs.mentionUnjoinedGuild !== true) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendPushNotification(member, {identifier: 'chatMention', title: `${user.profile.name} mentioned you in ${this.name}`, message});
|
||||
});
|
||||
|
||||
sendPushNotification(member, {identifier: 'chatMention', title: `${user.profile.name} mentioned you in ${this.name}`, message});
|
||||
});
|
||||
}
|
||||
return newChatMessage;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue