🐛 Trying to fix deleting post issue

This commit is contained in:
LittleSheep 2025-02-26 21:09:08 +08:00
parent 94decc6bad
commit 625e86a7fd

View File

@ -4,13 +4,14 @@ import (
"context"
"errors"
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"github.com/gofiber/fiber/v2"
"regexp"
"strconv"
"strings"
"time"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"github.com/gofiber/fiber/v2"
localCache "git.solsynth.dev/hypernet/interactive/pkg/internal/cache"
"git.solsynth.dev/hypernet/interactive/pkg/internal/gap"
"git.solsynth.dev/hypernet/nexus/pkg/proto"
@ -675,7 +676,8 @@ func updatePostAttachmentVisibility(item models.Post) error {
}
func DeletePost(item models.Post) error {
if err := database.C.Delete(&item).Error; err != nil {
copiedItem := item
if err := database.C.Delete(&copiedItem).Error; err != nil {
return err
}