From 59692b715578cf02b8f01eda4692858ad922670e Mon Sep 17 00:00:00 2001 From: r Date: Sun, 27 Sep 2020 09:50:04 +0000 Subject: Add blocks list --- service/service.go | 12 ++++++++++++ templates/user.tmpl | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/service/service.go b/service/service.go index f268e30..0b23d47 100644 --- a/service/service.go +++ b/service/service.go @@ -529,6 +529,18 @@ func (svc *service) ServeUserPage(c *model.Client, id string, pageType string, nextLink = fmt.Sprintf("/user/%s/mutes?max_id=%s", id, pg.MaxID) } + case "blocks": + if !isCurrent { + return errInvalidArgument + } + users, err = c.GetBlocks(ctx, &pg) + if err != nil { + return + } + if len(users) == 20 && len(pg.MaxID) > 0 { + nextLink = fmt.Sprintf("/user/%s/blocks?max_id=%s", + id, pg.MaxID) + } default: return errInvalidArgument } diff --git a/templates/user.tmpl b/templates/user.tmpl index ce91091..d260848 100644 --- a/templates/user.tmpl +++ b/templates/user.tmpl @@ -100,7 +100,8 @@ {{if .IsCurrent}}
bookmarks - - mutes + mutes - + blocks
{{end}}
@@ -148,6 +149,10 @@ {{else if eq .Type "mutes"}}
Mutes
{{template "userlist.tmpl" (WithContext .Users $.Ctx)}} + +{{else if eq .Type "blocks"}} +
Blocks
+{{template "userlist.tmpl" (WithContext .Users $.Ctx)}} {{end}}