From 62d09717bbee6357cd068acb98ed7beeddd5d678 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 8 Jan 2025 22:30:51 +0800 Subject: [PATCH] :bug: Trying fix cannot edit tags & categories after published --- pkg/internal/services/posts.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index a232041..15937ac 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -479,6 +479,9 @@ func EditPost(item models.Post) (models.Post, error) { return item, err } + database.C.Model(&item).Association("Categories").Replace(item.Categories) + database.C.Model(&item).Association("Tags").Replace(item.Tags) + err = database.C.Save(&item).Error return item, err