diff --git a/pkg/app/post_routes.go b/pkg/app/post_routes.go
index 2315544..1fc7377 100644
--- a/pkg/app/post_routes.go
+++ b/pkg/app/post_routes.go
@@ -70,7 +70,7 @@ func postGet(c *gin.Context) {
ImagePath: "/data/" + post.Blob.FilePath,
})
}
- tagObjs := services.GetTagFilter(tagStrings)
+ tagObjs := services.GetTagFilterString(tagStrings)
c.JSON(http.StatusOK, models.PostPaginationResponse{
CurrentPage: page,
@@ -90,17 +90,15 @@ func postGetOne(c *gin.Context) {
Message: err.Error(),
})
}
- var tagStrings []string
- for _, tag := range post.Tags {
- tagStrings = append(tagStrings, tag.TagType.Name+":"+tag.Name)
- }
+
+ tagObjs := services.GetTagFilter(post.Tags)
c.JSON(http.StatusOK, models.PostReadModel{
ID: post.ID,
ImagePreviewPath: "/data/" + post.Blob.PreviewFilePath,
ImagePath: "/data/" + post.Blob.FilePath,
SourceURL: post.SourceURL,
- Tags: tagStrings,
+ Tags: tagObjs,
Width: post.Blob.Width,
Height: post.Blob.Height,
Uploader: post.User.Username,
diff --git a/pkg/models/read.go b/pkg/models/read.go
index f5f7f5d..e5d8c73 100644
--- a/pkg/models/read.go
+++ b/pkg/models/read.go
@@ -1,12 +1,12 @@
package models
type PostReadModel struct {
- ID string `json:"id"`
- ImagePreviewPath string `json:"preview_path"`
- ImagePath string `json:"image_path"`
- SourceURL string `json:"source_url"`
- Tags []string `json:"tags"`
- Width int `json:"width"`
- Height int `json:"height"`
- Uploader string `json:"uploader"`
+ ID string `json:"id"`
+ ImagePreviewPath string `json:"preview_path"`
+ ImagePath string `json:"image_path"`
+ SourceURL string `json:"source_url"`
+ Tags []TagListItem `json:"tags"`
+ Width int `json:"width"`
+ Height int `json:"height"`
+ Uploader string `json:"uploader"`
}
diff --git a/pkg/services/tag.go b/pkg/services/tag.go
index 9f5fff2..cb19cb9 100644
--- a/pkg/services/tag.go
+++ b/pkg/services/tag.go
@@ -21,8 +21,12 @@ func GetTagAll() []models.TagListItem {
return tags
}
-func GetTagFilter(tagString []string) []models.TagListItem {
+func GetTagFilterString(tagString []string) []models.TagListItem {
tagObjs, _ := ParseReadTags(tagString)
+ return GetTagFilter(tagObjs)
+}
+
+func GetTagFilter(tagObjs []database.Tag) []models.TagListItem {
var tagIds []string
for _, val := range tagObjs {
tagIds = append(tagIds, val.ID)
@@ -38,7 +42,6 @@ func GetTagFilter(tagString []string) []models.TagListItem {
Find(&tags, tagIds)
return tags
}
-
func GetTagAutocomplete() []string {
var tags []string
result := database.DB.Model(&database.Tag{}).
diff --git a/web/app/src/TagLink.svelte b/web/app/src/TagLink.svelte
deleted file mode 100644
index 87e0fc3..0000000
--- a/web/app/src/TagLink.svelte
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-{tagDisplay}
diff --git a/web/app/src/ViewPostPanel.svelte b/web/app/src/ViewPostPanel.svelte
index 49e2abc..6a72c24 100644
--- a/web/app/src/ViewPostPanel.svelte
+++ b/web/app/src/ViewPostPanel.svelte
@@ -1,6 +1,6 @@