Add likes list
authorr <r@freesoftwareextremist.com>
Sun, 27 Sep 2020 10:04:56 +0000 (10:04 +0000)
committerr <r@freesoftwareextremist.com>
Sun, 27 Sep 2020 10:04:56 +0000 (10:04 +0000)
service/service.go
templates/user.tmpl

index 0b23d47c328dc5037b87acdc91257cc2c189a5d7..9190ca4a73b12f58964322d4b38f4e2c11f8b966 100644 (file)
@@ -541,6 +541,18 @@ func (svc *service) ServeUserPage(c *model.Client, id string, pageType string,
                        nextLink = fmt.Sprintf("/user/%s/blocks?max_id=%s",
                                id, pg.MaxID)
                }
+       case "likes":
+               if !isCurrent {
+                       return errInvalidArgument
+               }
+               statuses, err = c.GetFavourites(ctx, &pg)
+               if err != nil {
+                       return
+               }
+               if len(statuses) == 20 && len(pg.MaxID) > 0 {
+                       nextLink = fmt.Sprintf("/user/%s/likes?max_id=%s",
+                               id, pg.MaxID)
+               }
        default:
                return errInvalidArgument
        }
index d260848e5fa8e0bbc120ffab2276fad7a1165d4b..b7a12b93a3f70a87bafa798bb6a1ffd639a58e8b 100644 (file)
                {{if .IsCurrent}}
                <div>
                        <a href="/user/{{.User.ID}}/bookmarks"> bookmarks </a> -
+                       <a href="/user/{{.User.ID}}/likes"> likes </a> -
                        <a href="/user/{{.User.ID}}/mutes"> mutes </a> -
                        <a href="/user/{{.User.ID}}/blocks"> blocks </a>
                </div>
 <div class="no-data-found">No data found</div>
 {{end}}
 
+{{else if eq .Type "likes"}}
+<div class="page-title"> Likes </div>
+{{range .Statuses}}
+{{template "status.tmpl" (WithContext . $.Ctx)}}
+{{else}}
+<div class="no-data-found">No data found</div>
+{{end}}
+
 {{else if eq .Type "mutes"}}
 <div class="page-title"> Mutes </div>
 {{template "userlist.tmpl" (WithContext .Users $.Ctx)}}