Commit graph

29 commits

Author SHA1 Message Date
Valery Sizov
8b18449125 remove public field from namespace and refactoring 2016-01-04 16:00:29 +02:00
Yorick Peterse
fed059a12d Port GitLab EE ProjectsFinder changes
These changes were added in GitLab EE commit
d39de0ea91b26b8840195e5674b92c353cc16661. The tests were a bit bugged
(they used a non existing group, thus not testing a crucial part) which
I only noticed when porting CE changes to EE.
2015-11-20 15:53:04 +01:00
Yorick Peterse
cc11c44ba9 Align hash literals to keep Rubocop happy 2015-11-18 13:27:03 +01:00
Yorick Peterse
fbcf3bd3fc Refactor ProjectsFinder to not pluck IDs
This class now uses a UNION (when needed) instead of plucking tens of
thousands of project IDs into memory. The tests have also been
re-written to ensure all different use cases are tested properly
(assuming I didn't forget any cases).

The finder has also been broken up into 3 different finder classes:

* ContributedProjectsFinder: class for getting the projects a user
  contributed to.
* PersonalProjectsFinder: class for getting the personal projects of a
  user.
* ProjectsFinder: class for getting generic projects visible to a given
  user.

Previously a lot of the logic of these finders was handled directly in
the users controller.
2015-11-18 13:05:45 +01:00
Yorick Peterse
2110247f83 Refactoed GroupsFinder into two separate classes
In the previous setup the GroupsFinder class had two distinct tasks:

1. Finding the projects user A could see
2. Finding the projects of user A that user B could see

Task two was actually handled outside of the GroupsFinder (in the
UsersController) by restricting the returned list of groups to those the
viewed user was a member of. Moving all this logic into a single finder
proved to be far too complex and confusing, hence there are now two
finders:

* GroupsFinder: for finding groups a user can see
* JoinedGroupsFinder: for finding groups that user A is a member of,
  restricted to either public groups or groups user B can also see.
2015-11-18 13:05:45 +01:00
Yorick Peterse
b4646391ee Renamed GroupsFinder spec file so the name matches 2015-11-18 13:05:45 +01:00
Valery Sizov
6051c28fc0 Allow groups to appear in the search results if the group owner allows it 2015-11-05 13:18:51 +02:00
Dmitriy Zaporozhets
69bcef32e1 Merge remote-tracking branch 'public/trending-projects-performance' 2015-10-08 16:22:43 +02:00
Stan Hu
dfbbc80611 Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters
Closes #2619

Closes https://github.com/gitlabhq/gitlabhq/issues/9631
2015-10-07 07:21:50 -07:00
Yorick Peterse
b7abba0ca0 Revamp trending projects query
This changes the query to use a COUNT nested in an INNER JOIN, instead
of a COUNT plus a GROUP BY. There are two reasons for this:

1. Using a COUNT in an INNER JOIN can be quite a bit faster.
2. The use of a GROUP BY means that method calls such as "any?"
   (and everything else that calls "count") operate on a Hash that
   counts the amount of notes on a per project basis, instead of just
   counting the total amount of projects.

The query has been moved into Project.trending as its logic is simple
enough. As a result of this testing the TrendingProjectsFinder class
simply involves testing if the right methods are called, removing the
need for setting up database records.
2015-10-06 17:26:32 +02:00
Yorick Peterse
1f14e689e5 Added specs for TrendingProjectsFinder 2015-10-06 17:26:32 +02:00
Robert Speicher
fb6dc1f07d Add Group#add_* convenience methods
Encapsulates the logic for `Gitlab::Access::WHATEVER` levels.
2015-08-07 00:20:02 -04:00
Douwe Maan
45e4727f97 Set milestone on new issue when creating issue from index with milestone filter active. 2015-05-27 14:22:11 +02:00
Dominik Sander
e6ee8d0ebe Group milestones by title in the dashboard and all other issue views
This groups milestones by title for issue views like it has been done for
the milestone dashboard/project overview. Before milestones with the
same title would show up multiple times in the filter dropdown and one could
only filter per project and milestone. Now the milestone filter is based
on the title of the milestone, i.e. all issues marked with the same
milestone title are shown.
2015-05-01 01:12:58 +02:00
Jeroen van Baarsen
0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Dmitriy Zaporozhets
c8a96d8ab0
More tests for issues finder
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-12-05 17:25:22 +02:00
Valery Sizov
7f97a1277d internal snippets: fix exposing of title 2014-10-24 19:39:14 +03:00
Valery Sizov
47f539f5a6 Snippets: public/internal/private 2014-10-09 17:09:53 +03:00
Jacob Vosmaer
285926918b Serialize last_fetched_at as a string with seconds 2014-04-28 12:42:01 +02:00
Jacob Vosmaer
bbfa4a771a Always set last_fetched_at in NotesFinder spec 2014-04-28 12:16:34 +02:00
Jacob Vosmaer
0b615eb0e2 Filter out old notes in NotesFinder 2014-04-28 12:13:29 +02:00
Jacob Vosmaer
7339464e77 Fail faster on an invalid target_type 2014-04-28 11:55:13 +02:00
Jacob Vosmaer
e5cf5f4f98 Notes have noteables but no commits 2014-04-28 11:50:21 +02:00
Jacob Vosmaer
410790a355 Add NotesFinder spec 2014-04-28 11:48:18 +02:00
Dmitriy Zaporozhets
c31b703110
Fix tests that dont respect project-fork relation
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-03 11:47:56 +03:00
Dmitriy Zaporozhets
492dc82ced Merge pull request #6557 from tsigo/faster-merge-request-features
Speed up features/notes_on_merge_requests_spec
2014-03-19 14:45:15 +02:00
Robert Speicher
1897fb00b8 Make use of project factory traits 2014-03-19 05:15:24 -04:00
Robert Speicher
a90574fab2 Speed up finders/merge_requests_finder_spec
Uses the :simple merge request factory trait introduced by d166e70; cuts
execution time of this spec in half.
2014-03-19 03:57:38 -04:00
Dmitriy Zaporozhets
345b3d4b72
Update tests and fix Finders readme
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-25 19:21:53 +02:00