Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): album's email notification #9439

Merged
merged 26 commits into from
May 28, 2024

Conversation

alextran1502
Copy link
Contributor

@alextran1502 alextran1502 commented May 13, 2024

This PR adds email notifications for albums when

  • A user is added to a shared album (send email to the newly shared user)
  • A shared album is added with new assets (send an email to all shared users beside the one that is adding assets)

Copy link

cloudflare-pages bot commented May 13, 2024

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: c895362
Status:⚡️  Build in progress...

View logs

server/src/interfaces/job.interface.ts Outdated Show resolved Hide resolved
server/src/interfaces/job.interface.ts Outdated Show resolved Hide resolved
server/src/interfaces/notification.interface.ts Outdated Show resolved Hide resolved
server/src/interfaces/notification.interface.ts Outdated Show resolved Hide resolved
server/src/repositories/notification.repository.ts Outdated Show resolved Hide resolved
server/src/services/album.service.ts Outdated Show resolved Hide resolved
@alextran1502 alextran1502 marked this pull request as ready for review May 16, 2024 17:30
server/src/emails/album-invite.email.tsx Outdated Show resolved Hide resolved
server/src/emails/album-update.email.tsx Outdated Show resolved Hide resolved
server/src/emails/album-update.email.tsx Outdated Show resolved Hide resolved
server/src/interfaces/notification.interface.ts Outdated Show resolved Hide resolved
server/src/repositories/notification.repository.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Show resolved Hide resolved
Comment on lines 161 to 182
const { html, text } = this.notificationRepository.renderEmail({
template: EmailTemplate.ALBUM_UPDATE,
data: {
baseUrl: server.externalDomain || 'http://localhost:2283',
albumId: album.id,
albumName: album.albumName,
recipientName: recipient.name,
cid: attachement ? attachement.cid : undefined,
},
});

await this.jobRepository.queue({
name: JobName.SEND_EMAIL,
data: {
to: recipient.email,
subject: `New media have been added to an album - ${album.albumName}`,
html,
text,
imageAttachements: attachement ? [attachement] : undefined,
},
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably pull this out into a shared sendEmail func

alextran1502 and others added 3 commits May 16, 2024 13:46
Co-authored-by: bo0tzz <git@bo0tzz.me>
Co-authored-by: bo0tzz <git@bo0tzz.me>
Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things to clean up, but looks pretty good otherwise. We should clean up/reuse the email templates in a future PR.

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

server/src/services/notification.service.ts Outdated Show resolved Hide resolved
@alextran1502 alextran1502 self-assigned this May 21, 2024
Copy link
Contributor

@zackpollard zackpollard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one change and sounds like we probably want to wait until we have user preferences implemented before we push this out

server/src/emails/album-update.email.tsx Outdated Show resolved Hide resolved
server/src/services/notification.service.ts Show resolved Hide resolved
Co-authored-by: Zack Pollard <zackpollard@ymail.com>
@alextran1502 alextran1502 enabled auto-merge (squash) May 28, 2024 02:13
@alextran1502 alextran1502 merged commit 1f9158c into main May 28, 2024
23 of 24 checks passed
@alextran1502 alextran1502 deleted the feat/server-album-update-email branch May 28, 2024 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants