favorite: send if alert active
This commit is contained in:
@@ -4809,7 +4809,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
||||
|
||||
UserSchema.statics.updateVersion = async function (userversion, recUser) {
|
||||
|
||||
if (userversion < 063) {
|
||||
if (userversion < 603) {
|
||||
recUser.profile.notifs.push( { dir: 11, value: 1 })
|
||||
|
||||
await User.findOneAndUpdate({_id: recUser._id}, {$set: { 'profile.notifs': recUser.profile.notifs }});
|
||||
|
||||
@@ -370,6 +370,7 @@ module.exports = {
|
||||
{
|
||||
username: 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.notifs': 1,
|
||||
},
|
||||
).lean();
|
||||
|
||||
@@ -379,8 +380,21 @@ module.exports = {
|
||||
const mytitle = await tools.convertSpecialTags(user, params.title);
|
||||
const mycontent = await tools.convertSpecialTags(user, params.content);
|
||||
|
||||
const usernotifprofile = user.profile.notifs.find((notif) => notif.dir === params.typenotif);
|
||||
|
||||
let risult = null;
|
||||
|
||||
let sendmsg = false;
|
||||
|
||||
if (params.typenotif === shared_consts.TypeNotifs.TYPEDIR_FAVORITE) {
|
||||
if (!usernotifprofile || (usernotifprofile && tools.isBitActive(usernotifprofile.value, shared_consts.TypeNotifs.ID_FAVORITE_ADDED))) {
|
||||
sendmsg = true;
|
||||
}
|
||||
} else {
|
||||
sendmsg = true;
|
||||
}
|
||||
|
||||
if (sendmsg) {
|
||||
if (params.sendreally) {
|
||||
if (tools.isBitActive(params.typesend, shared_consts.TypeSend.PUSH_NOTIFICATION)) {
|
||||
const myparam = { ...params };
|
||||
@@ -417,6 +431,7 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nummsgsent > 0) {
|
||||
console.log('FINE Invio Messaggi ! Inviati Totali: ', nummsgsent, 'su', numrec);
|
||||
|
||||
Reference in New Issue
Block a user