Skip to content

Commit 83956fe

Browse files
committed
Update repository widget property
1 parent 7824413 commit 83956fe

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

docs/configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ https://www.youtube.com...&list={ID}&...
907907
The maximum number of videos to show.
908908
909909
##### `sort-by`
910-
Used to specify the order in which the videos should get returned. Possible values are `none`, `updated`, and `posted`.
910+
Used to specify the order in which the videos should get returned. Possible values are `none`, `updated`, and `posted`.
911911
Default value is `posted`.
912912
913913
##### `collapse-after`
@@ -2504,7 +2504,7 @@ Example:
25042504
pull-requests-limit: 5
25052505
issues-limit: 3
25062506
commits-limit: 3
2507-
exclude-draft-prs: true
2507+
exclude-draft-pull-requests: true
25082508
```
25092509

25102510
Preview:
@@ -2520,7 +2520,7 @@ Preview:
25202520
| pull-requests-limit | integer | no | 3 |
25212521
| issues-limit | integer | no | 3 |
25222522
| commits-limit | integer | no | -1 |
2523-
| exclude-draft-prs | boolean | no | false |
2523+
| exclude-draft-pull-requests | boolean | no | false |
25242524

25252525
##### `repository`
25262526
The owner and repository name that will have their information displayed.
@@ -2537,7 +2537,7 @@ The maximum number of latest open issues to show. Set to `-1` to not show any.
25372537
##### `commits-limit`
25382538
The maximum number of lastest commits to show from the default branch. Set to `-1` to not show any.
25392539

2540-
##### `exclude-draft-prs`
2540+
##### `exclude-draft-pull-requests`
25412541
Wheter to exclude draft pull requests from the list. Set to `false` by default to include them.
25422542

25432543
### Bookmarks

internal/glance/widget-repository.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type repositoryWidget struct {
1919
PullRequestsLimit int `yaml:"pull-requests-limit"`
2020
IssuesLimit int `yaml:"issues-limit"`
2121
CommitsLimit int `yaml:"commits-limit"`
22-
ExcludeDraftPRs bool `yaml:"exclude-draft-prs"`
22+
ExcludeDraftPRs bool `yaml:"exclude-draft-pull-requests"`
2323
Repository repository `yaml:"-"`
2424
}
2525

@@ -113,23 +113,18 @@ type gitHubCommitResponseJson struct {
113113
} `json:"commit"`
114114
}
115115

116-
func buildPRQuery(repo string, excludeDraftPRs bool) string {
117-
query := fmt.Sprintf("is:pr+is:open+repo:%s", repo)
118-
if excludeDraftPRs {
119-
query += "+-is:draft"
120-
}
121-
return query
122-
}
123-
124116
func fetchRepositoryDetailsFromGithub(repo string, token string, maxPRs int, maxIssues int, maxCommits int, excludeDraftPRs bool) (repository, error) {
125117
repositoryRequest, err := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s", repo), nil)
126118
if err != nil {
127119
return repository{}, fmt.Errorf("%w: could not create request with repository: %v", errNoContent, err)
128120
}
129121

130-
prQuery := buildPRQuery(repo, excludeDraftPRs)
122+
RRsQuery := fmt.Sprintf("is:pr+is:open+repo:%s", repo)
123+
if excludeDraftPRs {
124+
RRsQuery += "+-is:draft"
125+
}
131126

132-
PRsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=%s&per_page=%d", prQuery, maxPRs), nil)
127+
PRsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=%s&per_page=%d", RRsQuery, maxPRs), nil)
133128
issuesRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/search/issues?q=is:issue+is:open+repo:%s&per_page=%d", repo, maxIssues), nil)
134129
CommitsRequest, _ := http.NewRequest("GET", fmt.Sprintf("https://api.github.com/repos/%s/commits?per_page=%d", repo, maxCommits), nil)
135130

0 commit comments

Comments
 (0)