Commit Graph

85 Commits

Author SHA1 Message Date
GitLab Bot 3744bcc0d1 Add latest changes from gitlab-org/gitlab@master 2019-10-09 09:06:19 +00:00
Luke Duncalfe a0b14c40dc CE-specific changes for designs `user_notes_count`
Notes call `#after_note_created` and `#after_note_destroyed` on their
noteable in callbacks, so the noteable can perform tasks particular to
them, like cache expiry.

This is in preparation of the EE-specific class
`DesignManagement::Design` clearing its `user_notes_count` cache when
its note are created or destroyed.

Refactoring Rspec behaviour testing of a counter caching service into a
shared example.

https://gitlab.com/gitlab-org/gitlab-ee/issues/13353
2019-08-27 20:50:26 +00:00
Heinrich Lee Yu 1ce5bcacdb Remove code related to object hierarchy in MySQL
These are not required because MySQL is not
supported anymore
2019-07-25 15:35:06 +08:00
Ezekiel Kigbo 3ad6653b3e Added user time settings fields to profile
Udpated user_edit_profile_spec with time preferences

Minor update form fields
2019-05-07 21:58:16 +00:00
Jasper Maes 624a1cdab4 Upgrade Rails to 5.1.6.1
Model.new.attributes now also returns encrypted attributes.
2019-04-23 08:31:23 +08:00
Michael Kozono 3b97ea0a0c Merge branch 'frozen_string_literal_spec_services' into 'master'
Add frozen_string_literal to spec/services

See merge request gitlab-org/gitlab-ce!27267
2019-04-12 16:41:27 +00:00
Cindy Pallares 65b4b0cf46
Fix typo in activity lease 2019-04-11 17:38:28 -05:00
Thong Kuah 85b29c1c2f Add frozen_string_literal to spec/services
Probably useful as we often move these files to "new" files.
2019-04-12 10:14:54 +12:00
Oswaldo Ferreira ca884980ee [CE] Support multiple assignees for merge requests
Backports https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10161
(code out of ee/ folder).
2019-04-08 18:40:00 -03:00
Imre Farkas a0e97b1c6a
Optimize Redis usage in User::ActivityService
Avoid checking Redis when User#last_activity_on is already up to date.
2019-02-14 11:14:00 +01:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Takuya Noguchi e902f462c2 Eliminate duplicated words
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2018-11-22 01:01:23 +09:00
Rémy Coutable 47dd7d0bbe
Use gitlab-default_value_with Rails 5
This forks live at https://github.com/gitlabhq/default_value_for/tree/69-fix-action_controller-parameters-handling
and fixes an issue where default_value_for wouldn't handle
`ActionController::Parameters` correctly with Rails 5.

This fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/54093.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-11-15 16:44:22 +01:00
Rémy Coutable 1f0502df0a
Fix a bug where internal email pattern wasn't respected
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-11-13 13:24:53 +01:00
Alexis Reigel 801fe04be7
allow users api to set public_email 2018-10-01 13:24:16 +02:00
Alexis Reigel f38aa2bf30
add missing allowed attributes 2018-10-01 13:24:16 +02:00
Roger Rüttimann 93b9bfd93a Allow whitelisting for "external collaborator by default" setting 2018-08-30 12:53:06 +00:00
Valery Sizov fbf618fc38 Fix: Project deletion may not log audit events during user deletion 2018-08-17 12:23:27 +03:00
Robert Speicher 7da6ac0644 Merge branch 'sh-fix-failing-deploy-token-clones' into 'master'
Fix failing 500 errors when deploy tokens are used to clone

Closes gitlab-ee#7080

See merge request gitlab-org/gitlab-ce!20993
2018-08-02 21:00:13 +00:00
Stan Hu 1436423a49 Fix failing 500 errors when deploy tokens are used to clone
A DeployToken responds to `:username`, but it returns the username for the
token, not a User object. Don't attempt to log user activity in this case.

Closes gitlab-org/gitlab-ee#7080
2018-08-02 11:18:31 -07:00
Bob Van Landuyt b4c4b48a8c Allow users to set a status
This can be done trough the API for the current user, or on the
profile page.
2018-07-30 15:01:26 +02:00
blackst0ne ddd2a25679 Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs'
`perform_enqueued_jobs` is a Sidekiq method.
Using this method violates the Dependency inversion principle[0].

This commit replaces `perform_enqueued_jobs` with ActiveJob's abstract
method `perform_enqueued_jobs` in specs.

[0]: https://en.wikipedia.org/wiki/Dependency_inversion_principle
2018-07-23 15:34:54 +11:00
Imre Farkas c62fce9883
Delete UserActivities and related workers 2018-07-18 15:44:10 +02:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Douglas Barbosa Alexandre 34dbccb24b
Add helper methods to stub Gitlab::ExclusiveLease 2018-06-28 19:24:40 -03:00
Lin Jen-Shin 5de2035c47 Use expect_next_instance_of to replace expect_any_instance_of 2018-06-21 23:02:36 +08:00
Bob Van Landuyt 10aa55a770 Allow a user to accept/decline terms
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-05-04 13:54:43 +02:00
Zeger-Jan van de Weg ec4423665c
Gitlab::Shell works on shard name, not path
Direct disk access is done through Gitaly now, so the legacy path was
deprecated. This path was used in Gitlab::Shell however. This required
the refactoring in this commit.

Added is the removal of direct path access on the project model, as that
lookup wasn't needed anymore is most cases.

Closes https://gitlab.com/gitlab-org/gitaly/issues/1111
2018-04-25 13:36:22 +02:00
Nick Thomas 6b0c6e69e1
Use hashed storage in the specs 2018-02-07 13:40:46 +00:00
Douwe Maan 75144b1e03 Validate path uniqueness only on Route, and bubble up appropriately 2018-02-06 12:06:38 -06:00
Yorick Peterse d0b8f536a1
Remove soft removals related code
This removes all usage of soft removals except for the "pending delete"
system implemented for projects. This in turn simplifies all the query
plans of the models that used soft removals. Since we don't really use
soft removals for anything useful there's no point in keeping it around.

This _does_ mean that hard removals of issues (which only admins can do
if I'm not mistaken) can influence the "iid" values, but that code is
broken to begin with. More on this (and how to fix it) can be found in
https://gitlab.com/gitlab-org/gitlab-ce/issues/31114.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37447
2018-01-08 17:04:45 +01:00
Francisco Javier López 2665aea627 Fix user membership destroy relation 2018-01-02 15:06:44 +00:00
Brett Walker bcbe5672ec small change to make less conflict with EE version 2017-12-11 16:45:06 +00:00
Yorick Peterse 3e561736b2
Cache the number of user SSH keys
By caching the number of personal SSH keys we reduce the number of
queries necessary on pages such as ProjectsController#show (which can
end up querying this data multiple times).

The cache is refreshed/flushed whenever an SSH key is added, removed, or
when a user is removed.
2017-11-16 14:59:38 +01:00
Bob Van Landuyt 6f5ebc4bae Only cache the event for the fork-source when it exists
It is possible for a fork not to have a source anymore, in this case
we don't need to keep track of the push event.
2017-10-22 20:24:47 +03:00
Toon Claes d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00
James Lopez 67d06dee30 refactor users update service 2017-09-28 08:46:39 +02:00
James Lopez f2e9ef1027 fix specs 2017-09-28 08:46:39 +02:00
Yorick Peterse 83355336dd
Rework how recent push events are retrieved
Whenever you push to a branch GitLab will show a button to create a
merge request (should one not exist already). The underlying code to
display this data was quite inefficient. For example, it involved
multiple slow queries just to figure out what the most recent push event
was.

This commit changes the way this data is retrieved so it's much faster.
This is achieved by caching the ID of the last push event on every push,
which is then retrieved when loading certain pages. Database queries are
only executed if necessary and the cached data is removed automatically
once a merge request has been created, or 2 hours after being stored.

A trade-off of this approach is that we _only_ track the last event.
Previously if you were to push to branch A and B then create a merge
request for branch B we'd still show the widget for branch A. As of this
commit this is no longer the case, instead we will only show the widget
for the branch you pushed to most recently. Once a merge request exists
the widget is no longer displayed. Alternative solutions are either too
complex and/or too slow, hence the decision was made to settle for this
trade-off.

Performance Impact
------------------

In the best case scenario (= a user didn't push anything for more than 2
hours) we perform a single Redis GET per page. Should there be cached
data we will run a single (and lightweight) SQL query to get the
event data from the database. If a merge request already exists we will
run an additional DEL to remove the cache key.

The difference in response timings can vary a bit per project. On
GitLab.com the 99th percentile of time spent in User#recent_push hovers
between 100 milliseconds and 1 second, while the mean hovers around 50
milliseconds. With the changes in this MR the expected time spent in
User#recent_push is expected to be reduced down to just a few
milliseconds.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/35990
2017-09-08 00:46:16 +02:00
Stan Hu e94a2fde0d Fire system hooks when a user is created via LDAP or OAuth
Closes #37073
2017-08-25 22:00:07 -07:00
Gabriel Mazetto fb9e059a41 Make sure repository's removal work for legacy and hashed storages 2017-08-22 06:33:20 +02:00
Michael Kozono bd578d96b4 Add namespace errors from User#after_update 2017-08-18 10:31:59 -07:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Jarka Kadlecova a9d940bffc Use Ghost user when edited_by, merged_by deleted 2017-07-19 11:35:17 +02:00
Paul Charlton cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
James Lopez b33c638483 update code based on feedback 2017-06-23 17:11:31 +02:00
James Lopez b804db2648 refactor update user service not to do auth checks 2017-06-23 11:41:43 +02:00
James Lopez cf6286313d added bang option to spec 2017-06-23 11:41:41 +02:00