Skip to content
Snippets Groups Projects
Unverified Commit 2a88ed53 authored by Matheus Barbosa Silva's avatar Matheus Barbosa Silva Committed by Diego Sampaio
Browse files

fix: Importer crashes when sending the "active status" e-mail notification to users (#29401)

parent b4d4c506
No related branches found
No related tags found
No related merge requests found
---
"@rocket.chat/meteor": patch
---
fix: Importer crashes when sending the "active status" e-mail notification to users
......@@ -66,6 +66,7 @@ export class Base {
this.logger.debug('Found existing import operation');
this.importRecord = this.importRecordParam;
this.progress.step = this.importRecord.status;
this.reloadCount();
} else {
this.logger.debug('Starting new import operation');
const importId = (
......
......@@ -115,9 +115,11 @@ export async function setUserActiveStatus(userId: string, active: boolean, confi
if (!active && !settings.get('Accounts_Send_Email_When_Deactivating')) {
return true;
}
if (!user.emails || !Array.isArray(user.emails) || user.emails.length === 0) {
return true;
}
const destinations =
Array.isArray(user.emails) && user.emails.map((email: IUserEmail) => `${user.name || user.username}<${email.address}>`);
const destinations = user.emails.map((email: IUserEmail) => `${user.name || user.username}<${email.address}>`);
type UserActivated = {
subject: (params: { active: boolean }) => string;
......
......@@ -304,6 +304,10 @@ export class UsersRaw extends BaseRaw {
return this.find(query, options);
}
findOneByImportId(_id, options) {
return this.findOne({ importIds: _id }, options);
}
findOneByUsernameIgnoringCase(username, options) {
if (typeof username === 'string') {
username = new RegExp(`^${escapeRegExp(username)}$`, 'i');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment