@@ -11,7 +11,6 @@ import (
11
11
"code.gitea.io/gitea/models/unit"
12
12
user_model "code.gitea.io/gitea/models/user"
13
13
"code.gitea.io/gitea/modules/container"
14
- api "code.gitea.io/gitea/modules/structs"
15
14
16
15
"xorm.io/builder"
17
16
)
@@ -146,57 +145,6 @@ func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.Us
146
145
return users , nil
147
146
}
148
147
149
- // GetReviewers get all users can be requested to review:
150
- // * for private repositories this returns all users that have read access or higher to the repository.
151
- // * for public repositories this returns all users that have read access or higher to the repository,
152
- // all repo watchers and all organization members.
153
- // TODO: may be we should have a busy choice for users to block review request to them.
154
- func GetReviewers (ctx context.Context , repo * Repository , doerID , posterID int64 ) ([]* user_model.User , error ) {
155
- // Get the owner of the repository - this often already pre-cached and if so saves complexity for the following queries
156
- if err := repo .LoadOwner (ctx ); err != nil {
157
- return nil , err
158
- }
159
-
160
- cond := builder .And (builder.Neq {"`user`.id" : posterID }).
161
- And (builder.Eq {"`user`.is_active" : true })
162
-
163
- if repo .IsPrivate || repo .Owner .Visibility == api .VisibleTypePrivate {
164
- // This a private repository:
165
- // Anyone who can read the repository is a requestable reviewer
166
-
167
- cond = cond .And (builder .In ("`user`.id" ,
168
- builder .Select ("user_id" ).From ("access" ).Where (
169
- builder.Eq {"repo_id" : repo .ID }.
170
- And (builder.Gte {"mode" : perm .AccessModeRead }),
171
- ),
172
- ))
173
-
174
- if repo .Owner .Type == user_model .UserTypeIndividual && repo .Owner .ID != posterID {
175
- // as private *user* repos don't generate an entry in the `access` table,
176
- // the owner of a private repo needs to be explicitly added.
177
- cond = cond .Or (builder.Eq {"`user`.id" : repo .Owner .ID })
178
- }
179
- } else {
180
- // This is a "public" repository:
181
- // Any user that has read access, is a watcher or organization member can be requested to review
182
- cond = cond .And (builder .And (builder .In ("`user`.id" ,
183
- builder .Select ("user_id" ).From ("access" ).
184
- Where (builder.Eq {"repo_id" : repo .ID }.
185
- And (builder.Gte {"mode" : perm .AccessModeRead })),
186
- ).Or (builder .In ("`user`.id" ,
187
- builder .Select ("user_id" ).From ("watch" ).
188
- Where (builder.Eq {"repo_id" : repo .ID }.
189
- And (builder .In ("mode" , WatchModeNormal , WatchModeAuto ))),
190
- ).Or (builder .In ("`user`.id" ,
191
- builder .Select ("uid" ).From ("org_user" ).
192
- Where (builder.Eq {"org_id" : repo .OwnerID }),
193
- )))))
194
- }
195
-
196
- users := make ([]* user_model.User , 0 , 8 )
197
- return users , db .GetEngine (ctx ).Where (cond ).OrderBy (user_model .GetOrderByName ()).Find (& users )
198
- }
199
-
200
148
// GetIssuePostersWithSearch returns users with limit of 30 whose username started with prefix that have authored an issue/pull request for the given repository
201
149
// If isShowFullName is set to true, also include full name prefix search
202
150
func GetIssuePostersWithSearch (ctx context.Context , repo * Repository , isPull bool , search string , isShowFullName bool ) ([]* user_model.User , error ) {
0 commit comments