Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repo-list private and total count bugs #11500

Merged
merged 7 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix repo-list private and total count bugs
Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed May 19, 2020
commit 600c28d673e68abe386b6be8e167f6265386fd52
9 changes: 1 addition & 8 deletions models/repo_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,7 @@ func SearchRepositoryCondition(opts *SearchRepoOptions) builder.Cond {
}

if opts.OnlyPrivate {
cond = cond.And(
builder.Or(
builder.Eq{"is_private": true},
builder.In("owner_id", builder.Select("id").From("`user`").Where(
builder.And(
builder.Eq{"type": UserTypeOrganization},
builder.Or(builder.Eq{"visibility": structs.VisibleTypeLimited}, builder.Eq{"visibility": structs.VisibleTypePrivate}),
)))))
cond = cond.And(builder.Eq{"is_private": true})
}

if opts.Template != util.OptionalBoolNone {
Expand Down
7 changes: 7 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,13 @@ function initVueComponents() {

this.isLoading = true;

if (!this.reposTotalCount) {
const totalCountSearchURL = `${this.suburl}/api/v1/repos/search?sort=updated&order=desc&uid=${this.uid}&q=&page=1&mode=`;
$.getJSON(totalCountSearchURL, (_result, _textStatus, request) => {
self.reposTotalCount = request.getResponseHeader('X-Total-Count');
});
}

const searchedMode = this.repoTypes[this.reposFilter].searchMode;
const searchedURL = this.searchURL;
const searchedQuery = this.searchQuery;
Expand Down