diff options
Diffstat (limited to 'internal/processing/status/get.go')
-rw-r--r-- | internal/processing/status/get.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/processing/status/get.go b/internal/processing/status/get.go index 7256d2f82..8b0c21adf 100644 --- a/internal/processing/status/get.go +++ b/internal/processing/status/get.go @@ -25,8 +25,40 @@ import ( apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" ) +// HistoryGet gets edit history for the target status, taking account of privacy settings and blocks etc. +// TODO: currently this just returns the latest version of the status. +func (p *Processor) HistoryGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) ([]*apimodel.StatusEdit, gtserror.WithCode) { + targetStatus, errWithCode := p.c.GetVisibleTargetStatus(ctx, + requestingAccount, + targetStatusID, + nil, // default freshness + ) + if errWithCode != nil { + return nil, errWithCode + } + + apiStatus, errWithCode := p.c.GetAPIStatus(ctx, requestingAccount, targetStatus) + if errWithCode != nil { + return nil, errWithCode + } + + return []*apimodel.StatusEdit{ + { + Content: apiStatus.Content, + SpoilerText: apiStatus.SpoilerText, + Sensitive: apiStatus.Sensitive, + CreatedAt: util.FormatISO8601(targetStatus.UpdatedAt), + Account: apiStatus.Account, + Poll: apiStatus.Poll, + MediaAttachments: apiStatus.MediaAttachments, + Emojis: apiStatus.Emojis, + }, + }, nil +} + // Get gets the given status, taking account of privacy settings and blocks etc. func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) { targetStatus, errWithCode := p.c.GetVisibleTargetStatus(ctx, |