Unverified Commit bf07ab9e authored by boojack's avatar boojack Committed by GitHub

fix: remove duplicate tag (#450)

fix: remove dumplicate tag
parent fe05e6a4
...@@ -47,9 +47,15 @@ func (s *Server) registerTagRoutes(g *echo.Group) { ...@@ -47,9 +47,15 @@ func (s *Server) registerTagRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find memo list").SetInternal(err) return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find memo list").SetInternal(err)
} }
tagList := []string{} tagMapSet := make(map[string]bool)
for _, memo := range memoList { 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) sort.Strings(tagList)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment