diff options
author | FChannel <> | 2021-07-03 19:58:22 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-03 19:58:22 -0700 |
commit | 68f3c361656ae343fd809239452a954424a0bcb2 (patch) | |
tree | dacd87de82acb57f6ac0c447b09ab57db0b23fad | |
parent | 068e6caf8dfa3fb36dd9f74b9070f41f801e9c8d (diff) |
added report reason to admin manage page
-rw-r--r-- | client.go | 5 | ||||
-rw-r--r-- | database.go | 4 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | static/manage.html | 2 |
4 files changed, 8 insertions, 5 deletions
@@ -68,6 +68,7 @@ type AdminPage struct { type Report struct { ID string Count int + Reason string } type Removed struct { @@ -484,7 +485,7 @@ func CreateLocalReportDB(db *sql.DB, id string, board string, reason string) { func GetLocalReportDB(db *sql.DB, board string) []Report { var reported []Report - query := `select id, count from reported where board=$1` + query := `select id, count, reason from reported where board=$1` rows, err := db.Query(query, board) @@ -495,7 +496,7 @@ func GetLocalReportDB(db *sql.DB, board string) []Report { for rows.Next() { var r Report - rows.Scan(&r.ID, &r.Count) + rows.Scan(&r.ID, &r.Count, &r.Reason) reported = append(reported, r) } diff --git a/database.go b/database.go index 954ec0f..5668a4d 100644 --- a/database.go +++ b/database.go @@ -1451,7 +1451,7 @@ func GetActorReportedTotal(db *sql.DB, id string) int { func GetActorReportedDB(db *sql.DB, id string) []ObjectBase { var nObj []ObjectBase - query := `select id, count from reported where board=$1` + query := `select id, count, reason from reported where board=$1` rows, err := db.Query(query, id) @@ -1462,7 +1462,7 @@ func GetActorReportedDB(db *sql.DB, id string) []ObjectBase { for rows.Next() { var obj ObjectBase - rows.Scan(&obj.Id, &obj.Size) + rows.Scan(&obj.Id, &obj.Size, &obj.Content) nObj = append(nObj, obj) } @@ -524,6 +524,7 @@ func main() { var r Report r.Count = int(e.Size) r.ID = e.Id + r.Reason = e.Content reports = append(reports, r) } @@ -533,6 +534,7 @@ func main() { var r Report r.Count = e.Count r.ID = e.ID + r.Reason = e.Reason reports = append(reports, r) } diff --git a/static/manage.html b/static/manage.html index 4fb417f..e161f18 100644 --- a/static/manage.html +++ b/static/manage.html @@ -50,7 +50,7 @@ <ul style="display: inline-block; padding: 0; margin: 0; list-style-type: none;"> {{ $domain := .Domain }} {{ range .Reported }} - <li><a id="rpost" post="{{ .ID }}" href=""></a> - <b>{{ .Count }}</b> <a href="/delete?id={{ .ID }}&board={{ $board.Name }}&manage=t">[Remove Post]</a> <a href="/deleteattach?id={{ .ID }}&board={{ $board.Name }}&manage=t">[Remove Attachment]</a> <a href="/report?id={{ .ID }}&close=1&board={{ $board.Name }}">[Close]</a></li> + <li><a id="rpost" post="{{ .ID }}" href=""></a> - <b>{{ .Count }}</b><span> "{{ .Reason }}" </span> <a href="/delete?id={{ .ID }}&board={{ $board.Name }}&manage=t">[Remove Post]</a> <a href="/deleteattach?id={{ .ID }}&board={{ $board.Name }}&manage=t">[Remove Attachment]</a> <a href="/report?id={{ .ID }}&close=1&board={{ $board.Name }}">[Close]</a></li> {{ end }} </ul> </div> |