summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-04-20 17:09:02 +0200
committerMax Magorsch <arzano@gentoo.org>2020-04-20 17:09:02 +0200
commit673e908357a0676b4699cca15336892d791168f4 (patch)
tree1f14560db8334c73dea47626bea8a5e692d0d6fd /pkg
parentcve tool: Don't require a reason for changing the state (diff)
downloadglsamaker-673e908357a0676b4699cca15336892d791168f4.tar.gz
glsamaker-673e908357a0676b4699cca15336892d791168f4.tar.bz2
glsamaker-673e908357a0676b4699cca15336892d791168f4.zip
Correctly sort the comments
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/app/handler/cvetool/index.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/app/handler/cvetool/index.go b/pkg/app/handler/cvetool/index.go
index 76da7b3..3ab9a36 100644
--- a/pkg/app/handler/cvetool/index.go
+++ b/pkg/app/handler/cvetool/index.go
@@ -14,6 +14,7 @@ import (
"glsamaker/pkg/models/users"
"html"
"net/http"
+ "sort"
"strconv"
"strings"
)
@@ -139,6 +140,10 @@ func CveData(w http.ResponseWriter, r *http.Request) {
}
}
+ // sort the comments by creation date
+ sort.Slice(cve.Comments, func(p, q int) bool {
+ return cve.Comments[p].Date.Before(cve.Comments[q].Date) })
+
comments, _ := json.Marshal(cve.Comments)
packages, _ := json.Marshal(cve.Packages)