This commit is contained in:
Matej Bačo
2024-01-17 17:35:25 +01:00
parent e79d626d27
commit 6dfd7c4ff8
3 changed files with 70 additions and 69 deletions
+1 -1
View File
@@ -289,5 +289,5 @@ export enum Submit {
SmsResetTemplate = 'submit_sms_reset_template',
SmsUpdateInviteTemplate = 'submit_sms_update_invite_template',
SmsUpdateLoginTemplate = 'submit_sms_update_login_template',
SmsUpdateVerificationTemplate = 'submit_sms_update_verification_template',
SmsUpdateVerificationTemplate = 'submit_sms_update_verification_template'
}
@@ -202,28 +202,31 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<div class="u-flex u-main-end u-gap-16">
<Button text on:click={() => showTestSMTPModal = true}>
Send test email
</Button>
<Button text on:click={() => (showTestSMTPModal = true)}>
Send test email
</Button>
<Button
submit
disabled={isButtonDisabled ||
$organization.billingPlan === BillingPlan.STARTER}>
Update
</Button>
</div>
<Button
submit
disabled={isButtonDisabled ||
$organization.billingPlan === BillingPlan.STARTER}>
Update
</Button>
</div>
</svelte:fragment>
</CardGrid>
</Form>
</Container>
{#if showTestSMTPModal}
<SmtpTestModal
{senderName} {senderEmail} {replyTo} {host} {port} {username} {password} {secure}
bind:showModal={showTestSMTPModal}
/>
<SmtpTestModal
{senderName}
{senderEmail}
{replyTo}
{host}
{port}
{username}
{password}
{secure}
bind:showModal={showTestSMTPModal} />
{/if}
@@ -31,8 +31,8 @@
async function handleTestEmail() {
try {
const allMails = [ ...emails ];
if(sendToSelf) {
const allMails = [...emails];
if (sendToSelf) {
allMails.push($user.email);
}
@@ -44,70 +44,68 @@
host ? host : undefined,
replyTo ? replyTo : undefined,
port ? port : undefined,
username ? username : undefined,
username ? username : undefined,
password ? password : undefined,
secure ? 'tls' : undefined
)
close();
if(allMails.length === 1) {
addNotification({
type: 'success',
message: `Test email has been sent to ${allMails[0]}`
});
} else {
addNotification({
type: 'success',
message: `Test email has been sent to ${allMails[0]} and ${allMails.length - 1} others`
});
}
);
close();
if (allMails.length === 1) {
addNotification({
type: 'success',
message: `Test email has been sent to ${allMails[0]}`
});
} else {
addNotification({
type: 'success',
message: `Test email has been sent to ${allMails[0]} and ${
allMails.length - 1
} others`
});
}
trackEvent(Submit.ProjectTestSMTP);
} catch (e) {
error = e.message;
trackError(e, Submit.ProjectTestSMTP);
}
}
</script>
<Modal bind:error bind:show={showModal} onSubmit={handleTestEmail}>
<svelte:fragment slot="title">
Send test email
</svelte:fragment>
<svelte:fragment slot="title">Send test email</svelte:fragment>
<div class="u-margin-block-start-16">
<FormList gap={24}>
<div class="u-flex u-cross-center u-gap-8">
<InputCheckbox
id="send-to-self"
checked={sendToSelf}
on:click={() => sendToSelf = !sendToSelf} />
<p class="text u-bold">{$user.email}</p>
</div>
<div class="u-flex u-cross-start u-gap-8">
<InputCheckbox
id="send-to-others"
wrapperTag="div"
checked={sendToOthers}
on:click={() => sendToOthers = !sendToOthers} />
<div>
<p class="text u-bold">Others</p>
<p class="text u-margin-block-start-8">Enter the email address(es) to which the test message will be sent</p>
<div class="u-margin-block-start-8" style="border: solid 0.0625rem hsl(var(--color-border)); border-radius: var(--border-radius-small);">
<InputTags
disabled={!sendToOthers}
id="others-emails"
label="Email address(es)"
showLabel={false}
placeholder="Enter email address(es)"
bind:tags={emails} />
</div>
<InputCheckbox
id="send-to-self"
checked={sendToSelf}
on:click={() => (sendToSelf = !sendToSelf)} />
<p class="text u-bold">{$user.email}</p>
</div>
<div class="u-flex u-cross-start u-gap-8">
<InputCheckbox
id="send-to-others"
wrapperTag="div"
checked={sendToOthers}
on:click={() => (sendToOthers = !sendToOthers)} />
<div>
<p class="text u-bold">Others</p>
<p class="text u-margin-block-start-8">
Enter the email address(es) to which the test message will be sent
</p>
<div
class="u-margin-block-start-8"
style="border: solid 0.0625rem hsl(var(--color-border)); border-radius: var(--border-radius-small);">
<InputTags
disabled={!sendToOthers}
id="others-emails"
label="Email address(es)"
showLabel={false}
placeholder="Enter email address(es)"
bind:tags={emails} />
</div>
</div>
</div>
</FormList>
</div>