- fix: Invio RIS (non si vedevano i circuiti !)

- se si usava l'username telegram per registrarsi non faceva il controllo delle minuscole.
- bottone "Invia RIS" era scomparso
This commit is contained in:
Surya Paolo
2024-11-03 19:15:35 +01:00
parent f89281e316
commit 73cf977754
10 changed files with 297 additions and 34 deletions

View File

@@ -1812,9 +1812,11 @@ UserSchema.statics.getUserByUsernameTelegram = function (idapp, username_telegra
username_telegram = username_telegram.substring(1);
}
let regexp = new RegExp(`^${username_telegram}$`, 'i');
return User.findOne({
idapp,
'profile.username_telegram': username_telegram,
'profile.username_telegram': { $regex: regexp },
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
});
};
@@ -3925,6 +3927,23 @@ UserSchema.statics.getRealUsernameByUsername = async function (idapp, username)
});
};
UserSchema.statics.getRealUsernameByUsernameTelegram = async function (idapp, username) {
const User = this;
let regexp = new RegExp(`^${username}$`, 'i');
return await User.findOne({
idapp,
'profile.username_telegram':
{ $regex: regexp },
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
}, { username: 1, _id: 1 }).then((rec) => {
return (!!rec) ? rec.username : '';
}).catch((e) => {
console.error('getRealUsernameByUsername', e);
});
};
UserSchema.statics.getRecLangAndIdByUsername = async function (idapp, username) {
const User = this;