Skip to content

Commit

Permalink
fix: remove duplicate tag (#450)
Browse files Browse the repository at this point in the history
fix: remove dumplicate tag
  • Loading branch information
boojack committed Nov 12, 2022
1 parent fe05e6a commit 2e8dc73
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ func (s *Server) registerTagRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find memo list").SetInternal(err)
}

tagList := []string{}
tagMapSet := make(map[string]bool)
for _, memo := range memoList {
tagList = append(tagList, findTagListFromMemoContent(memo.Content)...)
for _, tag := range findTagListFromMemoContent(memo.Content) {
tagMapSet[tag] = true
}
}
tagList := []string{}
for tag := range tagMapSet {
tagList = append(tagList, tag)
}
sort.Strings(tagList)

Expand Down

0 comments on commit 2e8dc73

Please sign in to comment.