fix: priority fix for send email
This commit is contained in:
parent
bddb937258
commit
7e73017d3f
|
|
@ -21,7 +21,10 @@ export class AuthService {
|
|||
private _emailService: EmailService
|
||||
) {}
|
||||
async canRegister(provider: string) {
|
||||
if (process.env.DISABLE_REGISTRATION !== 'true' || provider === Provider.GENERIC) {
|
||||
if (
|
||||
process.env.DISABLE_REGISTRATION !== 'true' ||
|
||||
provider === Provider.GENERIC
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +72,8 @@ export class AuthService {
|
|||
await this._emailService.sendEmail(
|
||||
body.email,
|
||||
'Activate your account',
|
||||
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`
|
||||
`Click <a href="${process.env.FRONTEND_URL}/auth/activate/${obj.jwt}">here</a> to activate your account`,
|
||||
'top'
|
||||
);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ export class EmailActivity {
|
|||
}
|
||||
|
||||
@ActivityMethod()
|
||||
async sendEmailAsync(to: string, subject: string, html: string, replyTo?: string) {
|
||||
return await this._emailService.sendEmail(to, subject, html, replyTo);
|
||||
async sendEmailAsync(to: string, subject: string, html: string, sendTo: 'top' | 'bottom', replyTo?: string) {
|
||||
return await this._emailService.sendEmail(to, subject, html, sendTo, replyTo);
|
||||
}
|
||||
|
||||
@ActivityMethod()
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ export type SendEmail = {
|
|||
subject: string;
|
||||
html: string;
|
||||
replyTo?: string;
|
||||
addTo: 'top' | 'bottom';
|
||||
};
|
||||
export const sendEmailSignal = defineSignal<[SendEmail]>('sendEmail');
|
||||
|
|
|
|||
|
|
@ -28,7 +28,11 @@ export async function sendEmailWorkflow({
|
|||
// Handle incoming email signals
|
||||
setHandler(sendEmailSignal, (addEmail: SendEmail) => {
|
||||
if (addEmail.to && addEmail.subject) {
|
||||
queue.push(addEmail);
|
||||
if (addEmail.addTo === 'top') {
|
||||
queue.unshift(addEmail);
|
||||
} else {
|
||||
queue.push(addEmail);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ export class NotificationService {
|
|||
}
|
||||
|
||||
async sendEmail(to: string, subject: string, html: string, replyTo?: string) {
|
||||
await this._emailService.sendEmail(to, subject, html, replyTo);
|
||||
await this._emailService.sendEmail(to, subject, html, 'bottom', replyTo);
|
||||
}
|
||||
|
||||
hasEmailProvider() {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export class EmailService {
|
|||
}
|
||||
}
|
||||
|
||||
async sendEmail(to: string, subject: string, html: string, replyTo?: string) {
|
||||
async sendEmail(to: string, subject: string, html: string, sendTo: 'top' | 'bottom', replyTo?: string) {
|
||||
return this._temporalService.client
|
||||
.getRawClient()
|
||||
?.workflow.signalWithStart('sendEmailWorkflow', {
|
||||
|
|
@ -41,7 +41,7 @@ export class EmailService {
|
|||
workflowId: 'send_email',
|
||||
signal: 'sendEmail',
|
||||
args: [{ queue: [] }],
|
||||
signalArgs: [{ to, subject, html, replyTo }],
|
||||
signalArgs: [{ to, subject, html, replyTo, sendTo }],
|
||||
workflowIdConflictPolicy: 'USE_EXISTING',
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue