summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nicole Mikołajczyk <git@mkljczk.pl>2025-06-01 11:24:04 +0200
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-06-01 11:24:04 +0200
commitee180a23596371ff1c207727828191f096fb4597 (patch)
tree8dbb0ed207ef1a26b070e6b45891020c204a3acf
parent[feature/internal/httpclient] add option to configure outgoing protocol (#4134) (diff)
downloadgotosocial-ee180a23596371ff1c207727828191f096fb4597.tar.xz
[bugfix] fix GetAccountFollowRequestingIDs query (#4222)
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl> # Description This pull request fixes a bug encountered when playing around with GTS code. ## Checklist - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [x] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [x] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4222 Co-authored-by: Nicole Mikołajczyk <git@mkljczk.pl> Co-committed-by: Nicole Mikołajczyk <git@mkljczk.pl>
-rw-r--r--internal/db/bundb/relationship.go2
-rw-r--r--internal/db/bundb/relationship_test.go21
2 files changed, 22 insertions, 1 deletions
diff --git a/internal/db/bundb/relationship.go b/internal/db/bundb/relationship.go
index c8dcd5a50..867282376 100644
--- a/internal/db/bundb/relationship.go
+++ b/internal/db/bundb/relationship.go
@@ -302,7 +302,7 @@ func newSelectFollowRequesting(db *bun.DB, accountID string) *bun.SelectQuery {
return db.NewSelect().
TableExpr("?", bun.Ident("follow_requests")).
ColumnExpr("?", bun.Ident("id")).
- Where("? = ?", bun.Ident("target_account_id"), accountID).
+ Where("? = ?", bun.Ident("account_id"), accountID).
OrderExpr("? DESC", bun.Ident("id"))
}
diff --git a/internal/db/bundb/relationship_test.go b/internal/db/bundb/relationship_test.go
index 1d47db6a7..a8b456286 100644
--- a/internal/db/bundb/relationship_test.go
+++ b/internal/db/bundb/relationship_test.go
@@ -803,6 +803,27 @@ func (suite *RelationshipTestSuite) TestGetAccountFollowRequests() {
suite.Len(followRequests, 1)
}
+func (suite *RelationshipTestSuite) TestGetAccountFollowRequesting() {
+ ctx := suite.T().Context()
+ account := suite.testAccounts["admin_account"]
+ targetAccount := suite.testAccounts["local_account_2"]
+
+ followRequest := &gtsmodel.FollowRequest{
+ ID: "01GEF753FWHCHRDWR0QEHBXM8W",
+ URI: "http://localhost:8080/weeeeeeeeeeeeeeeee",
+ AccountID: account.ID,
+ TargetAccountID: targetAccount.ID,
+ }
+
+ if err := suite.db.Put(ctx, followRequest); err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ followRequests, err := suite.db.GetAccountFollowRequesting(ctx, account.ID, nil)
+ suite.NoError(err)
+ suite.Len(followRequests, 1)
+}
+
func (suite *RelationshipTestSuite) TestGetAccountFollows() {
account := suite.testAccounts["local_account_1"]
follows, err := suite.db.GetAccountFollows(suite.T().Context(), account.ID, nil)