check nsfw content in the background

This commit is contained in:
srgooglo 2022-10-16 20:48:20 +02:00
parent fe4198d884
commit 8db0175378

View File

@ -1,6 +1,8 @@
import { Post } from "../../../models"
import getPostData from "./getPostData"
import momentTimezone from "moment-timezone"
import { Post } from "../../../models"
import getPostData from "./getPostData"
import flagNsfwByAttachments from "./flagNsfwByAttachments"
export default async (payload) => {
let { user_id, message, attachments, type, data, timestamp } = payload
@ -27,6 +29,7 @@ export default async (payload) => {
attachments: attachments ?? [],
timestamp: timestamp,
data: data,
flags: [],
})
await post.save()
@ -36,5 +39,8 @@ export default async (payload) => {
global.wsInterface.io.emit(`post.new`, resultPost)
global.wsInterface.io.emit(`post.new.${post.user_id}`, resultPost)
// push to background job to check if is NSFW
flagNsfwByAttachments(post._id.toString())
return post
}