Riso: Ris Italia, altre modifiche grafiche
Lista Utenti da Verificare
This commit is contained in:
@@ -1011,7 +1011,6 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
|
||||
arrcircuits.push(await City.getCircuitNameBystrProv(prov));
|
||||
}
|
||||
|
||||
|
||||
if (myrecnotifpass.tablerec === shared_consts.TABLES_MYGOODS) {
|
||||
idSector = myrectableorig.idSectorGood;
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,7 @@ const validator = require('validator');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const _ = require('lodash');
|
||||
|
||||
const printf = require('util').format;
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { Settings } = require('../models/settings');
|
||||
@@ -2057,10 +2058,20 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
||||
req = tools.getReqByPar(idapp, usernameOrig);
|
||||
}
|
||||
|
||||
let userDest = null;
|
||||
if (usernameDest)
|
||||
userDest = await User.getUserShortDataByUsername(idapp, usernameDest);
|
||||
|
||||
const username_action = req.user.username;
|
||||
let username_worked = usernameDest;
|
||||
|
||||
let ris = null;
|
||||
let lang = '';
|
||||
let user = null;
|
||||
if (usernameOrig) {
|
||||
user = await User.getUserShortDataByUsername(idapp, usernameOrig);
|
||||
}
|
||||
lang = user ? user.lang : '';
|
||||
let update = {};
|
||||
try {
|
||||
if (cmd === shared_consts.FRIENDSCMD.SETTRUST) {
|
||||
@@ -2069,10 +2080,23 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
|
||||
await this.setFriendsCmd(req, idapp, usernameOrig, usernameDest,
|
||||
shared_consts.FRIENDSCMD.SETFRIEND, value);
|
||||
|
||||
return await User.updateOne({ idapp, username: usernameDest },
|
||||
const ris = await User.updateOne({ idapp, username: usernameDest },
|
||||
{ $set: { verified_by_aportador: value, trust_modified: new Date() } },
|
||||
{ new: false });
|
||||
|
||||
const msgOrig = i18n.__({ phrase: '✅ %s è stato Abilitato correttamente (da %s)!', locale: userDest.lang }, userDest.username, usernameOrig);
|
||||
const msgDest = i18n.__({ phrase: '✅ Sei stato Abilitato correttamente da %s!', locale: lang }, usernameOrig);
|
||||
|
||||
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgOrig);
|
||||
await telegrambot.sendMsgTelegram(idapp, userDest.username, msgDest);
|
||||
|
||||
// Invia questo msg anche all'Admin
|
||||
await telegrambot.sendMsgTelegramToTheAdmin(idapp, msgDest, true);
|
||||
|
||||
// telegrambot.askConfirmationUser(user.idapp, shared_consts.CallFunz.REGISTRATION, user, '', '', '', '');
|
||||
|
||||
return ris;
|
||||
|
||||
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
|
||||
// Aggiungo l'Amicizia a me
|
||||
const foundIfAlreadyFriend = await User.findOne({
|
||||
@@ -2378,7 +2402,7 @@ UserSchema.statics.sendCmd = async function (req, idapp, usernameOrig, usernameD
|
||||
let title = tools.getNomeAppByIdApp(idapp);
|
||||
let keyb = null;
|
||||
let descr = '';
|
||||
|
||||
|
||||
let send_notif = false;
|
||||
let send_msgTelegramBot = false;
|
||||
let actions = [];
|
||||
@@ -2395,7 +2419,7 @@ UserSchema.statics.sendCmd = async function (req, idapp, usernameOrig, usernameD
|
||||
openUrl = '/circuit/ris_italia';
|
||||
bottone = i18n.__({ phrase: 'CIRCUIT_OPEN_RISITALIA', locale: langdest });
|
||||
tag = 'risitalia';
|
||||
|
||||
|
||||
send_notif = true;
|
||||
send_msgTelegramBot = true;
|
||||
|
||||
@@ -2418,15 +2442,15 @@ UserSchema.statics.sendCmd = async function (req, idapp, usernameOrig, usernameD
|
||||
}
|
||||
|
||||
// Invia Msg
|
||||
if (send_msgTelegramBot && msgtelegram) {
|
||||
if (send_msgTelegramBot && msgtelegram) {
|
||||
await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, msgtelegram, undefined, undefined, true, keyb);
|
||||
}
|
||||
|
||||
const userprofile = await User.getInfoFriendByUsername(idapp, usernameDest);
|
||||
const myuser = await User.getInfoFriendByUsername(idapp, usernameOrig);
|
||||
|
||||
|
||||
ris = { userprofile, myuser, popupOnApp, result: true };
|
||||
|
||||
|
||||
} catch (e) {
|
||||
popupOnApp = e;
|
||||
ris = { popupOnApp };
|
||||
@@ -3125,6 +3149,20 @@ UserSchema.statics.getAskedFriendsByUsername = async function (idapp, username)
|
||||
};
|
||||
|
||||
|
||||
UserSchema.statics.getUsersToVerify = async function (idapp, username) {
|
||||
|
||||
const whatToShow_Unknown = getWhatToShow(idapp, username);
|
||||
let usersToVerify = await User.find({
|
||||
idapp, aportador_solidario: username,
|
||||
verified_by_aportador: { $exists: false },
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).lean();
|
||||
|
||||
return usersToVerify;
|
||||
};
|
||||
|
||||
UserSchema.statics.getFriendsByUsername = async function (idapp, username) {
|
||||
|
||||
if (!username) {
|
||||
@@ -4076,7 +4114,7 @@ UserSchema.statics.getUsersDreams = async function (idapp) {
|
||||
UserSchema.statics.getLastUsers = async function (idapp) {
|
||||
const User = this;
|
||||
|
||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_USERS', 10);
|
||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_USERS', 20);
|
||||
|
||||
return await User.find(
|
||||
{
|
||||
@@ -4090,6 +4128,7 @@ UserSchema.statics.getLastUsers = async function (idapp) {
|
||||
name: 1,
|
||||
surname: 1,
|
||||
lasttimeonline: 1,
|
||||
verified_by_aportador: 1,
|
||||
'profile.img': 1,
|
||||
date_reg: 1,
|
||||
index: 1,
|
||||
@@ -5024,6 +5063,8 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
|
||||
|
||||
recUser.profile.reaction = await Reaction.find({ idapp, username: recUser.username }).lean();
|
||||
|
||||
recUser.profile.userstoverify = await User.getUsersToVerify(idapp, recUser.username);
|
||||
|
||||
recUser.profile.manage_mygroups = listManageGroups
|
||||
? listManageGroups
|
||||
: [];
|
||||
|
||||
Reference in New Issue
Block a user