- fix: "Circuito RIS {nomecircuito}" uniformati tutti quanti.
- fix Strette di mano dicitura. - poter vedere e cliccare sul gruppo telegram della provincia (dalla lista dei circuiti).
This commit is contained in:
@@ -1445,6 +1445,44 @@ module.exports = {
|
||||
},
|
||||
*/
|
||||
|
||||
async sendNotifToCircuitsAdmin(idapp, circuit, alsotelegram, title, msg, tag = '') {
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const telegrambot = require('../telegram/telegrambot');
|
||||
|
||||
if (!circuit || !circuit.admins) {
|
||||
console.error('sendNotifToCircuitsAdmin: missing circuit or circuit.admins', circuit);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const singleadmin of circuit.admins) {
|
||||
try {
|
||||
if (singleadmin && singleadmin.username) {
|
||||
const user = await User.getUserShortDataByUsername(idapp, singleadmin.username);
|
||||
|
||||
if (user) {
|
||||
if (alsotelegram) {
|
||||
if (!user.profile || !user.profile.teleg_id) {
|
||||
console.error('sendNotifToCircuitsAdmin: missing user.profile.teleg_id', user);
|
||||
} else {
|
||||
telegrambot.local_sendMsgTelegramByIdTelegram(idapp, user.profile.teleg_id, title + ' ' + msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!user._id) {
|
||||
console.error('sendNotifToCircuitsAdmin: missing user._id', user);
|
||||
} else {
|
||||
await this.sendNotificationToUser(user._id, title, msg, '/', '', tag, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('sendNotifToCircuitsAdmin', e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
sendNotifToAdmin(idapp, alsotelegram, title, msg, tag = '') {
|
||||
try {
|
||||
const { User } = require('../models/user');
|
||||
|
||||
Reference in New Issue
Block a user