piccole modifiche...
This commit is contained in:
@@ -599,7 +599,7 @@ async function inizia() {
|
|||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
||||||
telegrambot.ADMIN_USER_SERVER,
|
shared_consts.ADMIN_USER_SERVER,
|
||||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
||||||
|
|||||||
@@ -1107,7 +1107,7 @@ CircuitSchema.statics.getCircuitMyProvince = async function (idapp, username) {
|
|||||||
CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, province, card) {
|
CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, province, card) {
|
||||||
const { User } = require('../models/user');
|
const { User } = require('../models/user');
|
||||||
|
|
||||||
const useradmin = tools.USER_ADMIN_CIRCUITS;
|
const useradmin = shared_consts.USER_ADMIN_CIRCUITS;
|
||||||
|
|
||||||
let myrec = null;
|
let myrec = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ module.exports.createFirstUserAdmin = async function () {
|
|||||||
if (numusers === 0) {
|
if (numusers === 0) {
|
||||||
// Non esistono utenti, quindi creo quello di Admin
|
// Non esistono utenti, quindi creo quello di Admin
|
||||||
|
|
||||||
const utenteadmin = { idapp: '13', username: telegrambot.ADMIN_USER_SERVER };
|
const utenteadmin = { idapp: '13', username: shared_consts.ADMIN_USER_SERVER };
|
||||||
|
|
||||||
const newuser = new User(utenteadmin);
|
const newuser = new User(utenteadmin);
|
||||||
newuser._id = new ObjectId();
|
newuser._id = new ObjectId();
|
||||||
|
|||||||
@@ -2653,10 +2653,10 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_REPORTED);
|
shared_consts.TypeNotifs.ID_FRIENDS_REPORTED);
|
||||||
|
|
||||||
if (usernameOrig !== telegrambot.ADMIN_USER_SERVER) {
|
if (usernameOrig !== shared_consts.ADMIN_USER_SERVER) {
|
||||||
// Send a notification to the Admin
|
// Send a notification to the Admin
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null,
|
await SendNotif.createNewNotifToSingleUser(req, null,
|
||||||
{ username_worked, usernameDest: telegrambot.ADMIN_USER_SERVER, username_action, isAdmin: true }, false,
|
{ username_worked, usernameDest: shared_consts.ADMIN_USER_SERVER, username_action, isAdmin: true }, false,
|
||||||
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_REPORTED);
|
shared_consts.TypeNotifs.ID_FRIENDS_REPORTED);
|
||||||
}
|
}
|
||||||
@@ -2685,10 +2685,10 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
|||||||
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_UNBLOCKED);
|
shared_consts.TypeNotifs.ID_FRIENDS_UNBLOCKED);
|
||||||
|
|
||||||
if (usernameOrig !== telegrambot.ADMIN_USER_SERVER) {
|
if (usernameOrig !== shared_consts.ADMIN_USER_SERVER) {
|
||||||
// Send a notification to the Admin
|
// Send a notification to the Admin
|
||||||
await SendNotif.createNewNotifToSingleUser(req, null,
|
await SendNotif.createNewNotifToSingleUser(req, null,
|
||||||
{ username_worked, usernameDest: telegrambot.ADMIN_USER_SERVER, username_action, isAdmin: true }, false,
|
{ username_worked, usernameDest: shared_consts.ADMIN_USER_SERVER, username_action, isAdmin: true }, false,
|
||||||
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
shared_consts.TypeNotifs.TYPEDIR_FRIENDS,
|
||||||
shared_consts.TypeNotifs.ID_FRIENDS_UNBLOCKED);
|
shared_consts.TypeNotifs.ID_FRIENDS_UNBLOCKED);
|
||||||
}
|
}
|
||||||
@@ -4085,22 +4085,6 @@ UserSchema.statics.isManagerByIdTeleg = async function (idapp, idtelegram) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.isAdminByIdTeleg = async function (idapp, idtelegram) {
|
|
||||||
const User = this;
|
|
||||||
|
|
||||||
return await User.findOne({
|
|
||||||
idapp,
|
|
||||||
username: 'paoloar77',
|
|
||||||
'profile.admin_telegram': true,
|
|
||||||
'profile.teleg_id': idtelegram,
|
|
||||||
}, { 'profile.teleg_id': 1 }).then((rec) => {
|
|
||||||
return (!!rec && rec.profile.teleg_id === idtelegram);
|
|
||||||
}).catch((e) => {
|
|
||||||
console.error('getusersManagers', e);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
UserSchema.statics.isAdminByUsername = async function (idapp, username) {
|
UserSchema.statics.isAdminByUsername = async function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ async function inizia() {
|
|||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
||||||
telegrambot.ADMIN_USER_SERVER,
|
shared_consts.ADMIN_USER_SERVER,
|
||||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
||||||
|
|||||||
@@ -702,7 +702,6 @@ const MyTelegramBot = {
|
|||||||
|
|
||||||
ADMIN_IDTELEGRAM_SERVER: '12429864', //Paolo
|
ADMIN_IDTELEGRAM_SERVER: '12429864', //Paolo
|
||||||
ADMIN_USERNAME_TELEGRAM: 'surya1977', //Paolo
|
ADMIN_USERNAME_TELEGRAM: 'surya1977', //Paolo
|
||||||
ADMIN_USER_SERVER: 'paoloar77',
|
|
||||||
ADMIN_USER_NAME_SERVER: 'Paolo',
|
ADMIN_USER_NAME_SERVER: 'Paolo',
|
||||||
|
|
||||||
phase: {
|
phase: {
|
||||||
@@ -3073,9 +3072,6 @@ class Telegram {
|
|||||||
|
|
||||||
// let chiedisino = false;
|
// let chiedisino = false;
|
||||||
|
|
||||||
// TEST usersall = await User.getUsersTelegALL(rec.user.idapp, 'paoloar77');
|
|
||||||
|
|
||||||
|
|
||||||
for (const utente of usersall) {
|
for (const utente of usersall) {
|
||||||
|
|
||||||
let FormDaMostrare = null;
|
let FormDaMostrare = null;
|
||||||
@@ -3098,7 +3094,7 @@ class Telegram {
|
|||||||
} else if (destin === Destin.TUTTI) {
|
} else if (destin === Destin.TUTTI) {
|
||||||
invia = true;
|
invia = true;
|
||||||
} else if (destin === Destin.PAOLO) {
|
} else if (destin === Destin.PAOLO) {
|
||||||
invia = utente.username === 'paoloar77';
|
invia = utente.username === shared_consts.ADMIN_USER_SERVER;
|
||||||
} else if (destin === Destin.A_UTENTE) {
|
} else if (destin === Destin.A_UTENTE) {
|
||||||
invia = utente.username === rec.msgall_username_specifico;
|
invia = utente.username === rec.msgall_username_specifico;
|
||||||
} else if (destin === Destin.DOMANDA) {
|
} else if (destin === Destin.DOMANDA) {
|
||||||
@@ -3644,7 +3640,6 @@ class Telegram {
|
|||||||
|
|
||||||
// Check if you are Admin
|
// Check if you are Admin
|
||||||
const user = await User.UserByIdTelegram(idapp, id);
|
const user = await User.UserByIdTelegram(idapp, id);
|
||||||
// let isAdmin = user ? user.profile.manage_telegram && user.username === 'paoloar77' : false;
|
|
||||||
let isAdmin = user ? user.profile.admin_telegram : false;
|
let isAdmin = user ? user.profile.admin_telegram : false;
|
||||||
const isManager = user ? user.profile.manage_telegram : false;
|
const isManager = user ? user.profile.manage_telegram : false;
|
||||||
const isVerified = user ? user.profile.teleg_id > 0 && user.verified_by_aportador : false;
|
const isVerified = user ? user.profile.teleg_id > 0 && user.verified_by_aportador : false;
|
||||||
|
|||||||
@@ -554,8 +554,6 @@ module.exports = {
|
|||||||
|
|
||||||
SEP: '|',
|
SEP: '|',
|
||||||
|
|
||||||
USER_ADMIN_CIRCUITS: 'paoloar77',
|
|
||||||
|
|
||||||
TYPE_PROJECT: 1,
|
TYPE_PROJECT: 1,
|
||||||
TYPE_TODO: 2,
|
TYPE_TODO: 2,
|
||||||
|
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ module.exports = {
|
|||||||
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_NON_SOCI) {
|
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_NON_SOCI) {
|
||||||
addquery = { 'profile.socio': false };
|
addquery = { 'profile.socio': false };
|
||||||
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_PAOLO) {
|
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_PAOLO) {
|
||||||
addquery = { username: 'paoloar77' };
|
addquery = { username: shared_consts.ADMIN_USER_SERVER };
|
||||||
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_USER) {
|
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_USER) {
|
||||||
addquery = { username: params.usernameDest };
|
addquery = { username: params.usernameDest };
|
||||||
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_MYSELF) {
|
} else if (params.typemsg === shared_consts.TypeMsg.SEND_TO_MYSELF) {
|
||||||
@@ -426,7 +426,7 @@ module.exports = {
|
|||||||
).lean();
|
).lean();
|
||||||
|
|
||||||
if (!tools.sulServer()) {
|
if (!tools.sulServer()) {
|
||||||
arrusers = await User.find({ idapp, username: telegrambot.ADMIN_USER_SERVER });
|
arrusers = await User.find({ idapp, username: shared_consts.ADMIN_USER_SERVER });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const user of arrusers) {
|
for (const user of arrusers) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
USER_ADMIN_CIRCUITS: 'surya1977',
|
||||||
|
ADMIN_USER_SERVER: 'surya1977',
|
||||||
Accepted: {
|
Accepted: {
|
||||||
CHECK_READ_GUIDELINES: 1,
|
CHECK_READ_GUIDELINES: 1,
|
||||||
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
CHECK_SEE_VIDEO_PRINCIPI: 2,
|
||||||
@@ -47,6 +49,8 @@ module.exports = {
|
|||||||
FILTER_USER_PROVINCE: 16777216,
|
FILTER_USER_PROVINCE: 16777216,
|
||||||
FILTER_USER_SENZA_PROVINCE: 33554432,
|
FILTER_USER_SENZA_PROVINCE: 33554432,
|
||||||
FILTER_USER_SENZA_CIRCUITO: 67108864,
|
FILTER_USER_SENZA_CIRCUITO: 67108864,
|
||||||
|
FILTER_USER_CON_CIRCUITO: 134217728,
|
||||||
|
FILTER_USER_ONLINE_6_MESI: 268435456,
|
||||||
|
|
||||||
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user