summaryrefslogtreecommitdiff
path: root/internal/processing
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-04-17 14:06:49 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-17 13:06:49 +0100
commitef16919d4a551ead52bb0c7f9ae3f6974b073472 (patch)
tree3dc372cf00447e6dae01bc4498e1a3e0355919a3 /internal/processing
parent[bugfix] Fix minor API issue w/ boosted statuses (#2846) (diff)
downloadgotosocial-ef16919d4a551ead52bb0c7f9ae3f6974b073472.tar.xz
[feature] Stub status history endpoint (#2847)
Diffstat (limited to 'internal/processing')
-rw-r--r--internal/processing/status/get.go32
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,