Fast loading account on Pleroma instances; relationships include in account

This commit is contained in:
localhost_frssoft 2022-10-11 23:31:09 +03:00
parent d139cb752c
commit fe304f60e9

View File

@ -58,7 +58,11 @@ type AccountSource struct {
// GetAccount return Account.
func (c *Client) GetAccount(ctx context.Context, id string) (*Account, error) {
var account Account
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s", url.PathEscape(string(id))), nil, &account, nil)
params := url.Values{}
if account.Pleroma != nil {
params.Set("with_relationships", "1")
}
err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s", url.PathEscape(string(id))), params, &account, nil)
if err != nil {
return nil, err
}