- nella lista circuiti ora si vedono tutti gli annunci del circuito stesso
This commit is contained in:
@@ -279,7 +279,7 @@ CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
|||||||
|
|
||||||
const mycirc = await Circuit.findOne({ _id: idrec }).lean();
|
const mycirc = await Circuit.findOne({ _id: idrec }).lean();
|
||||||
if (mycirc) {
|
if (mycirc) {
|
||||||
return mycirc.admins.some(admin => admin.username === username);
|
return mycirc.admins.some(admin => (admin.username === username) || (admin.username === shared_consts.USER_ADMIN_CIRCUITS));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1003,7 +1003,9 @@ CircuitSchema.statics.getListAdminsByCircuitPath = async function (idapp, circui
|
|||||||
{ deleted: { $exists: true, $eq: false } }],
|
{ deleted: { $exists: true, $eq: false } }],
|
||||||
}, { admins: 1 }).lean();
|
}, { admins: 1 }).lean();
|
||||||
|
|
||||||
return arr && arr.admins ? arr.admins : [];
|
let myarr = arr && arr.admins ? arr.admins : [];
|
||||||
|
|
||||||
|
return [...myarr, shared_consts.USER_ADMIN_CIRCUITS]
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1206,7 +1208,7 @@ CircuitSchema.statics.isAdminCircuit = async function (idapp, circuitname, usern
|
|||||||
|
|
||||||
if (arr) {
|
if (arr) {
|
||||||
for (const admin of arr.admins) {
|
for (const admin of arr.admins) {
|
||||||
if (admin.username === username)
|
if ((admin.username === username) || (shared_consts.USER_ADMIN_CIRCUITS === username))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1926,6 +1926,8 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
|
perm: 1,
|
||||||
|
'useraport.perm': 1,
|
||||||
'useraport.username': 1,
|
'useraport.username': 1,
|
||||||
'useraport.profile.img': 1,
|
'useraport.profile.img': 1,
|
||||||
};
|
};
|
||||||
@@ -1974,6 +1976,7 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'profile.friends': 1,
|
'profile.friends': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
|
'useraport.perm': 1,
|
||||||
'useraport.username': 1,
|
'useraport.username': 1,
|
||||||
'useraport.profile.img': 1,
|
'useraport.profile.img': 1,
|
||||||
};
|
};
|
||||||
@@ -2025,8 +2028,10 @@ UserSchema.statics.getUserProfileByUsername = async function (
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
|
'useraport.perm': 1,
|
||||||
'useraport.username': 1,
|
'useraport.username': 1,
|
||||||
'useraport.profile.img': 1,
|
'useraport.profile.img': 1,
|
||||||
|
perm: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3451,6 +3456,7 @@ function getWhatToShow(idapp, username) {
|
|||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
'profile.note': 1,
|
'profile.note': 1,
|
||||||
'profile.da_contattare': 1,
|
'profile.da_contattare': 1,
|
||||||
|
perm: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3482,6 +3488,7 @@ function getWhatToShow_Unknown(idapp, username) {
|
|||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
'profile.attend': 1,
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
|
perm: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3516,6 +3523,7 @@ UserSchema.statics.getWhatToShow_IfFriends = async function (idapp, username) {
|
|||||||
'profile.bookmark': 1,
|
'profile.bookmark': 1,
|
||||||
'profile.attend': 1,
|
'profile.attend': 1,
|
||||||
'profile.seen': 1,
|
'profile.seen': 1,
|
||||||
|
perm: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -5366,6 +5374,7 @@ UserSchema.statics.getQueryReceiveRISUsers = function (idapp, hours) {
|
|||||||
'profile.handshake': 1,
|
'profile.handshake': 1,
|
||||||
'profile.note': 1,
|
'profile.note': 1,
|
||||||
'profile.da_contattare': 1,
|
'profile.da_contattare': 1,
|
||||||
|
perm: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1432,6 +1432,12 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAdminsByCircuit(circuit) {
|
||||||
|
// return circuit.admins
|
||||||
|
|
||||||
|
return [...circuit.admins, shared_consts.USER_ADMIN_CIRCUITS]
|
||||||
|
},
|
||||||
|
|
||||||
sendNotificationByCircuit: async function (idapp, usernameOrig, circuitname, cmd, value, telegram, username_action, extrarec) {
|
sendNotificationByCircuit: async function (idapp, usernameOrig, circuitname, cmd, value, telegram, username_action, extrarec) {
|
||||||
|
|
||||||
const { Circuit } = require('../models/circuit');
|
const { Circuit } = require('../models/circuit');
|
||||||
@@ -1509,7 +1515,7 @@ module.exports = {
|
|||||||
|
|
||||||
const groupOrig = '' //++Todo: extrarec.groupOrig
|
const groupOrig = '' //++Todo: extrarec.groupOrig
|
||||||
|
|
||||||
for (const singleadmin of circuit.admins) {
|
for (const singleadmin of this.getAdminsByCircuit(circuit) {
|
||||||
try {
|
try {
|
||||||
if (singleadmin.username) {
|
if (singleadmin.username) {
|
||||||
if (usernameOrig === singleadmin.username)
|
if (usernameOrig === singleadmin.username)
|
||||||
@@ -1616,12 +1622,12 @@ module.exports = {
|
|||||||
|
|
||||||
const telegrambot = require('../telegram/telegrambot');
|
const telegrambot = require('../telegram/telegrambot');
|
||||||
|
|
||||||
if (!circuit || !circuit.admins) {
|
if (!circuit || !this.getAdminsByCircuit(circuit)) {
|
||||||
console.error('sendNotifToCircuitsAdmin: missing circuit or circuit.admins', circuit);
|
console.error('sendNotifToCircuitsAdmin: missing circuit or circuit.admins', circuit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const singleadmin of circuit.admins) {
|
for (const singleadmin of this.getAdminsByCircuit(circuit)) {
|
||||||
try {
|
try {
|
||||||
if (singleadmin && singleadmin.username) {
|
if (singleadmin && singleadmin.username) {
|
||||||
const user = await User.getUserShortDataByUsername(idapp, singleadmin.username);
|
const user = await User.getUserShortDataByUsername(idapp, singleadmin.username);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ module.exports = {
|
|||||||
FILTER_NOTE: 536870912,
|
FILTER_NOTE: 536870912,
|
||||||
FILTER_SENZA_NOTE: 1073741824,
|
FILTER_SENZA_NOTE: 1073741824,
|
||||||
FILTER_DA_CONTATTARE: 2147483648,
|
FILTER_DA_CONTATTARE: 2147483648,
|
||||||
|
FILTER_FACILITATORE: 4294967296,
|
||||||
|
|
||||||
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
||||||
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
||||||
@@ -1004,6 +1005,7 @@ module.exports = {
|
|||||||
username_who_report: 1,
|
username_who_report: 1,
|
||||||
namecomplete: 1,
|
namecomplete: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
|
perm: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (proj_add)
|
if (proj_add)
|
||||||
|
|||||||
Reference in New Issue
Block a user