aboutsummaryrefslogtreecommitdiff
path: root/controllers/posts.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-07-19 17:06:56 +0530
committerBobby <[email protected]>2025-07-19 17:06:56 +0530
commit3f73b3c66de04a55bc101ffb96070ae19e7bf27a (patch)
tree85ca777a49e3ec533b2fbc3c709ceb6e093c89c0 /controllers/posts.go
parentd31111cf0133b223a8e665e6798b8ae09aa5c8a9 (diff)
downloadimageboard-3f73b3c66de04a55bc101ffb96070ae19e7bf27a.tar.xz
imageboard-3f73b3c66de04a55bc101ffb96070ae19e7bf27a.zip
tag adding feature for images
Diffstat (limited to 'controllers/posts.go')
-rw-r--r--controllers/posts.go21
1 files changed, 3 insertions, 18 deletions
diff --git a/controllers/posts.go b/controllers/posts.go
index 57738b5..da2df95 100644
--- a/controllers/posts.go
+++ b/controllers/posts.go
@@ -4,7 +4,6 @@ import (
"errors"
"imageboard/config"
"imageboard/database"
- "imageboard/models"
"imageboard/utils/auth"
"imageboard/utils/format"
"imageboard/utils/handlers"
@@ -380,22 +379,9 @@ func PostsSinglePostEditPageController(ctx *fiber.Ctx) error {
return InternalServerErrorController(ctx, err)
}
- postTags := make([]map[string]models.Tag, 0, len(post.Tags))
- for _, tag := range post.Tags {
- switch tag.Type {
- case config.TagTypeGeneral:
- postTags = append(postTags, map[string]models.Tag{"general": tag})
- case config.TagTypeArtist:
- postTags = append(postTags, map[string]models.Tag{"artist": tag})
- case config.TagTypeCharacter:
- postTags = append(postTags, map[string]models.Tag{"character": tag})
- case config.TagTypeCopyright:
- postTags = append(postTags, map[string]models.Tag{"copyright": tag})
- case config.TagTypeMeta:
- postTags = append(postTags, map[string]models.Tag{"meta": tag})
- default:
- postTags = append(postTags, map[string]models.Tag{"general": tag})
- }
+ postTags, err := database.GetImageTags(post.ID)
+ if err != nil {
+ return InternalServerErrorController(ctx, err)
}
ctx.Locals("Title", config.PT_POST_EDIT+" #"+format.Int64ToString(int64(post.ID)))
@@ -511,6 +497,5 @@ func PostsSinglePostEditPostController(ctx *fiber.Ctx) error {
if nextURL == "" {
nextURL = "/posts/" + format.Int64ToString(int64(post.ID))
}
-
return ctx.Redirect(nextURL, fiber.StatusSeeOther)
}