diff --git a/renderer/model.go b/renderer/model.go index ab1a88b..0bb23cc 100644 --- a/renderer/model.go +++ b/renderer/model.go @@ -136,6 +136,12 @@ type LikedByData struct { NextLink string } +//For Pleroma reactions +type ReactedByData struct { + *CommonData + Reactions []*mastodon.ReactionsPleroma +} + type RetweetedByData struct { *CommonData Users []*mastodon.Account diff --git a/renderer/renderer.go b/renderer/renderer.go index 2121cd9..6b3901b 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -30,6 +30,7 @@ const ( AboutInstance = "aboutinstance.tmpl" EmojiPage = "emoji.tmpl" LikedByPage = "likedby.tmpl" + ReactedByPage = "reactionspage.tmpl" RetweetedByPage = "retweetedby.tmpl" SearchPage = "search.tmpl" SettingsPage = "settings.tmpl" diff --git a/service/service.go b/service/service.go index d2cd944..5a6b296 100644 --- a/service/service.go +++ b/service/service.go @@ -505,6 +505,19 @@ func (s *service) LikedByPage(c *client, id string) (err error) { return s.renderer.Render(c.rctx, c.w, renderer.LikedByPage, data) } +func (s *service) ReactedByPage(c *client, id string) (err error) { + reactions, err := c.GetReactedBy(c.ctx, id) + if err != nil { + return + } + cdata := s.cdata(c, "reactions", 0, 0, "") + data := &renderer.ReactedByData{ + CommonData: cdata, + Reactions: reactions, + } + return s.renderer.Render(c.rctx, c.w, renderer.ReactedByPage, data) +} + func (s *service) RetweetedByPage(c *client, id string) (err error) { retweeters, err := c.GetRebloggedBy(c.ctx, id, nil) if err != nil { diff --git a/service/transport.go b/service/transport.go index d7006ad..1b0a34a 100644 --- a/service/transport.go +++ b/service/transport.go @@ -188,6 +188,11 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { id, _ := mux.Vars(c.r)["id"] return s.LikedByPage(c, id) }, SESSION, HTML) + + reactedByPage := handle(func(c *client) error { + id, _ := mux.Vars(c.r)["id"] + return s.ReactedByPage(c, id) + }, SESSION, HTML) retweetedByPage := handle(func(c *client) error { id, _ := mux.Vars(c.r)["id"] @@ -746,6 +751,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { r.HandleFunc("/thread/{id}", threadPage).Methods(http.MethodGet) r.HandleFunc("/quickreply/{id}", quickReplyPage).Methods(http.MethodGet) r.HandleFunc("/likedby/{id}", likedByPage).Methods(http.MethodGet) + r.HandleFunc("/reactionspage/{id}", reactedByPage).Methods(http.MethodGet) r.HandleFunc("/retweetedby/{id}", retweetedByPage).Methods(http.MethodGet) r.HandleFunc("/notifications", notificationsPage).Methods(http.MethodGet) r.HandleFunc("/user/{id}", userPage).Methods(http.MethodGet) diff --git a/templates/status.tmpl b/templates/status.tmpl index 69dafe3..2e8223d 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -248,6 +248,11 @@ +