From 4d68062f2d0525a9d2a40e50d60ea9b25daae9ad Mon Sep 17 00:00:00 2001 From: r Date: Fri, 29 Oct 2021 14:20:15 +0000 Subject: Add "mute (keep notifications)" button --- service/service.go | 4 ++-- service/transport.go | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'service') diff --git a/service/service.go b/service/service.go index 244fd81..7122666 100644 --- a/service/service.go +++ b/service/service.go @@ -907,8 +907,8 @@ func (s *service) Reject(c *client, id string) (err error) { return c.FollowRequestReject(c.ctx, id) } -func (s *service) Mute(c *client, id string) (err error) { - _, err = c.AccountMute(c.ctx, id) +func (s *service) Mute(c *client, id string, notifications *bool) (err error) { + _, err = c.AccountMute(c.ctx, id, notifications) return } diff --git a/service/transport.go b/service/transport.go index 42b371a..a7912e6 100644 --- a/service/transport.go +++ b/service/transport.go @@ -406,7 +406,13 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { mute := handle(func(c *client) error { id, _ := mux.Vars(c.r)["id"] - err := s.Mute(c, id) + q := c.r.URL.Query() + var notifications *bool + if r, ok := q["notifications"]; ok && len(r) > 0 { + notifications = new(bool) + *notifications = r[0] == "true" + } + err := s.Mute(c, id, notifications) if err != nil { return err } -- cgit v1.2.3