mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-12-22 11:23:33 +02:00
Added view pinned statuses in accounts
This commit is contained in:
parent
b07793e986
commit
ca99d0a789
3 changed files with 23 additions and 4 deletions
|
@ -152,10 +152,11 @@ func (c *Client) AccountUpdate(ctx context.Context, profile *Profile) (*Account,
|
|||
}
|
||||
|
||||
// GetAccountStatuses return statuses by specified accuont.
|
||||
func (c *Client) GetAccountStatuses(ctx context.Context, id string, onlyMedia bool, pg *Pagination) ([]*Status, error) {
|
||||
func (c *Client) GetAccountStatuses(ctx context.Context, id string, onlyMedia bool, onlyPinned bool, pg *Pagination) ([]*Status, error) {
|
||||
var statuses []*Status
|
||||
params := url.Values{}
|
||||
params.Set("only_media", strconv.FormatBool(onlyMedia))
|
||||
params.Set("pinned", strconv.FormatBool(onlyPinned))
|
||||
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/statuses", url.PathEscape(string(id))), params, &statuses, pg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -610,7 +610,7 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
|||
|
||||
switch pageType {
|
||||
case "":
|
||||
statuses, err = c.GetAccountStatuses(c.ctx, id, false, &pg)
|
||||
statuses, err = c.GetAccountStatuses(c.ctx, id, false, false, &pg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
|||
id, pg.MaxID)
|
||||
}
|
||||
case "media":
|
||||
statuses, err = c.GetAccountStatuses(c.ctx, id, true, &pg)
|
||||
statuses, err = c.GetAccountStatuses(c.ctx, id, true, false, &pg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -645,6 +645,15 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
|||
nextLink = fmt.Sprintf("/user/%s/media?max_id=%s",
|
||||
id, pg.MaxID)
|
||||
}
|
||||
case "pinned":
|
||||
statuses, err = c.GetAccountStatuses(c.ctx, id, false, true, &pg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len(statuses) == 20 && len(pg.MaxID) > 0 {
|
||||
nextLink = fmt.Sprintf("/user/%s/pinned?max_id=%s",
|
||||
id, pg.MaxID)
|
||||
}
|
||||
case "bookmarks":
|
||||
if !isCurrent {
|
||||
return errInvalidArgument
|
||||
|
|
|
@ -115,7 +115,8 @@
|
|||
<a href="/user/{{.User.ID}}"> statuses ({{.User.StatusesCount}}) </a> -
|
||||
<a href="/user/{{.User.ID}}/following"> following ({{.User.FollowingCount}}) </a> -
|
||||
<a href="/user/{{.User.ID}}/followers"> followers ({{.User.FollowersCount}}) </a> -
|
||||
<a href="/user/{{.User.ID}}/media"> media </a>
|
||||
<a href="/user/{{.User.ID}}/media"> media </a> -
|
||||
<a href="/user/{{.User.ID}}/pinned"> pinned statuses </a>
|
||||
</div>
|
||||
{{if .IsCurrent}}
|
||||
<div>
|
||||
|
@ -173,6 +174,14 @@
|
|||
<div class="no-data-found">No data found</div>
|
||||
{{end}}
|
||||
|
||||
{{else if eq .Type "pinned"}}
|
||||
<div class="page-title"> Pinned statuses </div>
|
||||
{{range .Statuses}}
|
||||
{{template "status.tmpl" (WithContext . $.Ctx)}}
|
||||
{{else}}
|
||||
<div class="no-data-found">No data found</div>
|
||||
{{end}}
|
||||
|
||||
{{else if eq .Type "bookmarks"}}
|
||||
<div class="page-title"> Bookmarks </div>
|
||||
{{range .Statuses}}
|
||||
|
|
Loading…
Reference in a new issue