mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
[CORL-943] Send test emails (#2882)
* add smtp test email * disable button if email not enabled * add error handling * internationalize strings * sort imports
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
regenerateSSOKey,
|
||||
rotateSSOKey,
|
||||
rotateWebhookEndpointSecret,
|
||||
sendSMTPTest,
|
||||
update,
|
||||
updateWebhookEndpoint,
|
||||
} from "coral-server/services/tenant";
|
||||
@@ -42,6 +43,8 @@ export const Settings = ({
|
||||
tenant,
|
||||
config,
|
||||
now,
|
||||
mailerQueue,
|
||||
user,
|
||||
}: GraphContext) => ({
|
||||
update: (
|
||||
input: WithoutMutationID<GQLUpdateSettingsInput>
|
||||
@@ -101,4 +104,5 @@ export const Settings = ({
|
||||
input.inactiveIn,
|
||||
now
|
||||
),
|
||||
testSMTP: () => sendSMTPTest(tenant, user!, mailerQueue),
|
||||
});
|
||||
|
||||
@@ -326,4 +326,10 @@ export const Mutation: Required<GQLMutationTypeResolver<void>> = {
|
||||
endpoint: await ctx.mutators.Settings.rotateWebhookEndpointSecret(input),
|
||||
clientMutationId,
|
||||
}),
|
||||
testSMTP: async (source, { input: { clientMutationId } }, ctx) => {
|
||||
await ctx.mutators.Settings.testSMTP();
|
||||
return {
|
||||
clientMutationId,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -6244,6 +6244,14 @@ type UpdateSitePayload {
|
||||
site: Site!
|
||||
}
|
||||
|
||||
input TestSMTPInput {
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
type TestSMTPPayload {
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
##################
|
||||
## Mutation
|
||||
##################
|
||||
@@ -6713,6 +6721,12 @@ type Mutation {
|
||||
"""
|
||||
removeStoryExpert(input: RemoveStoryExpertInput!): RemoveStoryExpertPayload!
|
||||
@auth(roles: [ADMIN, MODERATOR])
|
||||
|
||||
"""
|
||||
testSMTP sends a test email.
|
||||
"""
|
||||
testSMTP(input: TestSMTPInput!): TestSMTPPayload!
|
||||
@auth(roles: [ADMIN, MODERATOR])
|
||||
}
|
||||
|
||||
##################
|
||||
|
||||
Reference in New Issue
Block a user