Browse Source

fix: include roles in email template

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/9907/head
Pranav C 1 month ago
parent
commit
a0857b469e
  1. 9
      packages/nocodb/src/services/base-users/base-users.service.ts
  2. 3
      packages/nocodb/src/services/org-users.service.ts

9
packages/nocodb/src/services/base-users/base-users.service.ts

@ -181,6 +181,7 @@ export class BaseUsersService {
token: invite_token,
req: param.req,
baseName: base.title,
roles: param.baseUser.roles || 'editor',
});
if (!mailSendStatus) {
@ -192,6 +193,7 @@ export class BaseUsersService {
token: invite_token,
req: param.req,
baseName: base.title,
roles: param.baseUser.roles || 'editor',
});
}
} catch (e) {
@ -400,6 +402,8 @@ export class BaseUsersService {
invite_token_expires: new Date(Date.now() + 24 * 60 * 60 * 1000),
});
const baseUser = await BaseUser.get(context, param.baseId, user.id);
const pluginData = await Noco.ncMeta.metaGet2(
context.workspace_id,
context.base_id,
@ -421,6 +425,7 @@ export class BaseUsersService {
token: invite_token,
req: param.req,
baseName: base.title,
roles: baseUser?.roles || 'editor',
});
this.appHooksService.emit(AppEvents.PROJECT_USER_RESEND_INVITE, {
@ -440,12 +445,14 @@ export class BaseUsersService {
token,
req,
baseName,
roles,
useOrgTemplate,
}: {
email: string;
token: string;
req: NcRequest;
baseName?: string;
roles: string;
useOrgTemplate?: boolean;
}): Promise<any> {
try {
@ -473,7 +480,7 @@ export class BaseUsersService {
}#/signup/${token}`,
baseName: sanitiseEmailContent(baseName || req.body?.baseName),
roles: sanitiseEmailContent(
(req.body?.roles || '')
(roles || req.body?.roles || '')
.split(',')
.map((r) => r.replace(/^./, (m) => m.toUpperCase()))
.join(', '),

3
packages/nocodb/src/services/org-users.service.ts

@ -168,6 +168,7 @@ export class OrgUsersService {
token: invite_token,
useOrgTemplate: true,
req: param.req,
roles: param.user.roles || OrgUserRoles.VIEWER,
}))
)
return { invite_token, email };
@ -177,6 +178,7 @@ export class OrgUsersService {
token: invite_token,
req: param.req,
useOrgTemplate: true,
roles: param.user.roles || OrgUserRoles.VIEWER,
});
}
} catch (e) {
@ -241,6 +243,7 @@ export class OrgUsersService {
token: invite_token,
req: param.req,
useOrgTemplate: true,
roles: user.roles,
});
this.appHooksService.emit(AppEvents.ORG_USER_RESEND_INVITE, {

Loading…
Cancel
Save