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

[WIP] Make multiple repositories selectable @ issues/PR page #6369

Closed
wants to merge 33 commits into from
Closed

[WIP] Make multiple repositories selectable @ issues/PR page #6369

wants to merge 33 commits into from

Conversation

oscarlofwenhamn
Copy link
Contributor

@oscarlofwenhamn oscarlofwenhamn commented Mar 19, 2019

Will partially fix #6355

@codecov-io
Copy link

codecov-io commented Mar 19, 2019

Codecov Report

Merging #6369 into master will increase coverage by 0.02%.
The diff coverage is 47.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6369      +/-   ##
==========================================
+ Coverage   41.45%   41.48%   +0.02%     
==========================================
  Files         442      442              
  Lines       59610    59636      +26     
==========================================
+ Hits        24712    24739      +27     
+ Misses      31667    31663       -4     
- Partials     3231     3234       +3
Impacted Files Coverage Δ
models/issue.go 48% <0%> (-0.12%) ⬇️
routers/user/home.go 56.25% <49.29%> (+2.96%) ⬆️
models/unit.go 62.16% <0%> (-5.41%) ⬇️
routers/repo/view.go 42.02% <0%> (-1.02%) ⬇️
models/gpg_key.go 56.66% <0%> (+0.83%) ⬆️
modules/log/event.go 65.98% <0%> (+1.52%) ⬆️
modules/log/colors_router.go 87.5% <0%> (+4.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c412f5...847510e. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 19, 2019
Part of issue #6355

* Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos.
* Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list.
*
@lafriks lafriks added the type/enhancement An improvement of existing functionality label Mar 20, 2019
@lafriks lafriks added this to the 1.9.0 milestone Mar 20, 2019
routers/user/home.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 26, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 26, 2019
routers/user/home.go Outdated Show resolved Hide resolved
@zeripath
Copy link
Contributor

I'm not completely in the loop for this but why do we still have repoID and repoIDs here?

@oscarlofwenhamn
Copy link
Contributor Author

oscarlofwenhamn commented Mar 27, 2019

@zeripath

I'm not completely in the loop for this but why do we still have repoID and repoIDs here?

Assuming you mean "why both", I think it is for fear of accidentally influencing something outside the scope of my intentions. I believe we can replace repoID with repoIDs[0] in the cases where there is only one, but I haven't been wanting to accidentally overreach.

@oscarlofwenhamn oscarlofwenhamn changed the title Make repository list @ issues/PR page persist Make multiple repositories selectable @ issues/PR page Mar 27, 2019
@lunny
Copy link
Member

lunny commented Mar 31, 2019

@oscarlofwenhamn for code readable consideration, I think @zeripath 's idea is better to keep only RepoIDs []int64.

Oscar Löfwenhamn added 3 commits April 1, 2019 08:44
Improves functionality of the page, so that backtracking is not necessary to reset the page
Completely replace 'RepoID' with 'RepoIDs' and remove redundant code
Oscar Löfwenhamn added 4 commits May 13, 2019 16:30
* Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..`
* Update tests file to reflect new functionality
* Update template with new `repos` format
* Implement new solution to show constant "total issues" count for "All" button
@oscarlofwenhamn
Copy link
Contributor Author

I'm at a loss, if I don't have a eureka moment when working on this next I think I will comment out the test in question:

Messages: Request: GET /issues?type=created_by&repos=[0]&sort=&state=closed
--
247 | testlogger.go:57: 2019/05/15 06:47:22 ...ers/routes/routes.go:108:func1() [I] Completed GET /issues?type=created_by&repos=[0]&sort=&state=closed 404 Not Found in 2.919792ms

Since there are a number of tests in the same document that are commented out, with reason listed as basically "these 404 when they should be fine", it doesn't seem like something that is unheard of. If the rest of the build runs fine, we can take a stance on the test in question, unless someone can think of what might be wrong - functionality is now as expected and desired.

  • Clicking "All" shows issues from all repos
  • Clicking repos in the sidebar list makes them highlighted in the list and makes only issues from selected repos visible
  • Clicking a selected repo makes it unselected
  • Repo selection persists through selection of different created_by and through pagination changes

Oscar Löfwenhamn added 3 commits May 20, 2019 14:47
This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out
Last attempt, if more tests crash I will uncomment the urls and request assistance.
@oscarlofwenhamn
Copy link
Contributor Author

It seems like the issue is the combination of issues and created_by (since the pull request tests work), i.e.

// "/issues?type=created_by&repos=[0]&sort=&state=closed",
// "/issues?type=created_by&repos=[0]&sort=&state=open",

If anyone has any suggestions I would really appreciate a hand, currently I'm out of ideas.

@oscarlofwenhamn oscarlofwenhamn changed the title [WIP] Make multiple repositories selectable @ issues/PR page Make multiple repositories selectable @ issues/PR page May 21, 2019
@zeripath
Copy link
Contributor

Hmm commenting out tests with the message "these should be fine but they're not" means that things are not fine at all...

Ok you've got my attention.

Look at a single URL that doesn't work and trace it back through.

@zeripath
Copy link
Contributor

Your 404 is probably coming from here:

https://github.com/oscarlofwenhamn/gitea/blob/3fc7bb176040001a8788034c111cefb6d684db02/routers/user/home.go#L329

Which implies that the testing user does not have permission to read the issues of that's repository.

Does that make sense at all?

@zeripath
Copy link
Contributor

Now probably I'd say that if you can't read a repository you should drop those issues from the list and from the totals found but I would have to look properly at this.

It might be better to only search in repositories that the user has access to but you'd have to look at which is more efficient.

@oscarlofwenhamn oscarlofwenhamn changed the title Make multiple repositories selectable @ issues/PR page [WIP] Make multiple repositories selectable @ issues/PR page May 23, 2019
@oscarlofwenhamn
Copy link
Contributor Author

oscarlofwenhamn commented May 23, 2019

@zeripath Thanks, that gives me some new points to mix my thought loop up. I feel like I've been staring myself blind at it a bit, so it's good to get a second look.

I am suspecting the same source of the 404 (tampering with that chunk was what made the one previous test succeed despite not working in practice), so I'll make some new attempts at what you're suggesting.

Also

Does that make sense at all?

Yes, very much so!

oscarlofwenhamn and others added 4 commits May 27, 2019 08:24
* Re-enable tests
* Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage
* Remove unnecessary (with multi-selection enable) code
@techknowlogick techknowlogick modified the milestones: 1.9.0, 1.10.0 Jun 17, 2019
@oscarlofwenhamn
Copy link
Contributor Author

I'm currently not able to keep working on this for a while, so I'm thinking it can be moved to 1.x.x for now. If someone feels like picking it up, they'd be welcome to do so.

@lunny lunny modified the milestones: 1.10.0, 1.11.0 Sep 15, 2019
@6543
Copy link
Member

6543 commented Oct 30, 2019

@lunny #8741 continue this so we can close this PR

@lunny lunny closed this Oct 30, 2019
@lunny lunny removed this from the 1.11.0 milestone Oct 30, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature proposal] Multiple repositories selectable @ issues/PR page
9 participants