Skip to content

Commit 91a45ab

Browse files
committed
fix test and comment
1 parent 330c7e2 commit 91a45ab

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

models/issues/issue_search.go

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ func applyAssigneeCondition(sess *xorm.Session, assigneeID string) {
369369
}
370370

371371
func applyPosterCondition(sess *xorm.Session, posterID string) {
372+
// Actually every issue has a poster.
373+
// The "(none)" is for internal usage only: when doer tries to search non-existing user as poster, use "(none)" to return empty result.
372374
if posterID == "(none)" {
373375
sess.And("issue.poster_id=0")
374376
} else if posterIDInt64, _ := strconv.ParseInt(posterID, 10, 64); posterIDInt64 > 0 {

modules/indexer/issues/internal/tests/tests.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ var cases = []*testIndexerCase{
379379
Paginator: &db.ListOptions{
380380
PageSize: 5,
381381
},
382-
PosterID: optional.Some(int64(1)),
382+
PosterID: "1",
383383
},
384384
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
385385
assert.Len(t, result.Hits, 5)
@@ -397,7 +397,7 @@ var cases = []*testIndexerCase{
397397
Paginator: &db.ListOptions{
398398
PageSize: 5,
399399
},
400-
AssigneeID: optional.Some(int64(1)),
400+
AssigneeID: "1",
401401
},
402402
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
403403
assert.Len(t, result.Hits, 5)
@@ -415,7 +415,7 @@ var cases = []*testIndexerCase{
415415
Paginator: &db.ListOptions{
416416
PageSize: 5,
417417
},
418-
AssigneeID: optional.Some(int64(0)),
418+
AssigneeID: "(none)",
419419
},
420420
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
421421
assert.Len(t, result.Hits, 5)
@@ -650,7 +650,7 @@ var cases = []*testIndexerCase{
650650
{
651651
Name: "SearchAnyAssignee",
652652
SearchOptions: &internal.SearchOptions{
653-
AnyAssigneeOnly: true,
653+
AssigneeID: "(any)",
654654
},
655655
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
656656
assert.Len(t, result.Hits, 180)

routers/web/shared/user/helper.go

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func GetFilterUserIDByName(ctx context.Context, name string) string {
4444
if id, err := strconv.ParseInt(name, 10, 64); err == nil {
4545
return strconv.FormatInt(id, 10)
4646
}
47+
// The "(none)" is for internal usage only: when doer tries to search non-existing user, use "(none)" to return empty result.
4748
return "(none)"
4849
}
4950
return strconv.FormatInt(u.ID, 10)

templates/repo/issue/filter_item_user_assign.tmpl

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
* UserSearchList
55
* SelectedUserId: 0 or empty means default, -1 means "no user is set"
66
* TextFilterTitle
7-
* TextZeroValue: the text for "all issues"
8-
* TextNegativeOne: the text for "issues with no assignee"
9-
* TextAnyCondition: the text for "issues with any assignee"
7+
* TextFilterMatchNone: the text for "issues with no assignee"
8+
* TextFilterMatchAny: the text for "issues with any assignee"
109
*/}}
1110
{{$queryLink := .QueryLink}}
1211
<div class="item ui dropdown jump {{if not .UserSearchList}}disabled{{end}}">

0 commit comments

Comments
 (0)