mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
improve attachments controls
This commit is contained in:
parent
07b3913c58
commit
bebebe6508
@ -16,16 +16,18 @@ export default async (payload = {}) => {
|
|||||||
throw new OperationError(400, "Cannot create a post without message or attachments")
|
throw new OperationError(400, "Cannot create a post without message or attachments")
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix attachments with url strings
|
if (isAttachmentArray) {
|
||||||
attachments = attachments.map((attachment) => {
|
// fix attachments with url strings if needed
|
||||||
if (typeof attachment === "string") {
|
attachments = attachments.map((attachment) => {
|
||||||
attachment = {
|
if (typeof attachment === "string") {
|
||||||
url: attachment,
|
attachment = {
|
||||||
|
url: attachment,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return attachment
|
return attachment
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (!timestamp) {
|
if (!timestamp) {
|
||||||
timestamp = DateTime.local().toISO()
|
timestamp = DateTime.local().toISO()
|
||||||
|
@ -77,7 +77,9 @@ export default async (payload = {}) => {
|
|||||||
|
|
||||||
const replyUserData = await User.findById(post.reply_to_data.user_id)
|
const replyUserData = await User.findById(post.reply_to_data.user_id)
|
||||||
|
|
||||||
post.reply_to_data.user = replyUserData.toObject()
|
if (replyUserData) {
|
||||||
|
post.reply_to_data.user = replyUserData.toObject()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user