mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Stub status history endpoint (#2847)
This commit is contained in:
@@ -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,
|
||||
|
Reference in New Issue
Block a user