Non permettere il cambio del codice del gruppo

disattivare l'abilitazione se la registrazione arriva da me paoloar77
Sistemato il Menu del BOT per inviare msg a tutti e per ricevere il proprio Link personale.
Non permettere il cambio del codice del gruppo
Aggiunta la Provincia tra parentesi nei Comuni: es Rimini (RN)
This commit is contained in:
paoloar77
2022-02-26 17:35:50 +01:00
parent 574d192661
commit 2749506de7
7 changed files with 241 additions and 119 deletions

View File

@@ -145,6 +145,9 @@ const UserSchema = new mongoose.Schema({
verified_by_aportador: {
type: Boolean,
},
notask_verif: {
type: Boolean,
},
trust_modified: {
type: Date,
},
@@ -880,6 +883,24 @@ UserSchema.statics.setVerifiedByAportador = async function(
return !!myrec;
};
UserSchema.statics.setnotask_verif = async function(
idapp, username, valuebool) {
const User = this;
if (username === undefined)
return false;
const myquery = {
'idapp': idapp,
'username': username,
};
const myrec = await User.findOneAndUpdate(myquery,
{$set: {'notask_verif': valuebool}}, {new: false});
return !!myrec;
};
UserSchema.statics.setVerifiedByAportadorToALL = async function() {
return User.updateMany({}, {$set: {'verified_by_aportador': true}},
@@ -1247,6 +1268,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
sospeso: 1,
verified_email: 1,
verified_by_aportador: 1,
notask_verif: 1,
'profile.nationality': 1,
'profile.qualifica': 1,
'profile.biografia': 1,
@@ -1641,6 +1663,7 @@ function getWhatToShow(idapp, username) {
sospeso: 1,
verified_email: 1,
verified_by_aportador: 1,
notask_verif: 1,
'profile.nationality': 1,
'profile.qualifica': 1,
'profile.biografia': 1,
@@ -1857,6 +1880,18 @@ UserSchema.statics.TelegIdByUsername = async function(idapp, username) {
console.error('TelegIdByUsername', e);
});
};
UserSchema.statics.notAsk_VerifByUsername = async function(idapp, username) {
return User.findOne({
idapp, username,
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
}, {'notask_verif': 1}).then((rec) => {
return (!!rec && rec.notask_verif) ? true: false;
}).catch((e) => {
console.error('notAsk_VerifByUsername', e);
return false;
});
};
UserSchema.statics.SetTelegramCheckCode = async function(
idapp, id, teleg_checkcode) {
@@ -2124,7 +2159,7 @@ UserSchema.statics.getusersManagers = async function(idapp) {
const User = this;
return User.find({idapp, 'profile.manage_telegram': true},
{'profile.teleg_id': 1, perm: 1}).then((arrrec) => {
{username: 1, 'profile.teleg_id': 1, perm: 1}).then((arrrec) => {
return (!!arrrec) ? arrrec : null;
}).catch((e) => {
console.error('getusersManagers', e);
@@ -2619,6 +2654,7 @@ UserSchema.statics.checkUser = async function(idapp, username) {
return User.findOne({idapp, username}, {
verified_email: 1,
verified_by_aportador: 1,
notask_verif: 1,
'profile.teleg_id': 1,
'profile.teleg_checkcode': 1,
}).then((rec) => {