diff options
author | FChannel <> | 2022-06-13 17:58:26 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 5cff4d3740eb8b9f67de9713124e84109d04cff8 (patch) | |
tree | 8940203f84ef45e36d3cea414c40ace47152a8ce /db/report.go | |
parent | cc3e8e57154409469267b0526807a907d5166147 (diff) |
admin reported management improvements
Diffstat (limited to 'db/report.go')
-rw-r--r-- | db/report.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/report.go b/db/report.go index f5569fd..52e303a 100644 --- a/db/report.go +++ b/db/report.go @@ -1,6 +1,7 @@ package db import ( + "github.com/FChannel0/FChannel-Server/activitypub" "github.com/FChannel0/FChannel-Server/config" "github.com/FChannel0/FChannel-Server/util" ) @@ -8,6 +9,9 @@ import ( type Reports struct { ID string Count int + Actor activitypub.Actor + Object activitypub.ObjectBase + OP string Reason []string } @@ -102,12 +106,27 @@ func GetLocalReport(board string) (map[string]Reports, error) { continue } + var obj = activitypub.ObjectBase{Id: r.ID} + + col, _ := obj.GetCollectionFromPath() + + OP, _ := obj.GetOP() + reported[r.ID] = Reports{ ID: r.ID, Count: 1, + Object: col.OrderedItems[0], + OP: OP, + Actor: activitypub.Actor{Name: board, Outbox: config.Domain + "/" + board + "/outbox"}, Reason: []string{r.Reason}, } } return reported, nil } + +type ReportsSortDesc []Reports + +func (a ReportsSortDesc) Len() int { return len(a) } +func (a ReportsSortDesc) Less(i, j int) bool { return a[i].Object.Updated.After(a[j].Object.Updated) } +func (a ReportsSortDesc) Swap(i, j int) { a[i], a[j] = a[j], a[i] } |