diff --git a/internal/apimodule/admin/admin.go b/internal/apimodule/admin/admin.go index 81d00116f..34a0aa2c8 100644 --- a/internal/apimodule/admin/admin.go +++ b/internal/apimodule/admin/admin.go @@ -33,12 +33,8 @@ import ( ) const ( - idKey = "id" - basePath = "/api/v1/admin" - emojiPath = basePath + "/custom_emojis" - basePathWithID = basePath + "/:" + idKey - verifyPath = basePath + "/verify_credentials" - updateCredentialsPath = basePath + "/update_credentials" + basePath = "/api/v1/admin" + emojiPath = basePath + "/custom_emojis" ) type adminModule struct { diff --git a/internal/apimodule/media/test/mediacreate_test.go b/internal/apimodule/media/test/mediacreate_test.go index 33215aea9..01a0a6a31 100644 --- a/internal/apimodule/media/test/mediacreate_test.go +++ b/internal/apimodule/media/test/mediacreate_test.go @@ -32,11 +32,11 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" + mediamodule "github.com/superseriousbusiness/gotosocial/internal/apimodule/media" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/mastotypes" - mediamodule "github.com/superseriousbusiness/gotosocial/internal/apimodule/media" mastomodel "github.com/superseriousbusiness/gotosocial/internal/mastotypes/mastomodel" "github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/oauth" diff --git a/internal/apimodule/status/status.go b/internal/apimodule/status/status.go index 2ecd009bf..e65293b62 100644 --- a/internal/apimodule/status/status.go +++ b/internal/apimodule/status/status.go @@ -36,28 +36,28 @@ import ( ) const ( - IDKey = "id" - BasePath = "/api/v1/statuses" - BasePathWithID = BasePath + "/:" + IDKey + IDKey = "id" + BasePath = "/api/v1/statuses" + BasePathWithID = BasePath + "/:" + IDKey - ContextPath = BasePathWithID + "/context" + ContextPath = BasePathWithID + "/context" FavouritedPath = BasePathWithID + "/favourited_by" FavouritePath = BasePathWithID + "/favourite" UnfavouritePath = BasePathWithID + "/unfavourite" - RebloggedPath = BasePathWithID + "/reblogged_by" - ReblogPath = BasePathWithID + "/reblog" - UnreblogPath = BasePathWithID + "/unreblog" + RebloggedPath = BasePathWithID + "/reblogged_by" + ReblogPath = BasePathWithID + "/reblog" + UnreblogPath = BasePathWithID + "/unreblog" - BookmarkPath = BasePathWithID + "/bookmark" - UnbookmarkPath = BasePathWithID + "/unbookmark" + BookmarkPath = BasePathWithID + "/bookmark" + UnbookmarkPath = BasePathWithID + "/unbookmark" - MutePath = BasePathWithID + "/mute" - UnmutePath = BasePathWithID + "/unmute" + MutePath = BasePathWithID + "/mute" + UnmutePath = BasePathWithID + "/unmute" - PinPath = BasePathWithID + "/pin" - UnpinPath = BasePathWithID + "/unpin" + PinPath = BasePathWithID + "/pin" + UnpinPath = BasePathWithID + "/unpin" ) type StatusModule struct { @@ -89,7 +89,6 @@ func (m *StatusModule) Route(r router.Router) error { r.AttachHandler(http.MethodPost, FavouritePath, m.StatusFavePOSTHandler) r.AttachHandler(http.MethodPost, UnfavouritePath, m.StatusFavePOSTHandler) - r.AttachHandler(http.MethodGet, BasePathWithID, m.muxHandler) return nil } diff --git a/internal/apimodule/status/statusdelete.go b/internal/apimodule/status/statusdelete.go index 85b10ff16..f67d035d8 100644 --- a/internal/apimodule/status/statusdelete.go +++ b/internal/apimodule/status/statusdelete.go @@ -97,9 +97,9 @@ func (m *StatusModule) StatusDELETEHandler(c *gin.Context) { } m.distributor.FromClientAPI() <- distributor.FromClientAPI{ - APObjectType: gtsmodel.ActivityStreamsNote, + APObjectType: gtsmodel.ActivityStreamsNote, APActivityType: gtsmodel.ActivityStreamsDelete, - Activity: targetStatus, + Activity: targetStatus, } c.JSON(http.StatusOK, mastoStatus) diff --git a/internal/apimodule/status/statusfavedby.go b/internal/apimodule/status/statusfavedby.go index df08ad814..76a50b2ca 100644 --- a/internal/apimodule/status/statusfavedby.go +++ b/internal/apimodule/status/statusfavedby.go @@ -94,7 +94,7 @@ func (m *StatusModule) StatusFavedByGETHandler(c *gin.Context) { // get ALL accounts that faved a status -- doesn't take account of blocks and mutes and stuff favingAccounts, err := m.db.WhoFavedStatus(targetStatus) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error":err.Error()}) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } @@ -103,7 +103,7 @@ func (m *StatusModule) StatusFavedByGETHandler(c *gin.Context) { for _, acc := range favingAccounts { blocked, err := m.db.Blocked(authed.Account.ID, acc.ID) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error":err.Error()}) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } if !blocked { @@ -118,7 +118,7 @@ func (m *StatusModule) StatusFavedByGETHandler(c *gin.Context) { for _, acc := range filteredAccounts { mastoAccount, err := m.mastoConverter.AccountToMastoPublic(acc) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error":err.Error()}) + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } mastoAccounts = append(mastoAccounts, mastoAccount) diff --git a/internal/apimodule/status/test/statusfave_test.go b/internal/apimodule/status/test/statusfave_test.go index aa2a2ecb3..b15e57e77 100644 --- a/internal/apimodule/status/test/statusfave_test.go +++ b/internal/apimodule/status/test/statusfave_test.go @@ -122,7 +122,6 @@ func (suite *StatusFaveTestSuite) TestPostFave() { t := suite.testTokens["local_account_1"] oauthToken := oauth.PGTokenToOauthToken(t) - targetStatus := suite.testStatuses["admin_account_status_2"] // setup diff --git a/internal/db/pg.go b/internal/db/pg.go index 610061324..a12529d00 100644 --- a/internal/db/pg.go +++ b/internal/db/pg.go @@ -655,7 +655,7 @@ func (ps *postgresService) StatusVisible(targetStatus *gtsmodel.Status, targetAc // At this point we have a populated targetAccount, targetStatus, and requestingAccount, so we can check for blocks and whathaveyou // First check if a block exists directly between the target account (which authored the status) and the requesting account. if blocked, err := ps.Blocked(targetAccount.ID, requestingAccount.ID); err != nil { - l.Debug("something went wrong figuring out if the accounts have a block: %s", err) + l.Debugf("something went wrong figuring out if the accounts have a block: %s", err) return false, err } else if blocked { // don't allow the status to be viewed if a block exists in *either* direction between these two accounts, no creepy stalking please diff --git a/internal/mastotypes/converter.go b/internal/mastotypes/converter.go index af78b5f15..e689b62da 100644 --- a/internal/mastotypes/converter.go +++ b/internal/mastotypes/converter.go @@ -507,7 +507,7 @@ func (c *converter) StatusToMasto( } } - var mastoCard *mastotypes.Card + var mastoCard *mastotypes.Card var mastoPoll *mastotypes.Poll return &mastotypes.Status{