aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-07-09 15:47:58 -0400
committerGitHub <noreply@github.com>2023-07-09 19:47:58 +0000
commit06bcdfe77a2cf6c1ab9dc3d75a60894ffd3abb68 (patch)
tree1ea28f25b52f60d95455c7a7b942edcdb2e148aa /models
parenta5a3c8141274bbcc12e5c4f72b85e02efe47841c (diff)
downloadgitea-06bcdfe77a2cf6c1ab9dc3d75a60894ffd3abb68.tar.gz
gitea-06bcdfe77a2cf6c1ab9dc3d75a60894ffd3abb68.zip
Remove unused code (#25734) (#25788)
Backport #25734 by @KN4CK3R The method is only used in the test. Found it because I changed the fixtures and had a hard time fixing this test. My revenge is deleting it. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Diffstat (limited to 'models')
-rw-r--r--models/organization/org.go21
-rw-r--r--models/organization/org_test.go36
2 files changed, 0 insertions, 57 deletions
diff --git a/models/organization/org.go b/models/organization/org.go
index 05db6ba15f..8fd4ad076b 100644
--- a/models/organization/org.go
+++ b/models/organization/org.go
@@ -532,27 +532,6 @@ func GetOrgsCanCreateRepoByUserID(userID int64) ([]*Organization, error) {
Find(&orgs)
}
-// GetOrgUsersByUserID returns all organization-user relations by user ID.
-func GetOrgUsersByUserID(uid int64, opts *SearchOrganizationsOptions) ([]*OrgUser, error) {
- ous := make([]*OrgUser, 0, 10)
- sess := db.GetEngine(db.DefaultContext).
- Join("LEFT", "`user`", "`org_user`.org_id=`user`.id").
- Where("`org_user`.uid=?", uid)
- if !opts.All {
- // Only show public organizations
- sess.And("is_public=?", true)
- }
-
- if opts.PageSize != 0 {
- sess = db.SetSessionPagination(sess, opts)
- }
-
- err := sess.
- Asc("`user`.name").
- Find(&ous)
- return ous, err
-}
-
// GetOrgUsersByOrgID returns all organization-user relations by organization ID.
func GetOrgUsersByOrgID(ctx context.Context, opts *FindOrgMembersOpts) ([]*OrgUser, error) {
sess := db.GetEngine(ctx).Where("org_id=?", opts.OrgID)
diff --git a/models/organization/org_test.go b/models/organization/org_test.go
index 27a173d497..226807232c 100644
--- a/models/organization/org_test.go
+++ b/models/organization/org_test.go
@@ -207,42 +207,6 @@ func TestFindOrgs(t *testing.T) {
assert.EqualValues(t, 1, total)
}
-func TestGetOrgUsersByUserID(t *testing.T) {
- assert.NoError(t, unittest.PrepareTestDatabase())
-
- orgUsers, err := organization.GetOrgUsersByUserID(5, &organization.SearchOrganizationsOptions{All: true})
- assert.NoError(t, err)
- if assert.Len(t, orgUsers, 3) {
- assert.Equal(t, organization.OrgUser{
- ID: orgUsers[0].ID,
- OrgID: 23,
- UID: 5,
- IsPublic: false,
- }, *orgUsers[0])
- assert.Equal(t, organization.OrgUser{
- ID: orgUsers[1].ID,
- OrgID: 6,
- UID: 5,
- IsPublic: true,
- }, *orgUsers[1])
- assert.Equal(t, organization.OrgUser{
- ID: orgUsers[2].ID,
- OrgID: 7,
- UID: 5,
- IsPublic: false,
- }, *orgUsers[2])
- }
-
- publicOrgUsers, err := organization.GetOrgUsersByUserID(5, &organization.SearchOrganizationsOptions{All: false})
- assert.NoError(t, err)
- assert.Len(t, publicOrgUsers, 1)
- assert.Equal(t, *orgUsers[1], *publicOrgUsers[0])
-
- orgUsers, err = organization.GetOrgUsersByUserID(1, &organization.SearchOrganizationsOptions{All: true})
- assert.NoError(t, err)
- assert.Len(t, orgUsers, 0)
-}
-
func TestGetOrgUsersByOrgID(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())