You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-11 23:17:19 +02:00
Server: Moved email templates to separate files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { EmailSender, Subscription, Uuid } from '../db';
|
||||
import { ErrorNotFound } from '../utils/errors';
|
||||
import uuidgen from '../utils/uuidgen';
|
||||
import paymentFailedTemplate from '../views/emails/paymentFailedTemplate';
|
||||
import BaseModel from './BaseModel';
|
||||
import { AccountType } from './UserModel';
|
||||
|
||||
@@ -27,12 +28,13 @@ export default class SubscriptionModel extends BaseModel<Subscription> {
|
||||
} else {
|
||||
toSave.last_payment_failed_time = now;
|
||||
|
||||
const user = await this.models().user().load(sub.user_id, { fields: ['email'] });
|
||||
const user = await this.models().user().load(sub.user_id, { fields: ['email', 'id', 'full_name'] });
|
||||
|
||||
await this.models().email().push({
|
||||
subject: `${this.appName} subscription payment failed`,
|
||||
body: `Hello,\n\nWe were not able to process your last payment. Please follow this URL to update your payment details: \n\n[Manage your subscription](${this.baseUrl}/portal)\n\nPlease answer this email if you have any question.\n\nThank you,\n\nJoplin Cloud Team`,
|
||||
...paymentFailedTemplate(),
|
||||
recipient_email: user.email,
|
||||
recipient_id: user.id,
|
||||
recipient_name: user.full_name || '',
|
||||
sender_id: EmailSender.Support,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user