summaryrefslogtreecommitdiff
path: root/internal/processing/status/fave.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2021-09-03 10:27:40 +0100
committerLibravatar GitHub <noreply@github.com>2021-09-03 10:27:40 +0100
commit25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687 (patch)
treeb6cffb65d46a07f59d5393a257973910d4116227 /internal/processing/status/fave.go
parentsession name fix (#185) (diff)
parentreview changes (diff)
downloadgotosocial-25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687.tar.xz
Merge pull request #186 from superseriousbusiness/struct_validation
Struct validation
Diffstat (limited to 'internal/processing/status/fave.go')
-rw-r--r--internal/processing/status/fave.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/processing/status/fave.go b/internal/processing/status/fave.go
index 2badf83b3..195bfa56a 100644
--- a/internal/processing/status/fave.go
+++ b/internal/processing/status/fave.go
@@ -23,11 +23,13 @@ import (
"errors"
"fmt"
+ "github.com/superseriousbusiness/gotosocial/internal/ap"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
+ "github.com/superseriousbusiness/gotosocial/internal/messages"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
@@ -47,10 +49,8 @@ func (p *processor) Fave(ctx context.Context, requestingAccount *gtsmodel.Accoun
if !visible {
return nil, gtserror.NewErrorNotFound(errors.New("status is not visible"))
}
- if targetStatus.VisibilityAdvanced != nil {
- if !targetStatus.VisibilityAdvanced.Likeable {
- return nil, gtserror.NewErrorForbidden(errors.New("status is not faveable"))
- }
+ if !targetStatus.VisibilityAdvanced.Likeable {
+ return nil, gtserror.NewErrorForbidden(errors.New("status is not faveable"))
}
// first check if the status is already faved, if so we don't need to do anything
@@ -84,9 +84,9 @@ func (p *processor) Fave(ctx context.Context, requestingAccount *gtsmodel.Accoun
}
// send it back to the processor for async processing
- p.fromClientAPI <- gtsmodel.FromClientAPI{
- APObjectType: gtsmodel.ActivityStreamsLike,
- APActivityType: gtsmodel.ActivityStreamsCreate,
+ p.fromClientAPI <- messages.FromClientAPI{
+ APObjectType: ap.ActivityLike,
+ APActivityType: ap.ActivityCreate,
GTSModel: gtsFave,
OriginAccount: requestingAccount,
TargetAccount: targetStatus.Account,