Merge pull request #466 from omnivore-app/fix/email-content-report
Email content display report
This commit is contained in:
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import axios from 'axios'
|
||||
|
||||
import {
|
||||
EntitySubscriberInterface,
|
||||
EventSubscriber,
|
||||
@ -9,6 +7,7 @@ import {
|
||||
|
||||
import { ContentDisplayReport } from '../../entity/reports/content_display_report'
|
||||
import { env } from '../../env'
|
||||
import { sendEmail } from '../../utils/sendEmail'
|
||||
|
||||
@EventSubscriber()
|
||||
export class ContentDisplayReportSubscriber
|
||||
@ -25,16 +24,12 @@ export class ContentDisplayReportSubscriber
|
||||
console.log(message)
|
||||
|
||||
if (!env.dev.isLocal) {
|
||||
// If we are in the local environment, just log a message, otherwise send to discord
|
||||
const discordUrl =
|
||||
'https://discord.com/api/webhooks/866028072263745576/DtTCjyQmOi9D0_7nKOFdB4Iucb7ml3lv_zBrEF84sOhwJCxrojZFbiW89s8OELCaPDEo'
|
||||
|
||||
await axios({
|
||||
method: 'post',
|
||||
url: discordUrl,
|
||||
data: {
|
||||
content: message,
|
||||
},
|
||||
// If we are in the local environment, just log a message, otherwise email the report
|
||||
await sendEmail({
|
||||
to: 'feedback@omnivore.app',
|
||||
subject: 'New content display report',
|
||||
text: message,
|
||||
from: 'msgs@omnivore.app',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user