Skip to content

Commit

Permalink
feat: enhance status page URL handling and add unsubscribe link in su…
Browse files Browse the repository at this point in the history
…bscription emails
  • Loading branch information
simlarsen committed Jan 31, 2025
1 parent 3fcd1f6 commit cd130bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Common/Server/Services/StatusPageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ export class Service extends DatabaseService<StatusPage> {
},
});

let statusPageURL: string = domain?.fullDomain || "";
let statusPageURL: string = domain?.fullDomain
? `https://${domain.fullDomain}`
: "";

if (!statusPageURL) {
const host: Hostname = await DatabaseConfig.getHost();
Expand Down
6 changes: 6 additions & 0 deletions Common/Server/Services/StatusPageSubscriberService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ export class Service extends DatabaseService<Model> {
subscriber.subscriberEmail &&
subscriber._id
) {
const unsubscribeUrl: string = this.getUnsubscribeLink(
URL.fromString(statusPageURL),
subscriber.id!,
).toString();

MailService.sendMail(
{
toEmail: subscriber.subscriberEmail,
Expand All @@ -373,6 +378,7 @@ export class Service extends DatabaseService<Model> {
? "true"
: "false",
confirmationUrl: confirmSubscriptionLink,
unsubscribeUrl: unsubscribeUrl,
},
subject: "Confirm your subscription to " + statusPageName,
},
Expand Down

0 comments on commit cd130bc

Please sign in to comment.