Commit Graph

104 Commits

Author SHA1 Message Date
GitLab Bot 283fb71e02 Add latest changes from gitlab-org/gitlab@master 2020-07-17 15:09:13 +00:00
GitLab Bot 4a14cfd195 Add latest changes from gitlab-org/gitlab@master 2020-07-09 15:08:59 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot 0d83264a7a Add latest changes from gitlab-org/gitlab@master 2020-04-15 15:09:17 +00:00
GitLab Bot 32fd4cd5e2 Add latest changes from gitlab-org/gitlab@master 2020-02-25 21:09:23 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot 6d59e98918 Add latest changes from gitlab-org/gitlab@master 2019-10-18 18:06:21 +00:00
Markus Koller f1926b321d
Add controller concern for paginated collections
We had similar code in a few places to redirect to the last page if
the given page number is out of range. This unifies the handling in a
new controller concern and adds usage of it in all snippet listings.
2019-09-10 15:24:29 +02:00
Markus Koller 60755fbc40
Optimize queries for snippet listings
- Avoid N+1 queries for authors and comment counts
- Avoid an additional snippet existence query
2019-09-10 15:24:28 +02:00
George Koltsov 8bcc47ac02 Add SortingPreference concern
Sorting preference functionality has been extracted
from `IssuableCollections` to a new `SortingPreference`
concern in order to reuse this functionality in projects
(and groups in the future).
2019-08-21 10:13:45 +00:00
Alejandro Rodríguez 585fcfb9e7 Fix undefined variable error on json project views
This mistake seems to have always been there, but it only resulted in
errors on the `/explore*.json` since they were the one that _actually_
relied on the local variables.
2019-03-18 21:27:28 -03:00
Riccardo Padovani bd7ba9c59b Fix `star` action in the `explore` subpages 2019-01-28 10:45:49 +00:00
George Tsiolis 23f0020be0 Move ProjectsFinder into the controller 2019-01-15 20:07:19 +02:00
Gabriel Mazetto d81c646014 Eager-load relations for Explore::ProjectsController
This removes remaining N+1 queries
2018-12-10 17:35:09 +01:00
gfyoung be42c05054 Enable more frozen string in app/controllers/
Enables frozen string for the following:

* app/controllers/dashboard/**/*.rb
* app/controllers/explore/**/*.rb
* app/controllers/google_api/**/*.rb
* app/controllers/groups/**/*.rb
* app/controllers/import/**/*.rb
* app/controllers/instance_statistics/**/*.rb
* app/controllers/ldap/**/*.rb
* app/controllers/oauth/**/*.rb
* app/controllers/profiles/**/*.rb

Partially addresses #47424.
2018-09-23 12:48:02 -07:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Mike Greiling 2c569be63b Resolve "Display member role per project" 2017-12-07 09:11:41 +00:00
Bob Van Landuyt 3a4dc55f29 Reuse the groups tree for explore and dashboard. 2017-10-04 22:49:41 +02:00
Yorick Peterse c1f9403e45
Use Prev/Next pagination for exploring projects
This changes the pagination of the "Explore" pages so they use a simpler
pagination system that only shows "Prev" and "Next" buttons. This
removes the need for getting the total number of rows to display, a
process that can easily take up to 2 seconds when browsing through a
large list of projects.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/27390
2017-08-14 13:53:42 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Douwe Maan ea4eb46047 Merge branch 'tc-fix-private-subgroups-shown' into 'security'
Use GroupsFinder to find subgroups the user has access to

See merge request !2096
2017-05-10 16:48:18 +02:00
Douwe Maan ad309f5d11 Merge branch 'snippets-finder-visibility' into 'security'
Refactor snippets finder & dont return internal snippets for external users

See merge request !2094
2017-05-10 16:48:18 +02:00
Jacopo b996a82ff4 ProjectsFinder should handle more options
Extended ProjectFinder in order to handle the following options:
 - current_user - which user use
 - project_ids_relation: int[] - project ids to use
 - params:
   -  trending: boolean
   -  non_public: boolean
   -  starred: boolean
   -  sort: string
   -  visibility_level: int
   -  tags: string[]
   -  personal: boolean
   -  search: string
   -  non_archived: boolean

GroupProjectsFinder now inherits from ProjectsFinder.
Changed the code in order to use the new available options.
2017-04-06 07:11:37 +02:00
Bob Van Landuyt 901e70fba1 Eager load route & namespace in `Explore::ProjectsController` 2017-03-16 12:31:27 +01:00
Dmitriy Zaporozhets b7c30cae4e
Add filter and sorting to dashboard groups page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-03-01 15:39:59 +02:00
Robert Speicher 191bcb4d1b Don't perform Devise trackable updates on blocked User records 2017-02-10 11:51:14 -05:00
Eric Eastwood 6fbf24af27 Fix /explore sorting (trending)
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27044
2017-01-26 12:01:06 -06:00
Yorick Peterse 237c8f66e6
Precalculate trending projects
This commit introduces a Sidekiq worker that precalculates the list of
trending projects on a daily basis. The resulting set is stored in a
database table that is then queried by Project.trending.

This setup means that Unicorn workers no longer _may_ have to calculate
the list of trending projects. Furthermore it supports filtering without
any complex caching mechanisms.

The data in the "trending_projects" table is inserted in the same order
as the project ranking. This means that getting the projects in the
correct order is simply a matter of:

    SELECT projects.*
    FROM projects
    INNER JOIN trending_projects ON trending_projects.project_id = projects.id
    ORDER BY trending_projects.id ASC;

Such a query will only take a few milliseconds at most (as measured on
GitLab.com), opposed to a few seconds for the query used for calculating
the project ranks.

The migration in this commit does not require downtime and takes care of
populating an initial list of trending projects.
2016-10-10 12:27:08 +02:00
Yorick Peterse 154253cab5
Refactor TrendingProjectsFinder to support caching
== Public Projects

This finder class now _only_ returns public projects. Previously this
finder would also return private and internal projects. Including these
projects makes caching data much harder and less efficient. Meanwhile
including this data isn't very useful as very few users would be
interested in seeing projects they have access to as trending. That is,
the feature is more useful when you want to see what _other_ popular
projects there are.

== Caching

The data returned by TrendingProjectsFinder is now cached for a day
based on the number of months the data should be restricted to. The
cache is not flushed explicitly, instead it's rebuilt whenever it
expires.

== Timings

To measure the impact I changed the finder code to use the last 24
months instead of the last month. I then executed and measured 10
requests to the explore page. On the current "master" branch (commit
88fa5916ff) this would take an average of
2.43 seconds. Using the changes of this commit this was reduced to
around 1.7 seconds.

Fixes gitlab-org/gitlab-ce#22164
2016-10-05 16:39:03 +02:00
Connor Shea b1c9475443
Replace reject_blocked with reject_blocked! in callbacks.
In Rails 4.2 and below, skipping callbacks (skip_before_action, skip_after_action, etc.) that use methods which do not exist will not throw any errors.

On the other hand, Rails 5 does. See https://github.com/rails/rails/pull/19029

After testing with Rails 5 I noticed there are some methods that don't actually exist (because they were renamed, usually), this fixes a few instances of those.

reject_blocked! was introduced in c9def945d4, I can't find any references to reject_blocked ever existing.
2016-07-27 13:56:30 -06:00
Douwe Maan ae7b2ef62c Merge branch 'master' into issue_12658
# Conflicts:
#	app/models/issue.rb
#	app/views/projects/_home_panel.html.haml
#	app/views/shared/projects/_project.html.haml
#	db/schema.rb
#	spec/models/project_spec.rb
2016-03-21 23:22:21 +01:00
Robert Speicher 085538c2bd Use the configured Kaminari "per page" default 2016-03-19 17:37:54 -04:00
Felipe Artur 44c127447b Merge 4009-external-users into issue_12658 2016-03-16 20:16:42 -03:00
Felipe Artur f2a9ee258e Add permission level to groups 2016-03-10 10:38:36 -03:00
Josh Frye 449954ecc2 Allow filtered dashboard/explore results to be paged. Fixes #14104 2016-03-09 21:03:28 -05:00
Dmitriy Zaporozhets acb211215c Add option to show archived projects on dahsboard
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-03-04 19:25:28 +01:00
Josh Frye 120dca0f35 MR feedback 2016-02-09 10:10:41 -05:00
Josh Frye 8b4e9720d9 Extract events rendering to own action. 2016-02-09 10:10:41 -05:00
Josh Frye 30e022a2fe Starred, All, and Trending on explore are paged also group projects. Need ajax filter. 2016-02-09 10:10:41 -05:00
Josh Frye 3f1bd844f1 Implement changes from MR feedback 2016-02-04 14:02:19 -05:00
Josh Frye 2ad094132d Various filter fixes 2016-02-04 13:03:41 -05:00
Josh Frye 7522ac0b3c Paginate + ajax filter dashboard projects 2016-02-04 11:40:19 -05:00
Valery Sizov 8b18449125 remove public field from namespace and refactoring 2016-01-04 16:00:29 +02:00
Douwe Maan 5d785457db Clean up overlap between dashboard and explore.
- Split up SnippetsController into separate dashboard and explore sections.
- Use consistent page titles, header titles and sidebars between dashboard and explore sections when signed in or not.
2015-09-08 14:49:20 +01:00
Artem Sidorenko 3ebbed25f0 Allow listing of archived projects
Resolves #9285
2015-08-19 13:46:59 +02:00
Douwe Maan 92fd3ccee0 Add helpers for header title and sidebar, and move setting those from controllers to layouts. 2015-05-01 10:39:16 +02:00
Douwe Maan 26ad250989 Add a page title to every page. 2015-04-30 19:12:15 +02:00
Jeroen van Baarsen 5a4ebfb47a Fixed the Rails/ActionFilter cop
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-04-20 15:39:37 +02:00
Dmitriy Zaporozhets f0cbbd70bb Use same constant for amount of items per page 2015-03-12 15:37:00 -07:00
Dmitriy Zaporozhets 83f7e98d9a Add project filter by visibility and tag to explore page 2015-03-10 15:59:14 -07:00
Dmitriy Zaporozhets 86d5e20664 Respect star ordering on explore page 2015-02-18 16:40:22 -08:00
Ciro Santilli b66a152735 Factor abilities methods
in app controller, user model and services.
2014-10-19 11:12:39 +02:00
Dmitriy Zaporozhets 974b5a7b2f
Most starred projects page for Explore area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-25 22:05:23 +03:00
Dmitriy Zaporozhets 367445fdcd
Refactor explore area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-23 12:03:49 +03:00