summaryrefslogtreecommitdiff
path: root/internal/processing/fedi/status.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-07-07 14:58:53 +0200
committerLibravatar GitHub <noreply@github.com>2023-07-07 14:58:53 +0200
commitac564c18624aea229defc38bc1cc516d6c787520 (patch)
tree00fabbb17f9432bbb8fd9b2de4b185ede40f3f39 /internal/processing/fedi/status.go
parent[docs] Rework backups a bit (#1942) (diff)
downloadgotosocial-ac564c18624aea229defc38bc1cc516d6c787520.tar.xz
[bugfix] Reorder web view logic, other small fixes (#1954)
Diffstat (limited to 'internal/processing/fedi/status.go')
-rw-r--r--internal/processing/fedi/status.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/processing/fedi/status.go b/internal/processing/fedi/status.go
index a9b3e1eee..c2a0e46d6 100644
--- a/internal/processing/fedi/status.go
+++ b/internal/processing/fedi/status.go
@@ -27,9 +27,10 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
-// StatusGet handles the getting of a fedi/activitypub representation of a particular status, performing appropriate
-// authentication before returning a JSON serializable interface to the caller.
+// StatusGet handles the getting of a fedi/activitypub representation of a local status.
+// It performs appropriate authentication before returning a JSON serializable interface.
func (p *Processor) StatusGet(ctx context.Context, requestedUsername string, requestedStatusID string) (interface{}, gtserror.WithCode) {
+ // Authenticate using http signature.
requestedAccount, requestingAccount, errWithCode := p.authenticate(ctx, requestedUsername)
if errWithCode != nil {
return nil, errWithCode
@@ -41,15 +42,18 @@ func (p *Processor) StatusGet(ctx context.Context, requestedUsername string, req
}
if status.AccountID != requestedAccount.ID {
- return nil, gtserror.NewErrorNotFound(fmt.Errorf("status with id %s does not belong to account with id %s", status.ID, requestedAccount.ID))
+ err := fmt.Errorf("status with id %s does not belong to account with id %s", status.ID, requestedAccount.ID)
+ return nil, gtserror.NewErrorNotFound(err)
}
visible, err := p.filter.StatusVisible(ctx, requestingAccount, status)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
+
if !visible {
- return nil, gtserror.NewErrorNotFound(fmt.Errorf("status with id %s not visible to user with id %s", status.ID, requestingAccount.ID))
+ err := fmt.Errorf("status with id %s not visible to user with id %s", status.ID, requestingAccount.ID)
+ return nil, gtserror.NewErrorNotFound(err)
}
asStatus, err := p.tc.StatusToAS(ctx, status)