aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2022-06-05 11:45:31 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit0359d9d410b9ab597ed4a067d767ab59472b0c03 (patch)
treecbc4afced5ec46039055ff37f04390709f1112dd
parent5e4f829b9c26e40bc3931226d4fa0872c150e43a (diff)
pop archived posts
-rw-r--r--route/routes/boardmgmt.go22
-rw-r--r--views/partials/posts.html2
2 files changed, 21 insertions, 3 deletions
diff --git a/route/routes/boardmgmt.go b/route/routes/boardmgmt.go
index 04c01b5..b1770f3 100644
--- a/route/routes/boardmgmt.go
+++ b/route/routes/boardmgmt.go
@@ -342,9 +342,27 @@ func BoardAddToIndex(ctx *fiber.Ctx) error {
return ctx.SendString("board add to index")
}
-// TODO routes/BoardPopArchive
func BoardPopArchive(ctx *fiber.Ctx) error {
- return ctx.SendString("board pop archive")
+ actor, err := activitypub.GetActorFromDB(config.Domain)
+
+ if err != nil {
+ return util.MakeError(err, "BoardPopArchive")
+ }
+
+ if has := actor.HasValidation(ctx); !has {
+ return ctx.Status(404).Render("404", fiber.Map{})
+ }
+
+ id := ctx.Query("id")
+ board := ctx.Query("board")
+
+ var obj = activitypub.ObjectBase{Id: id}
+
+ if err := obj.SetRepliesType("Note"); err != nil {
+ return util.MakeError(err, "BoardPopArchive")
+ }
+
+ return ctx.Redirect("/"+board+"/archive", http.StatusSeeOther)
}
func BoardAutoSubscribe(ctx *fiber.Ctx) error {
diff --git a/views/partials/posts.html b/views/partials/posts.html
index 14d4878..67f3d27 100644
--- a/views/partials/posts.html
+++ b/views/partials/posts.html
@@ -64,7 +64,7 @@
{{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
[<a href="/delete?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Post</a>]
{{ end }}
- {{ if .Attachment }}
+ {{ if (index .Attachment 0).Id }}
{{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
[<a href="/banmedia?id={{ .Id }}&board={{ $board.Actor.Name }}">Ban Media</a>]
[<a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Attachment</a>]