mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-22 04:39:21 +02:00
Added view pinned statuses in accounts
This commit is contained in:
parent
b07793e986
commit
ca99d0a789
|
@ -152,10 +152,11 @@ func (c *Client) AccountUpdate(ctx context.Context, profile *Profile) (*Account,
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAccountStatuses return statuses by specified accuont.
|
// 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
|
var statuses []*Status
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Set("only_media", strconv.FormatBool(onlyMedia))
|
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)
|
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/statuses", url.PathEscape(string(id))), params, &statuses, pg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -610,7 +610,7 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
||||||
|
|
||||||
switch pageType {
|
switch pageType {
|
||||||
case "":
|
case "":
|
||||||
statuses, err = c.GetAccountStatuses(c.ctx, id, false, &pg)
|
statuses, err = c.GetAccountStatuses(c.ctx, id, false, false, &pg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -637,7 +637,7 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
||||||
id, pg.MaxID)
|
id, pg.MaxID)
|
||||||
}
|
}
|
||||||
case "media":
|
case "media":
|
||||||
statuses, err = c.GetAccountStatuses(c.ctx, id, true, &pg)
|
statuses, err = c.GetAccountStatuses(c.ctx, id, true, false, &pg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -645,6 +645,15 @@ func (s *service) UserPage(c *client, id string, pageType string,
|
||||||
nextLink = fmt.Sprintf("/user/%s/media?max_id=%s",
|
nextLink = fmt.Sprintf("/user/%s/media?max_id=%s",
|
||||||
id, pg.MaxID)
|
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":
|
case "bookmarks":
|
||||||
if !isCurrent {
|
if !isCurrent {
|
||||||
return errInvalidArgument
|
return errInvalidArgument
|
||||||
|
|
|
@ -115,7 +115,8 @@
|
||||||
<a href="/user/{{.User.ID}}"> statuses ({{.User.StatusesCount}}) </a> -
|
<a href="/user/{{.User.ID}}"> statuses ({{.User.StatusesCount}}) </a> -
|
||||||
<a href="/user/{{.User.ID}}/following"> following ({{.User.FollowingCount}}) </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}}/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>
|
</div>
|
||||||
{{if .IsCurrent}}
|
{{if .IsCurrent}}
|
||||||
<div>
|
<div>
|
||||||
|
@ -173,6 +174,14 @@
|
||||||
<div class="no-data-found">No data found</div>
|
<div class="no-data-found">No data found</div>
|
||||||
{{end}}
|
{{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"}}
|
{{else if eq .Type "bookmarks"}}
|
||||||
<div class="page-title"> Bookmarks </div>
|
<div class="page-title"> Bookmarks </div>
|
||||||
{{range .Statuses}}
|
{{range .Statuses}}
|
||||||
|
|
Loading…
Reference in New Issue