-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send email notifications for approved project request and getting add…
…ed to project (#889) * create project approval email service * add translation to email * fixed translation embedding * implemented project approval email * Introduce IEmailService so EmailService is mockable * added button in ApproveProjectRequest email (still needs url) * create email template for user added to project * send email in ProjectService.cs & mock EmailService * attach url to view project button * refactor approval email code * implement sending email to users when added to project * update recipient locale * Link new project member emails to home page with filter so permissions get updated * Standardize translations. --------- Co-authored-by: Tim Haasdyk <tim_haasdyk@sil.org>
- Loading branch information
Showing
18 changed files
with
159 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using LexBoxApi.Models.Project; | ||
using LexCore.Auth; | ||
using LexCore.Entities; | ||
using MimeKit; | ||
|
||
namespace LexBoxApi.Services.Email; | ||
|
||
public interface IEmailService | ||
{ | ||
public Task SendForgotPasswordEmail(string emailAddress); | ||
|
||
public Task SendNewAdminEmail(IAsyncEnumerable<User> admins, string newAdminName, string newAdminEmail); | ||
|
||
/// <summary> | ||
/// Sends a verification email to the user for their email address. | ||
/// </summary> | ||
/// <param name="user">The user to verify the email address for.</param> | ||
/// <param name="newEmail"> | ||
/// If the user is trying to change their address, this is the new email address. | ||
/// If null, the verification email will be sent to the current email address of the user. | ||
/// </param> | ||
public Task SendVerifyAddressEmail(User user, string? newEmail = null); | ||
|
||
/// <summary> | ||
/// Sends a project invitation email to a new user, whose account will be created when they accept. | ||
/// </summary> | ||
/// <param name="name">The name (real name, NOT username) of user to invite.</param> | ||
/// <param name="emailAddress">The email address to send the invitation to</param> | ||
/// <param name="projectId">The GUID of the project the user is being invited to</param> | ||
/// <param name="language">The language in which the invitation email should be sent (default English)</param> | ||
public Task SendCreateAccountEmail(string emailAddress, | ||
Guid projectId, | ||
ProjectRole role, | ||
string managerName, | ||
string projectName, | ||
string? language = null); | ||
|
||
public Task SendPasswordChangedEmail(User user); | ||
|
||
public Task SendCreateProjectRequestEmail(LexAuthUser user, CreateProjectInput projectInput); | ||
public Task SendApproveProjectRequestEmail(User user, CreateProjectInput projectInput); | ||
public Task SendUserAddedEmail(User user, string projectName, string projectCode); | ||
public Task SendEmailAsync(MimeMessage message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script lang="ts"> | ||
import Email from '$lib/email/Email.svelte'; | ||
import type { CreateProjectInput } from '$lib/gql/types'; | ||
import t from '$lib/i18n'; | ||
export let name: string; | ||
export let baseUrl: string; | ||
export let project: CreateProjectInput; | ||
let projectUrl = new URL(`/?projectSearch=${encodeURIComponent(project.code)}`, baseUrl); | ||
let projectName = project.name; | ||
</script> | ||
|
||
<Email subject={$t('emails.approve_project_request_email.subject', {projectName})} {name}> | ||
<mj-text>{$t('emails.approve_project_request_email.heading', {projectName})}</mj-text> | ||
<mj-button href={projectUrl}>{$t('emails.approve_project_request_email.view_button')}</mj-button> | ||
</Email> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
import Email from '$lib/email/Email.svelte'; | ||
import t from '$lib/i18n'; | ||
export let name: string; | ||
export let baseUrl: string; | ||
export let projectName: string; | ||
export let projectCode: string; | ||
let projectUrl = new URL(`/?projectSearch=${encodeURIComponent(projectCode)}`, baseUrl); | ||
</script> | ||
|
||
<Email subject={$t('emails.user_added.subject', {projectName})} {name}> | ||
<mj-text>{$t('emails.user_added.body', {projectName})}</mj-text> | ||
<mj-button href={projectUrl}>{$t('emails.user_added.view_button')}</mj-button> | ||
</Email> |
Oops, something went wrong.