Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-05-04Allow a user to accept/decline termsBob Van Landuyt
When a user accepts, we store this in the agreements to keep track of which terms they accepted. We also update the flag on the user.
2018-04-28[Rails5] Fix `params` for DeleteUserWorkerblackst0ne
This commit fixes the error: ``` 1) Admin::UsersController DELETE #user with projects deletes the user and their contributions when hard delete is specified Failure/Error: Users::DestroyService.new(current_user).execute(delete_user, options.symbolize_keys) NoMethodError: undefined method `symbolize_keys' for "{\"hard_delete\"=>\"true\"}":String # ./app/workers/delete_user_worker.rb:8:in `perform' # ./lib/gitlab/sidekiq_status/server_middleware.rb:5:in `call' # ./config/initializers/forbid_sidekiq_in_transactions.rb:35:in `block (2 levels) in <module:NoEnqueueingFromTransactions>' # ./app/models/user.rb:913:in `delete_async' # ./app/controllers/admin/users_controller.rb:148:in `destroy' # ./lib/gitlab/i18n.rb:50:in `with_locale' # ./lib/gitlab/i18n.rb:56:in `with_user_locale' # ./app/controllers/application_controller.rb:327:in `set_locale' # ./spec/controllers/admin/users_controller_spec.rb:28:in `block (3 levels) in <top (required)>' Finished in 6.81 seconds (files took 13.9 seconds to load) 1 example, 1 failure ```
2018-04-19Merge branch 'blackst0ne-rails5-update-user-manageable-groups' into 'master'Yorick Peterse
[Rails5] Fix `User#manageable_groups` See merge request gitlab-org/gitlab-ce!18330
2018-04-19[Rails5] Fix `User#manageable_groups`blackst0ne
In `arel 7.0` (`7.1.4` version is used for rails5) there were introduced some changes that break our code in the `User#manageable_groups` method. The problem is that `arel_table[:id].in(Arel::Nodes::SqlLiteral)` generates wrong `IN ()` construction. The selection for `IN` is missing: => "\"namespaces\".\"id\" IN (0)" That caused such spec errors for the `rails5` branch: ``` 4) User groups with child groups #manageable_groups does not include duplicates if a membership was added for the subgroup Failure/Error: expect(user.manageable_groups).to contain_exactly(group, subgroup) expected collection contained: [#<Group id:232 @group29>, #<Group id:234 @group29/group30>] actual collection contained: [] the missing elements were: [#<Group id:232 @group29>, #<Group id:234 @group29/group30>] # ./spec/models/user_spec.rb:699:in `block (5 levels) in <top (required)>' # ./spec/spec_helper.rb:188:in `block (2 levels) in <top (required)>' # /var/lib/gems/2.3.0/gems/rspec-retry-0.4.6/lib/rspec/retry.rb:112:in `block in run' # /var/lib/gems/2.3.0/gems/rspec-retry-0.4.6/lib/rspec/retry.rb:101:in `loop' # /var/lib/gems/2.3.0/gems/rspec-retry-0.4.6/lib/rspec/retry.rb:101:in `run' # /var/lib/gems/2.3.0/gems/rspec-retry-0.4.6/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry' # /var/lib/gems/2.3.0/gems/rspec-retry-0.4.6/lib/rspec/retry.rb:30:in `block (2 levels) in setup' ``` This commit changes `User#manageable_groups` in the way to drop the usage of `Arel::Nodes::SqlLiteral` and adds usage of raw SQL query. This change should be updated when we're migrated to Rails 5.2 because arel was fixed in `9.0.0` (which is used in Rails 5.2).
2018-04-18Revert the addition of goldiloaderYorick Peterse
This reverts the addition of the "goldiloader" Gem and all use of it. While this Gem is very promising it's causing a variety of problems on GitLab.com due to it eager-loading too much data in places where we don't expect/can handle this. At least for the time being this means we have to go back to manually fixing N+1 query problems, but at least those should not cause a negative impact on availability.
2018-04-09Merge branch ↵Yorick Peterse
'fix-n-plus-one-when-getting-notification-settings-for-recipients' into 'master' Use Goldiloader for handling N+1 queries See merge request gitlab-org/gitlab-ce!18217
2018-04-09Add cop for has_many :through without disabled autoloadingSean McGivern
Goldiloader is great, but has several issues with has_many :through relations: * https://github.com/salsify/goldiloader/issues/12 * https://github.com/salsify/goldiloader/issues/14 * https://github.com/salsify/goldiloader/issues/18 Rather than try to figure out which applies in each case, we should just do the drudge work of manually disabling autoloading for all relations of this type. We can always use regular preloading for specific cases, but this way we avoid generating invalid queries through Goldiloader's magic.
2018-04-09Use Goldiloader for handling N+1 queriesYorick Peterse
Goldiloader (https://github.com/salsify/goldiloader) can eager load associations automatically. This removes the need for adding "includes" calls in a variety of different places. This also comes with the added benefit of not having to eager load data if it's not used.
2018-04-09Remove unused User#manageable_group_projects (#41981)Dylan Griffith
2018-04-09Use project_authorizations instead of members to calculate manageable CI ↵Dylan Griffith
projects to speed up query (#41981)
2018-04-09Allow group owner to enable runners from subgroups (#41981)Dylan Griffith
2018-04-06Remove unused method.Andreas Brandl
2018-04-06Cache personal projects count.Andreas Brandl
Closes #37462.
2018-04-05Deleting a MR you are assigned to should decrements counterm b
The merge request counter in the UI was not decreasing when a merge request was deleting. This was just due to the cache not being refreshed on a delete action. fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/44458
2018-04-05Ensure internal users (ghost, support bot) get assigned a namespaceDouwe Maan
2018-04-04[Rails5] Rename `sort` methods to `sort_by_attribute`blackst0ne
2018-03-29Merge branch 'dm-deploy-keys-default-user' into 'master'Sean McGivern
Ensure hooks run when a deploy key without a user pushes Closes #44317 See merge request gitlab-org/gitlab-ce!18057
2018-03-28Don’t delete deploy key when user who created it is deletedDouwe Maan
2018-03-27'Assigned Issues' and 'Assigned Merge Requests' as dashboard user choicesElias Werberich
2018-03-26Improves User#owned_projects query performanceTiago Botelho
2018-03-08Merge branch '40525-listing-user-activity-timeouts' into 'master'Yorick Peterse
Improve database response time for listing user activity Closes #40525 See merge request gitlab-org/gitlab-ce!17454
2018-03-08Don't delete todos or unassign issues and MRs when a user leaves a projectDouwe Maan
2018-03-07Leverage user_contributed_projects to find recent events.Andreas Brandl
Closes #40525.
2018-03-02Extract method User#authorizations_for_projects.Andreas Brandl
2018-03-01Merge branch 'feature/move_oauth_modules_to_auth_dir_structure' into 'master'Douwe Maan
Moved o_auth/saml/ldap modules under gitlab/auth See merge request gitlab-org/gitlab-ce!17359
2018-02-28Moved o_auth/saml/ldap modules under gitlab/authHoratiu Eugen Vlad
2018-02-27Merge branch '43304-simplify-filtering-non-human-users' into 'master'Yorick Peterse
Simplify filtering of non-human users. Closes #43304 See merge request gitlab-org/gitlab-ce!17288
2018-02-26Simplify filtering of non-human users (like ghosts).Andreas Brandl
Note that `ghost IS NOT TRUE` is equivalent to `ghost = 'f' OR ghost is null`: (true), (false), (NULL)) AS t (flag); flag | ?column? | ?column? ------+----------+---------- t | f | f f | t | t | t | t (3 rows) This makes it a little easier to create partial indexes for this (as only one condition is needed). Closes #43304.
2018-02-22Optimise searching for users using short queriesYorick Peterse
This optimises searching for users when using queries consisting out of one or two characters such as "ab". We optimise such cases by searching for `LOWER(name)` and `LOWER(username)` instead of using `ILIKE`. Using `LOWER` produces a _much_ better performing query. For example, when searching for all users matching the term "a" we'd produce the following plan: Limit (cost=637.69..637.74 rows=20 width=805) (actual time=41.983..41.995 rows=20 loops=1) Buffers: shared hit=8330 -> Sort (cost=637.69..638.61 rows=368 width=805) (actual time=41.982..41.990 rows=20 loops=1) Sort Key: (CASE WHEN ((name)::text = 'a'::text) THEN 0 WHEN ((username)::text = 'a'::text) THEN 1 WHEN ((email)::text = 'a'::text) THEN 2 ELSE 3 END), name Sort Method: top-N heapsort Memory: 35kB Buffers: shared hit=8330 -> Bitmap Heap Scan on users (cost=75.47..627.89 rows=368 width=805) (actual time=9.452..41.305 rows=277 loops=1) Recheck Cond: (((name)::text ~~* 'a'::text) OR ((username)::text ~~* 'a'::text) OR ((email)::text = 'a'::text)) Rows Removed by Index Recheck: 7601 Heap Blocks: exact=7636 Buffers: shared hit=8327 -> BitmapOr (cost=75.47..75.47 rows=368 width=0) (actual time=8.290..8.290 rows=0 loops=1) Buffers: shared hit=691 -> Bitmap Index Scan on index_users_on_name_trigram (cost=0.00..38.85 rows=180 width=0) (actual time=4.369..4.369 rows=4071 loops=1) Index Cond: ((name)::text ~~* 'a'::text) Buffers: shared hit=360 -> Bitmap Index Scan on index_users_on_username_trigram (cost=0.00..34.41 rows=188 width=0) (actual time=3.896..3.896 rows=4140 loops=1) Index Cond: ((username)::text ~~* 'a'::text) Buffers: shared hit=328 -> Bitmap Index Scan on users_email_key (cost=0.00..1.94 rows=1 width=0) (actual time=0.022..0.022 rows=0 loops=1) Index Cond: ((email)::text = 'a'::text) Buffers: shared hit=3 Planning time: 3.912 ms Execution time: 42.171 ms With the changes in this commit we now produce the following plan instead: Limit (cost=13257.48..13257.53 rows=20 width=805) (actual time=1.567..1.579 rows=20 loops=1) Buffers: shared hit=287 -> Sort (cost=13257.48..13280.93 rows=9379 width=805) (actual time=1.567..1.572 rows=20 loops=1) Sort Key: (CASE WHEN ((name)::text = 'a'::text) THEN 0 WHEN ((username)::text = 'a'::text) THEN 1 WHEN ((email)::text = 'a'::text) THEN 2 ELSE 3 END), name Sort Method: top-N heapsort Memory: 35kB Buffers: shared hit=287 -> Bitmap Heap Scan on users (cost=135.66..13007.91 rows=9379 width=805) (actual time=0.194..1.107 rows=277 loops=1) Recheck Cond: ((lower((name)::text) = 'a'::text) OR (lower((username)::text) = 'a'::text) OR ((email)::text = 'a'::text)) Heap Blocks: exact=277 Buffers: shared hit=287 -> BitmapOr (cost=135.66..135.66 rows=9379 width=0) (actual time=0.152..0.152 rows=0 loops=1) Buffers: shared hit=10 -> Bitmap Index Scan on yorick_test_users (cost=0.00..124.75 rows=9377 width=0) (actual time=0.101..0.101 rows=277 loops=1) Index Cond: (lower((name)::text) = 'a'::text) Buffers: shared hit=4 -> Bitmap Index Scan on index_on_users_lower_username (cost=0.00..1.94 rows=1 width=0) (actual time=0.035..0.035 rows=1 loops=1) Index Cond: (lower((username)::text) = 'a'::text) Buffers: shared hit=3 -> Bitmap Index Scan on users_email_key (cost=0.00..1.94 rows=1 width=0) (actual time=0.014..0.014 rows=0 loops=1) Index Cond: ((email)::text = 'a'::text) Buffers: shared hit=3 Planning time: 0.303 ms Execution time: 1.687 ms Here we can see the new query is 25 times faster compared to the old query.
2018-02-18Don't attempt to update user tracked fields if database is in read-onlyStan Hu
With Geo, attempting to view an endpoint with a user could result in an Error 500 since Devise attempts to update the last sign-in IP and other details. Closes gitlab-org/gitlab-ee#4972
2018-02-13Strip whitespace from username/login value for user lookupPeter Lauck
As per the discussion with @psimyn, this change does not affect the frontend, so user input will not be validated on the signin screen. Instead, the value sent to the backend has leading and trailing whitespace stripped before looking up the user with find_by. Closes #42637
2018-02-08Merge branch 'feature/oidc-groups-claim' into 'master'Douwe Maan
Add groups to OpenID Connect claims See merge request gitlab-org/gitlab-ce!16929
2018-02-08Add groups to OpenID Connect claimsHassan Zamani
2018-02-06Validate User username only on Namespace, and bubble up appropriatelyDouwe Maan
2018-02-06Validate path uniqueness only on Route, and bubble up appropriatelyDouwe Maan
2018-02-06Validate user namespace before saving so that errors persist on modelDouwe Maan
2018-02-06Merge branch '26468-fix-admin-recent-sign-in' into 'master'Rémy Coutable
Using correct column for sorting users by Recent Sign-in Closes #26468 See merge request gitlab-org/gitlab-ce!13852
2018-02-05Using correct column for sorting users by Recent Sign-inPoornima
Removing last_sign_in_at in specs
2018-02-05Add foreign keys to todos table.Andreas Brandl
Fixes #32282.
2018-02-03Merge branch 'master' into persistent-calloutsMatija Čupić
2018-02-03Rename Callout to UserCalloutMatija Čupić
2018-02-02use Gitlab::UserSettings directly as a singleton instead of ↵Mario de la Ossa
including/extending it
2018-02-01port of 594e6a0a625^..f74c90f68c6Micaël Bergeron
2018-01-31Enable RuboCop Style/RegexpLiteralTakuya Noguchi
2018-01-27Add Callout modelMatija Čupić
2018-01-21Yield no results for blank searches on User name, username and emailMark Fletcher
Given no search term, the `search` and `search_with_secondary_emails` methods will yield an empty result set
2018-01-15Log and send a system hook if a blocked user fails to loginStan Hu
Closes #41633
2018-01-04Merge branch 'mdelaossa/gitlab-ce-31995-project-limit-default-fix'Dmitriy Zaporozhets
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-01-02Fix user membership destroy relationFrancisco Javier López
2017-12-30User#projects_limit remove DB default and added NOT NULL constraintMario de la Ossa
This change is required because otherwise if a user is created with a value for `projects_limit` that matches the DB default, it gets overwritten by `current_application_settings.default_projects_limit`. By removing the default we once again can allow a user to be created with a limit of 10 projects without the risk that it'll change to 10000