Commit graph

19 commits

Author SHA1 Message Date
mhasbini
6e6da4bbcc Optimize labels finder query
Optimize labels finder query when searching for a project with a group
2017-03-27 00:43:35 +03:00
Robert Speicher
c44474150c Limit labels returned for a specific project as an administrator
Prior, an administrator viewing a project's Labels page would see _all_
labels from every project they had access to, rather than only the
labels of that specific project (if any).

This was not an information disclosure, as admins have access to
everything, but it was a performance issue.
2016-11-16 15:04:51 +02:00
Adam Niedzielski
e2c603696a Pass user instance to Labels::FindOrCreateService or skip_authorization: true
Do not pass project.owner because it may return a group and Labels::FindOrCreateService
throws an error in this case.
Fixes #23694.
2016-10-28 11:31:45 +02:00
Stan Hu
279ffe7bff Merge branch 'sh-optimize-label-finder' into 'master'
Reduce overhead of LabelFinder by avoiding #presence call

Some users experienced 502 timeouts when viewing group labels.
Labels#open_issues_count and Label#open_merge_requests_count were
taking a long time to load because they were loading every ActiveRecord
of the user-accessible projects into memory. This change modifies so
that only the IDs are loaded into memory.

Closes #23684

See merge request !7094
2016-10-25 15:55:59 +00:00
Stan Hu
ed47f4a308 Reduce overhead of LabelFinder by avoiding #presence call
Some users experienced 502 timeouts when viewing group labels.
Labels#open_issues_count and Label#open_merge_requests_count were
taking a long time to load because they were loading every ActiveRecord
of the user-accessible projects into memory. This change modifies the system
so that #presence and hence to_a isn't called.

Closes #23684
2016-10-25 06:52:44 -07:00
Stan Hu
02f835c105 Improve readability and add specs for label filtering 2016-10-24 23:06:14 -07:00
Stan Hu
ce256c28f2 Improve label filtering implementation 2016-10-24 22:40:09 -07:00
Stan Hu
af4d16d9b8 Allow the use of params[:name] when filtering labels 2016-10-24 22:40:09 -07:00
Stan Hu
ddafea060d Fix bug where labels would be assigned to issues that were moved
If you attempt to move an issue from one project to another and leave
labels blank, LabelsFinder would assign all labels in the new project
to that issue. The issue is that :title is passed along to the Finder,
but since it appears empty no filtering is done. As a result, all
labels in the group are returned. This fix handles that case.

Closes #23668
2016-10-24 22:40:08 -07:00
Douglas Barbosa Alexandre
e6957a6b47 Remove order by label type on LabelsFinder 2016-10-19 14:58:28 -02:00
Douglas Barbosa Alexandre
a9938e227b Add support to group labels to SlashCommands::InterpretService 2016-10-19 14:58:27 -02:00
Douglas Barbosa Alexandre
d3b76e832f Reuse LabelsFinder on Banzai::Filter::LabelReferenceFilter 2016-10-19 14:58:27 -02:00
Douglas Barbosa Alexandre
1e5ea6e7e0 Return only labels that user have access on IssuableFinder#labels 2016-10-19 14:58:27 -02:00
Douglas Barbosa Alexandre
da9407927b Remove unnecessary title.present? on LabelsFinder 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre
3db2261005 Reuse LabelsFinder on Banzai::Filter::LabelReferenceFilter 2016-10-19 14:58:25 -02:00
Douglas Barbosa Alexandre
e2dd75c0a2 Makes the query to retrieve group labels more simpler 2016-10-19 14:58:24 -02:00
Douglas Barbosa Alexandre
b10e5764ac List only labels that belongs to the group on the group issues page 2016-10-19 14:58:24 -02:00
Douglas Barbosa Alexandre
cf14482a5a LabelsFinder inherits from UnionFinder 2016-10-19 14:58:24 -02:00
Douglas Barbosa Alexandre
d5a595b597 Add LabelsFinder 2016-10-19 14:57:15 -02:00