summaryrefslogtreecommitdiff
path: root/app/models/user.rb
Commit message (Collapse)AuthorAgeFilesLines
* Match users better by their private commit emailNick Thomas2018-11-191-16/+33
| | | | | | Private commit emails were introduced in !22560, but some parts of GitLab were not updated to take account of them. This commit adds support in places that were missed.
* User can keep their commit email private43521-keep-personal-emails-privateTiago Botelho2018-11-071-2/+28
| | | | | | | | The private commit email is automatically generated in the format: id-username@noreply.HOSTNAME GitLab instance admins are able to change the HOSTNAME portion, that defaults to Gitlab's hostname, to whatever they prefer.
* Merge branch 'use_tokenauthenticatable_method_for_token_lookup' into 'master'Sean McGivern2018-11-051-6/+0
|\ | | | | | | | | Remove PersonalAccessTokensFinder#find_by method See merge request gitlab-org/gitlab-ce!22617
| * Remove PersonalAccessTokensFinder#find_by methoduse_tokenauthenticatable_method_for_token_lookupImre Farkas2018-11-051-6/+0
| | | | | | | | | | | | find_by_token is overriden by TokenAuthenticatable which can be easily missed or confused with #find_by(:token) defined by ActiveRecord. First step for safer usage is to remove #find_by.
* | Use a method for the has_many :keys in Projectuser-model-merge-conflictsYorick Peterse2018-11-011-1/+1
| | | | | | | | | | | | This moves the `where` in the `has_many :keys` association in Project to the Key model. This allows EE to override this method, instead of modifying the source code directly.
* | Move LDAP sync time constant to a methodYorick Peterse2018-11-011-1/+6
|/ | | | | | This moves the `1.hour` constant used as the LDAP sync time to a separate method. This allows EE to override this method using a module, instead of directly modifying the source code.
* Merge remote-tracking branch 'origin/master' into dev-masterDJ Mountney2018-10-291-1/+1
|\
| * Replace deprecated uniq on a Relation with distinctJasper Maes2018-10-261-1/+1
| |
* | Merge branch 'fix_pat_auth-11-4' into 'security-11-4'Robert Speicher2018-10-291-1/+1
| | | | | | | | | | [11.4] Fix Token lookup for Git over HTTP and registry authentication See merge request gitlab/gitlabhq!2577
* | [master] Persist only SHA digest of PersonalAccessToken#tokenImre Farkas2018-10-291-10/+1
|/
* Resolve "Filter discussion (tab) by comments or activity in issues and merge ↵Oswaldo Ferreira2018-10-231-0/+8
| | | | requests"
* Make getting a user by the username case insensitiveWilliam George2018-10-181-1/+1
|
* Backport CE changes for Ops Dashboard in EEPeter Leitzen2018-10-121-1/+1
|
* Clean up ActiveRecord code in TodoServiceYorick Peterse2018-10-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | This refactors the TodoService class according to our code reuse guidelines. The resulting code is a wee bit more verbose, but it allows us to decouple the column names from the input, resulting in fewer changes being necessary when we change the schema. One particular noteworthy line in TodoService is the following: todos_ids = todos.update_state(state) Technically this is a violation of the guidelines, because `update_state` is a class method, which services are not supposed to use (safe for a few allowed ones). I decided to keep this, since there is no alternative. `update_state` doesn't produce a relation so it doesn't belong in a Finder, and we can't move it to another Service either. As such I opted to just use the method directly. Cases like this may happen more frequently, at which point we should update our documentation with some sort of recommendation. For now, I want to refrain from doing so until we have a few more examples.
* Applies the CE backport of EE#657Tiago Botelho2018-09-241-4/+6
|
* Merge branch ↵Douwe Maan2018-09-181-2/+2
|\ | | | | | | | | | | | | | | | | '45754-open-issues-from-archived-project-listed-in-group-issue-board' into 'master' Resolve "Open issues from archived project listed in group issue board" Closes #45754 See merge request gitlab-org/gitlab-ce!21721
| * Filter out archived projects from issue/mr countBrett Walker2018-09-171-2/+2
| | | | | | | | Pass the 'non_archived' flag to finder methods
* | Merge branch 'sh-fix-commit-email-migration' into 'master'Nick Thomas2018-09-181-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Return a default commit email if migration has not completed Closes #51530 See merge request gitlab-org/gitlab-ce!21790
| * | Return a default commit email if migration has not completedStan Hu2018-09-151-1/+1
| |/ | | | | | | Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51530
* | Added FromUnion to easily select from a UNIONYorick Peterse2018-09-171-26/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the module `FromUnion`, which provides the class method `from_union`. This simplifies the process of selecting data from the result of a UNION, and reduces the likelihood of making mistakes. As a result, instead of this: union = Gitlab::SQL::Union.new([foo, bar]) Foo.from("(#{union.to_sql}) #{Foo.table_name}") We can now write this instead: Foo.from_union([foo, bar]) This commit also includes some changes to make this new setup work properly. For example, a bug in Rails 4 (https://github.com/rails/rails/issues/24193) would break the use of `from("sub-query-here").includes(:relation)` in certain cases. There was also a CI query which appeared to repeat a lot of conditions from an outer query on an inner query, which isn't necessary. Finally, we include a RuboCop cop to ensure developers use this new module, instead of using Gitlab::SQL::Union directly. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/51307
* Resolve "Add functionality to change what email address online actions ↵Nick Thomas2018-09-141-1/+38
| | | | commit using"
* Disable existing offenses for the CodeReuse copsYorick Peterse2018-09-111-2/+22
| | | | | This whitelists all existing offenses for the various CodeReuse cops, of which most are triggered by the CodeReuse/ActiveRecord cop.
* Ask user explicitly about usage stats agreementJan Provaznik2018-09-071-0/+22
|
* Port changes for CODEOWNERS to CEBob Van Landuyt2018-09-061-2/+3
| | | | | | This ports the changes for the CODEOWNERS feature to CE: - It adds the CODEOWNERS file. - It adds the mention of the `with-codeowners` branch in TestEnv
* Fix SQL error when sorting 2FA-enabled users by name in admin areaDmitriy Zaporozhets2018-08-211-6/+9
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Refactor AutocompleteControllerdefine-abstraction-levelsYorick Peterse2018-08-201-1/+44
| | | | | | | | | | | | | | | | | | | | | | | This refactors the AutocompleteController according to the guidelines and boundaries discussed in https://gitlab.com/gitlab-org/gitlab-ce/issues/49653. Specifically, ActiveRecord logic is moved to different finders, which are then used in the controller. View logic in turn is moved to presenters, instead of directly using ActiveRecord's "to_json" method. The finder MoveToProjectFinder is also adjusted according to the abstraction guidelines and boundaries, resulting in a much more simple finder. By using finders (and other abstractions) more actively, we can push a lot of logic out of the controller. We also remove the need for various "before_action" hooks, though this could be achieved without using finders as well. The various finders related to AutcompleteController have also been moved into a namespace. This removes the need for calling everything "AutocompleteSmurfFinder", instead you can use "Autocomplete::SmurfFinder".
* Whitelist existing destroy_all offensesblacklist-destroy-allYorick Peterse2018-08-161-1/+1
| | | | This whitelists all existing places where we use "destroy_all".
* Optimize querying User#manageable_groupsImre Farkas2018-08-061-14/+5
|
* Resolve "Remove ghost notification settings for groups and projects"🙈 jacopo beschi 🙉2018-08-021-1/+1
|
* Merge branch 'frozen-string-enable-app-models' into 'master'Rémy Coutable2018-08-021-0/+2
|\ | | | | | | | | Enable frozen string in app/models/*.rb See merge request gitlab-org/gitlab-ce!20851
| * Enable frozen string in app/models/*.rbrepo-forks/gitlab-ce-frozen-string-enable-app-modelsgfyoung2018-07-261-0/+2
| | | | | | | | Partially addresses #47424.
* | Merge branch 'bvl-user-status-message-35463' into 'master'Rémy Coutable2018-08-011-0/+2
|\ \ | | | | | | | | | | | | | | | | | | Allow users to set a status Closes #35463 See merge request gitlab-org/gitlab-ce!20614
| * | Allow users to set a statusBob Van Landuyt2018-07-301-0/+2
| |/ | | | | | | | | This can be done trough the API for the current user, or on the profile page.
* | Add support for searching users by confirmed e-mailsStan Hu2018-07-281-3/+7
|/ | | | | This is in preparation for modifying importers to assign e-mails for only confirmed emails.
* Remove duplicated include IgnorableColumnLin Jen-Shin2018-07-191-1/+0
| | | | It's probably duplicated during resolving a conflict?
* Resolve "Rename the `Master` role to `Maintainer`" BackendMark Chao2018-07-111-9/+13
|
* Resolve Naming/UncommunicativeMethodLin Jen-Shin2018-07-091-2/+2
|
* Updates from `rubocop -a`Lin Jen-Shin2018-07-091-2/+2
|
* Merge branch 'remove-is-shared-from-ci-runners' into 'master'Grzegorz Bizon2018-07-041-1/+1
|\ | | | | | | | | Remove the use of `is_shared` of `Ci::Runner` See merge request gitlab-org/gitlab-ce!20172
| * Remove the use of `is_shared` of `Ci::Runner`remove-is-shared-from-ci-runnersKamil Trzciński2018-06-261-1/+1
| |
* | Improve performance of User.without_projects scopeDouwe Maan2018-07-021-1/+1
|/
* Fix some N+1s when calculating notification recipientsSean McGivern2018-06-071-1/+4
| | | | | | | | | | | | | | First N+1: we may have loaded a user's notification settings already, but not have loaded their sources. Because we're iterating through, we'd potentially load sources that are completely unrelated, just because they belong to this user. Second N+1: we do a separate query for each user who could be subscribed to or unsubcribed from the target. It's actually more efficient in this case to get all subscriptions at once, as we will need to check most of them. We can fix both by the slightly unpleasant means of checking IDs manually, rather than object equality.
* Export assigned issues in iCalendar feedImre Farkas2018-05-311-4/+4
|
* Merge branch ↵Douwe Maan2018-05-221-8/+19
|\ | | | | | | | | | | | | | | | | '22846-notifications-broken-during-email-address-change-before-email-confirmed' into 'master' Resolve "notifications broken during email address change before email confirmed" Closes #22846 See merge request gitlab-org/gitlab-ce!18474
| * Don't set the notification_email when only unconfirmed_email is changed22846-notifications-broken-during-email-address-change-before-email-confirmedRémy Coutable2018-05-221-8/+19
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Add NOT NULL constraints to project_authorizations.Andreas Brandl2018-05-211-1/+1
|/ | | | Closes #32258.
* Resolve "Opening Project with invite but without accepting leads to 404 ↵🙈 jacopo beschi 🙉2018-05-171-0/+10
| | | | error page"
* Merge branch 'jprovazn-remote-upload-destroy' into 'master'Kamil Trzciński2018-05-161-1/+1
|\ | | | | | | | | | | | | Delete remote uploads Closes #45425 See merge request gitlab-org/gitlab-ce!18698
| * Changed order of includeJan Provaznik2018-05-161-1/+1
| |
| * Delete remote uploadsJan Provaznik2018-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ObjectStore uploader requires presence of associated `uploads` record when deleting the upload file (through the carrierwave's after_commit hook) because we keep info whether file is LOCAL or REMOTE in `upload` object. For this reason we can not destroy uploads as "dependent: :destroy" hook because these would be deleted too soon. Instead we rely on carrierwave's hook to destroy `uploads` in after_commit hook. But in before_destroy hook we still have to delete not-mounted uploads (which don't use carrierwave's destroy hook). This has to be done in before_Destroy instead of after_commit because `FileUpload` requires existence of model's object on destroy action. This is not ideal state of things, in a next step we should investigate how to unify model dependencies so we can use same workflow for all uploads. Related to #45425