Skip to content

Commit

Permalink
switch emails to be sent via emitModerationEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Mar 5, 2024
1 parent 1dec8ba commit 12576b1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions components/email/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { compileTemplateContent, getTemplate } from './helpers'
import { useRepoAndProfile } from '@/repositories/useRepoAndProfile'
import { useEmailComposer } from './useComposer'
import { useColorScheme } from '@/common/useColorScheme'
import { MOD_EVENTS } from '@/mod-event/constants'

const MDEditor = dynamic(() => import('@uiw/react-md-editor'), { ssr: false })

Expand Down Expand Up @@ -50,13 +51,16 @@ export const EmailComposer = ({ did }: { did: string }) => {
.toString()

await toast.promise(
client.api.com.atproto.admin.sendEmail(
client.api.com.atproto.admin.emitModerationEvent(
{
content: htmlContent,
recipientDid: did,
subject,
comment,
senderDid: client.session.did,
event: {
$type: MOD_EVENTS.EMAIL,
comment,
subjectLine: subject,
content: htmlContent,
},
subject: { $type: 'com.atproto.admin.defs#repoRef', did },
createdBy: client.session.did,
},
{ headers: client.proxyHeaders(), encoding: 'application/json' },
),
Expand Down

0 comments on commit 12576b1

Please sign in to comment.