mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-14 00:39:22 +02:00
Add reactions page
This commit is contained in:
parent
927bd6127c
commit
81a52fe7c6
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -189,6 +189,11 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||
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"]
|
||||
return s.RetweetedByPage(c, 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)
|
||||
|
|
|
@ -248,6 +248,11 @@
|
|||
</a>
|
||||
</form>
|
||||
</div>
|
||||
<div class="status-action">
|
||||
<a href="/reactionspage/{{.ID}}">
|
||||
reactions
|
||||
</a>
|
||||
</div>
|
||||
<div class="status-action status-action-last">
|
||||
<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
|
||||
{{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
|
||||
|
|
Loading…
Reference in New Issue