diff options
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
-rw-r--r-- | internal/typeutils/internaltofrontend.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 861350b44..e4ccab988 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -20,6 +20,7 @@ package typeutils import ( "fmt" + "strings" "time" "github.com/superseriousbusiness/gotosocial/internal/api/model" @@ -86,16 +87,12 @@ func (c *converter) AccountToMastoPublic(a *gtsmodel.Account) (*model.Account, e } // count statuses - statuses := []gtsmodel.Status{} - if err := c.db.GetStatusesByAccountID(a.ID, &statuses); err != nil { + statusesCount, err := c.db.CountStatusesByAccountID(a.ID) + if err != nil { if _, ok := err.(db.ErrNoEntries); !ok { return nil, fmt.Errorf("error getting last statuses: %s", err) } } - var statusesCount int - if statuses != nil { - statusesCount = len(statuses) - } // check when the last status was lastStatus := >smodel.Status{} @@ -195,7 +192,7 @@ func (c *converter) AppToMastoPublic(a *gtsmodel.Application) (*model.Applicatio func (c *converter) AttachmentToMasto(a *gtsmodel.MediaAttachment) (model.Attachment, error) { return model.Attachment{ ID: a.ID, - Type: string(a.Type), + Type: strings.ToLower(string(a.Type)), URL: a.URL, PreviewURL: a.Thumbnail.URL, RemoteURL: a.RemoteURL, @@ -294,7 +291,6 @@ func (c *converter) StatusToMasto( var faved bool var reblogged bool var bookmarked bool - var pinned bool var muted bool // requestingAccount will be nil for public requests without auth @@ -319,11 +315,6 @@ func (c *converter) StatusToMasto( if err != nil { return nil, fmt.Errorf("error checking if requesting account has bookmarked status: %s", err) } - - pinned, err = c.db.StatusPinnedBy(s, requestingAccount.ID) - if err != nil { - return nil, fmt.Errorf("error checking if requesting account has pinned status: %s", err) - } } var mastoRebloggedStatus *model.Status @@ -522,7 +513,7 @@ func (c *converter) StatusToMasto( Reblogged: reblogged, Muted: muted, Bookmarked: bookmarked, - Pinned: pinned, + Pinned: s.Pinned, Content: s.Content, Reblog: mastoRebloggedStatus, Application: mastoApplication, |