From 0359d9d410b9ab597ed4a067d767ab59472b0c03 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sun, 5 Jun 2022 11:45:31 -0700 Subject: pop archived posts --- route/routes/boardmgmt.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'route/routes') 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 { -- cgit v1.2.3