mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +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")
|
||||
}
|
||||
|
||||
// fix attachments with url strings
|
||||
attachments = attachments.map((attachment) => {
|
||||
if (typeof attachment === "string") {
|
||||
attachment = {
|
||||
url: attachment,
|
||||
if (isAttachmentArray) {
|
||||
// fix attachments with url strings if needed
|
||||
attachments = attachments.map((attachment) => {
|
||||
if (typeof attachment === "string") {
|
||||
attachment = {
|
||||
url: attachment,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return attachment
|
||||
})
|
||||
return attachment
|
||||
})
|
||||
}
|
||||
|
||||
if (!timestamp) {
|
||||
timestamp = DateTime.local().toISO()
|
||||
|
@ -77,7 +77,9 @@ export default async (payload = {}) => {
|
||||
|
||||
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