[chore] Update versions, fix lint errors (#1860)

This commit is contained in:
tobi 2023-06-03 13:58:57 +02:00 committed by GitHub
commit 21c1552daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 66 additions and 57 deletions

View file

@ -141,9 +141,5 @@ func validateCreateAccount(form *apimodel.AccountCreateRequest) error {
return err
}
if err := validate.SignUpReason(form.Reason, config.GetAccountsReasonRequired()); err != nil {
return err
}
return nil
return validate.SignUpReason(form.Reason, config.GetAccountsReasonRequired())
}

View file

@ -117,7 +117,8 @@ func ErrorHandler(c *gin.Context, errWithCode gtserror.WithCode, instanceGet fun
// or if we should just use a json. Normally we would want to
// check for a returned error, but if an error occurs here we
// can just fall back to default behavior (serve json error).
accept, _ := NegotiateAccept(c, JSONOrHTMLAcceptHeaders...)
// Prefer provided offers, fall back to JSON or HTML.
accept, _ := NegotiateAccept(c, append(offers, JSONOrHTMLAcceptHeaders...)...)
if errWithCode.Code() == http.StatusNotFound {
// Use our special not found handler with useful status text.

View file

@ -36,6 +36,7 @@ var SentinelError = errors.New("BUG: error should not be returned") //nolint:rev
// caches, which specifically catches and ignores our sentinel error type.
func ignoreErrors(err error) bool {
return errorsv2.Comparable(
err,
SentinelError,
context.DeadlineExceeded,
context.Canceled,

View file

@ -160,7 +160,7 @@ func (b *basicDB) DropTable(ctx context.Context, i interface{}) db.Error {
}
func (b *basicDB) IsHealthy(ctx context.Context) db.Error {
return b.conn.Ping()
return b.conn.PingContext(ctx)
}
func (b *basicDB) Stop(ctx context.Context) db.Error {

View file

@ -70,11 +70,7 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR
return errors.New("Reject: follow object account and inbox account were not the same")
}
if err := f.state.DB.RejectFollowRequest(ctx, followReq.AccountID, followReq.TargetAccountID); err != nil {
return err
}
return nil
return f.state.DB.RejectFollowRequest(ctx, followReq.AccountID, followReq.TargetAccountID)
}
}
@ -90,20 +86,19 @@ func (f *federatingDB) Reject(ctx context.Context, reject vocab.ActivityStreamsR
if !ok {
return errors.New("Reject: couldn't parse follow into vocab.ActivityStreamsFollow")
}
// convert the follow to something we can understand
gtsFollow, err := f.typeConverter.ASFollowToFollow(ctx, asFollow)
if err != nil {
return fmt.Errorf("Reject: error converting asfollow to gtsfollow: %s", err)
}
// make sure the addressee of the original follow is the same as whatever inbox this landed in
if gtsFollow.AccountID != receivingAccount.ID {
return errors.New("Reject: follow object account and inbox account were not the same")
}
if err := f.state.DB.RejectFollowRequest(ctx, gtsFollow.AccountID, gtsFollow.TargetAccountID); err != nil {
return err
}
return nil
return f.state.DB.RejectFollowRequest(ctx, gtsFollow.AccountID, gtsFollow.TargetAccountID)
}
}

View file

@ -72,8 +72,6 @@ func (gts *gotosocial) Stop(ctx context.Context) error {
if err := gts.apiRouter.Stop(ctx); err != nil {
return err
}
if err := gts.db.Stop(ctx); err != nil {
return err
}
return nil
return gts.db.Stop(ctx)
}

View file

@ -434,11 +434,7 @@ func (p *Processor) wipeStatus(ctx context.Context, statusToDelete *gtsmodel.Sta
}
// delete the status itself
if err := p.state.DB.DeleteStatusByID(ctx, statusToDelete.ID); err != nil {
return err
}
return nil
return p.state.DB.DeleteStatusByID(ctx, statusToDelete.ID)
}
// deleteStatusFromTimelines completely removes the given status from all timelines.

View file

@ -167,11 +167,7 @@ func (p *Processor) processCreateStatusFromFederator(ctx context.Context, federa
}
}
if err := p.timelineAndNotifyStatus(ctx, status); err != nil {
return err
}
return nil
return p.timelineAndNotifyStatus(ctx, status)
}
// processCreateFaveFromFederator handles Activity Create and Object Like
@ -208,11 +204,7 @@ func (p *Processor) processCreateFaveFromFederator(ctx context.Context, federato
incomingFave.Account = a
}
if err := p.notifyFave(ctx, incomingFave); err != nil {
return err
}
return nil
return p.notifyFave(ctx, incomingFave)
}
// processCreateFollowRequestFromFederator handles Activity Create and Object Follow
@ -327,11 +319,7 @@ func (p *Processor) processCreateAnnounceFromFederator(ctx context.Context, fede
return err
}
if err := p.notifyAnnounce(ctx, incomingAnnounce); err != nil {
return err
}
return nil
return p.notifyAnnounce(ctx, incomingAnnounce)
}
// processCreateBlockFromFederator handles Activity Create and Object Block