Skip to content

Commit 96da352

Browse files
committed
add more comments
1 parent 0649da0 commit 96da352

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

routers/web/repo/issue_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt
504504
if !util.SliceContainsString(types, viewType, true) {
505505
viewType = "all"
506506
}
507-
507+
// TODO: "assignee" should also use GetFilterUserIDByName in the future to support usernames directly
508508
assigneeID := ctx.FormInt64("assignee")
509509
posterUsername := ctx.FormString("poster")
510510
posterUserID := shared_user.GetFilterUserIDByName(ctx, posterUsername)

routers/web/shared/user/helper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ func MakeSelfOnTop(doer *user.User, users []*user.User) []*user.User {
3030
// GetFilterUserIDByName tries to get the user ID from the given username.
3131
// Before, the "issue filter" passes user ID to query the list, but in many cases, it's impossible to pre-fetch the full user list.
3232
// So it's better to make it work like GitHub: users could input username directly.
33-
// Old usage: poster=123, new usage: poster=the-user-name (at the moment, non-existing username is treated as poster=0)
33+
// Since it only converts the username to ID directly and is only used internally (to search issues), so no permission check is needed.
34+
// Old usage: poster=123, new usage: poster=the-username (at the moment, non-existing username is treated as poster=0, not ideal but acceptable)
3435
func GetFilterUserIDByName(ctx context.Context, name string) int64 {
3536
if name == "" {
3637
return 0

routers/web/user/home.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
444444
// In the future, we need something like github: "author:user1" to accept usernames directly.
445445
posterUsername := ctx.FormString("poster")
446446
opts.PosterID = user.GetFilterUserIDByName(ctx, posterUsername)
447+
// TODO: "assignee" should also use GetFilterUserIDByName in the future to support usernames directly
447448
opts.AssigneeID, _ = strconv.ParseInt(ctx.FormString("assignee"), 10, 64)
448449

449450
isFuzzy := ctx.FormBool("fuzzy")
@@ -583,9 +584,10 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
583584
// because the doer may create issues or be mentioned in any public repo.
584585
// So we need search issues in all public repos.
585586
o.AllPublic = ctx.Doer.ID == ctxUser.ID
586-
// TODO: to make it work with poster/assignee filter
587+
// TODO: to make it work with poster/assignee filter, then these IDs should be kept
587588
o.AssigneeID = nil
588589
o.PosterID = nil
590+
589591
o.MentionID = nil
590592
o.ReviewRequestedID = nil
591593
o.ReviewedID = nil

0 commit comments

Comments
 (0)