Export Movements to CSV File
fix Visibility for a Circuit
This commit is contained in:
@@ -731,17 +731,17 @@ module.exports = {
|
||||
// Pass object into sendNotification
|
||||
return webpush.sendNotification(subscription._doc, JSON.stringify(payload),
|
||||
pushOptions).
|
||||
catch(err => {
|
||||
catch((err) => {
|
||||
if (err.statusCode === 410) {
|
||||
// Gone: is not valid anymore (Expired probably!), so I have to delete from my db
|
||||
return Subscription.findOneAndRemove({_id: subscription._id});
|
||||
} else {
|
||||
console.log('Subscription is no longer valid: ', err);
|
||||
}
|
||||
}).then((ris) => {
|
||||
|
||||
}).
|
||||
then(ris => {
|
||||
console.log('sendNotification', ris);
|
||||
}).
|
||||
// console.log('sendNotification', ris);
|
||||
catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -1157,17 +1157,19 @@ module.exports = {
|
||||
|
||||
let recnotif = null;
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
||||
recnotif = await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REQ_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
recnotif = await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REQ_SENT, idapp, extrarec.dest, usernameOrig,
|
||||
username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) {
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT_SENT, idapp, extrarec.dest, usernameOrig,
|
||||
username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT, idapp, extrarec.dest, usernameOrig, username_action, circuitname, circuit.path, null,
|
||||
await this.sendNotifCircuitByUsername(shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT, idapp, extrarec.dest, usernameOrig,
|
||||
username_action, circuitname, circuit.path, null,
|
||||
false, '', extrarec);
|
||||
}
|
||||
|
||||
|
||||
if (recnotif)
|
||||
extrarec.notifIdToUpdate = recnotif._id;
|
||||
ris = await this.sendNotifCircuitByUsername(cmd, idapp, usernameOrig, extrarec.dest, username_action, circuitname, circuit.path,
|
||||
@@ -1176,7 +1178,6 @@ module.exports = {
|
||||
|
||||
extrarec.notifIdToUpdate = '';
|
||||
|
||||
|
||||
if (ris)
|
||||
inviato = true;
|
||||
// ++Todo: Inviare anche agli Admin ?!
|
||||
@@ -2018,7 +2019,7 @@ module.exports = {
|
||||
filteradmin = true;
|
||||
}
|
||||
|
||||
if (myfilter['pub_to_share'] === shared_consts.PUBTOSHARE.ONLY_GROUPS_FOLLOW) {
|
||||
if (myfilter['pub_to_share'] === shared_consts.PUBTOSHARE.ONLY_TABLE_FOLLOW && params.table === 'mygroups') {
|
||||
|
||||
let arraygroups = [];
|
||||
|
||||
@@ -2038,6 +2039,27 @@ module.exports = {
|
||||
},
|
||||
};
|
||||
|
||||
query.push({$match: {$and: [condition]}});
|
||||
} else if (myfilter['pub_to_share'] === shared_consts.PUBTOSHARE.ONLY_TABLE_FOLLOW && params.table === 'circuits') {
|
||||
|
||||
let arraycircuits = [];
|
||||
|
||||
if (user && user.profile.mycircuits) {
|
||||
arraycircuits = user.profile.mycircuits.map(rec => rec.circuitname);
|
||||
}
|
||||
// prendere i gruppi dell'utente
|
||||
|
||||
// Cerca tra i gruppi di ogni record, se combaciano almeno 1
|
||||
condition = {
|
||||
'profile.mycircuits':
|
||||
{
|
||||
$elemMatch: {
|
||||
circuitname: {$in: arraycircuits},
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
query.push({$match: {$and: [condition]}});
|
||||
} else if (shared_consts.TABLES_ENABLE_GETREC_BYID.includes(params.table)) {
|
||||
// Rimuovi dalla query quelli non visibili
|
||||
@@ -2099,16 +2121,25 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
if (params.table === 'mygroups') {
|
||||
if (params.table === 'mygroups' || params.table === 'circuits') {
|
||||
// BINARY CHECK (?): const filter = [{ visibility: { $bitsAnyClear: [1] } }];
|
||||
// if (!User.isAdmin(req.user.perm)) {
|
||||
// not Visibility_Group.HIDDEN
|
||||
if (!filteradmin) {
|
||||
const filter = [
|
||||
{
|
||||
visibility: {
|
||||
$nin: [shared_consts.Visibility_Group.HIDDEN],
|
||||
},
|
||||
$or: [
|
||||
{
|
||||
visibility: {
|
||||
$nin: [shared_consts.Visibility_Group.HIDDEN],
|
||||
},
|
||||
},
|
||||
{
|
||||
createdBy: {
|
||||
$eq: user.username,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
query.push({$match: {$and: filter}});
|
||||
@@ -3331,6 +3362,6 @@ module.exports = {
|
||||
|
||||
getAhref(username, link) {
|
||||
return `<a href='${link}'>${username}</a>`;
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user