✨ Change update attachment policy to prevent conflict with analyzer
This commit is contained in:
parent
36c814e1dc
commit
8196aac3de
@ -140,10 +140,9 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
|
|||||||
user := c.Locals("user").(models.Account)
|
user := c.Locals("user").(models.Account)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Alternative string `json:"alt"`
|
Alternative string `json:"alt"`
|
||||||
Usage string `json:"usage"`
|
Usage string `json:"usage"`
|
||||||
Metadata map[string]any `json:"metadata"`
|
IsMature bool `json:"is_mature"`
|
||||||
IsMature bool `json:"is_mature"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := exts.BindAndValidate(c, &data); err != nil {
|
if err := exts.BindAndValidate(c, &data); err != nil {
|
||||||
@ -157,7 +156,6 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
attachment.Alternative = data.Alternative
|
attachment.Alternative = data.Alternative
|
||||||
attachment.Usage = data.Usage
|
attachment.Usage = data.Usage
|
||||||
attachment.Metadata = data.Metadata
|
|
||||||
attachment.IsMature = data.IsMature
|
attachment.IsMature = data.IsMature
|
||||||
|
|
||||||
if attachment, err := services.UpdateAttachment(attachment); err != nil {
|
if attachment, err := services.UpdateAttachment(attachment); err != nil {
|
||||||
|
@ -113,7 +113,7 @@ func TryLinkAttachment(tx *gorm.DB, og models.Attachment, hash string) (bool, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UpdateAttachment(item models.Attachment) (models.Attachment, error) {
|
func UpdateAttachment(item models.Attachment) (models.Attachment, error) {
|
||||||
if err := database.C.Save(&item).Error; err != nil {
|
if err := database.C.Updates(&item).Error; err != nil {
|
||||||
return item, err
|
return item, err
|
||||||
} else {
|
} else {
|
||||||
MaintainAttachmentCache()
|
MaintainAttachmentCache()
|
||||||
|
Loading…
Reference in New Issue
Block a user