summaryrefslogtreecommitdiff
path: root/app/models/user.rb
Commit message (Collapse)AuthorAgeFilesLines
* refactor emails servicerefactor-servicesJames Lopez2017-09-281-2/+2
|
* refactor users update serviceJames Lopez2017-09-281-3/+3
|
* refactor services to match EE signatureJames Lopez2017-09-281-5/+5
|
* Revert "Merge branch 'revert-f2421b2b' into 'master'"revert-2f46c3a8Annabel Dunstone Gray2017-09-111-0/+1
| | | This reverts merge request !14148
* Merge branch 'user-recent-push' into 'master'Douwe Maan2017-09-111-13/+6
|\ | | | | | | | | | | | | Rework how recent push events are retrieved Closes #35990 See merge request !13995
| * Rework how recent push events are retrieveduser-recent-pushYorick Peterse2017-09-081-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Revert "Merge branch ↵revert-f2421b2bRubén Dávila2017-09-081-1/+0
|/ | | | | '35012-navigation-add-option-to-change-navigation-color-palette' into 'master'" This reverts merge request !13619
* Merge branch '23079-remove-default-scope-in-sortable' into 'master'Douwe Maan2017-09-071-4/+6
|\ | | | | | | | | | | | | Removes default scope from sortable Closes #23079 See merge request !13558
| * Removes default scope from sortable23079-remove-default-scope-in-sortableTiago Botelho2017-09-071-4/+6
| |
* | Restore some changes from !9199Rubén Dávila2017-09-061-0/+1
| |
* | Profile updates from providersAlexander Keramidas2017-09-061-1/+21
|/
* add User##verified_email? methodAlexis Reigel2017-09-051-0/+4
|
* Merge branch 'remove-unused-code' into 'master'Rémy Coutable2017-09-041-9/+0
|\ | | | | | | | | Remove unused code See merge request !13657
| * Remove unused `User#projects_limit_percent`Mehdi Lahmam2017-08-201-5/+0
| | | | | | | | Its last usage has been removed at 87ffd67617.
| * Remove `User#projects_sorted_by_activity`Mehdi Lahmam2017-08-201-4/+0
| | | | | | | | | | | | Its last usage has been removed at https://gitlab.com/mehlah/gitlab-ce/commit/9df6f7bfad#e6ff2c1091173fd03646752d4e30891f66d33db3_46_48 The method can still be useful but should be renamed `authorized_projects_sorted_by_activity` for better clarity.
* | Merge branch '37202-revert-changes-to-signing-enabled' into 'master'Douwe Maan2017-09-011-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Rollback changes made to signing_enabled. Closes #37202 See merge request !13956
| * | Rollsback changes made to signing_enabled.Tiago Botelho2017-09-011-1/+1
| | |
* | | `current_application_settings` belongs on `Gitlab::CurrentSettings`Sean McGivern2017-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initializers including this were doing so at the top level, so every object loaded after them had a `current_application_settings` method. However, if someone had rack-attack enabled (which was loaded before these initializers), it would try to load the API, and fail, because `Gitlab::CurrentSettings` didn't have that method. To fix this: 1. Don't include `Gitlab::CurrentSettings` at the top level. We do not need `Object.new.current_application_settings` to work. 2. Make `Gitlab::CurrentSettings` explicitly `extend self`, as we already use it like that in several places. 3. Change the initializers to use that new form.
* | | Move the logic to a concernHiroyuki Sato2017-08-291-1/+2
| | |
* | | Improve AutocompleteController#user.json performanceHiroyuki Sato2017-08-251-1/+1
|/ /
* | Add namespace errors from User#after_updatemk-fix-user-namespace-renameMichael Kozono2017-08-181-1/+6
| |
* | Make username update fail if namespace part failsMichael Kozono2017-08-171-1/+1
|/
* expose Referable#non_referable_inspectdev.non-referable-inspecthttp://jneen.net/2017-08-161-5/+0
|
* Merge branch 'rs-more-public-send-whitelists' into 'master'Rémy Coutable2017-08-161-1/+1
|\ | | | | | | | | Whitelist or fix additional `Gitlab/PublicSend` cop violations See merge request !13467
| * Whitelist or fix additional `Gitlab/PublicSend` cop violationsrs-more-public-send-whitelistsRobert Speicher2017-08-141-1/+1
| | | | | | | | | | An upcoming update to rubocop-gitlab-security added additional violations.
* | Merge branch 'rs-remove-username-from-sanitize-attrs' into 'master'Rémy Coutable2017-08-141-3/+3
|\ \ | |/ |/| | | | | Remove `username` from `User#sanitize_attrs` callback See merge request !13511
| * Remove `username` from `User#sanitize_attrs` callbackrs-remove-username-from-sanitize-attrsRobert Speicher2017-08-111-3/+3
| | | | | | | | | | | | | | | | | | | | This attribute is since validated against `DynamicPathValidator`, which has strict requirements for the characters allowed, and should no longer need to be sanitized in a callback before saving. This has additional benefits in our test suite, where every creation of a `User` record was calling `Sanitize.clean` on a username value that was always clean, since we're the ones generating it.
* | don't send devise notifications to the ghost userhttp://jneen.net/2017-08-111-0/+1
|/
* Prevent user from changing username with container registry tagsMichael Kozono2017-08-091-0/+8
|
* Use full path of user's avatar in webhooks34339-user_avatar-url-in-push-event-webhook-json-payload-is-relative-should-be-absoluteblackst0ne2017-08-091-1/+1
|
* Re-enable SqlInjection and CommandInjectionBrian Neel2017-08-081-5/+5
|
* Memoize a user's personal projects countYorick Peterse2017-08-071-1/+5
| | | | | | | | | | The method User#projects_limit_left would run "personal_projects.count" but such a query is not memoized. As a result multiple calls to User#projects_limit_left would result in multiple COUNT(*) queries being executed. To work around this this commit adds User#personal_projects_count which simply memoizes the result of the COUNT(*) in an instance variable.
* Remove redundant query from User#recent_pushYorick Peterse2017-08-071-10/+8
| | | | | | The "events" table has a foreign key on "events.project_id" with a cascading delete. As such it's impossible for an event to have a non-existing project ID.
* implement #inspect for all Referablesdev.referable-inspecthttp://jneen.net/2017-08-011-0/+5
|
* use db's on_delete instead of has_many :dependentAlexis Reigel2017-07-271-1/+1
|
* use after_commit instead of AfterCommitQueueAlexis Reigel2017-07-271-3/+2
|
* perform signature update in sidekiq workerAlexis Reigel2017-07-271-1/+2
|
* update invalid gpg signatures when email changesAlexis Reigel2017-07-271-0/+5
|
* don't sync to keychain fileAlexis Reigel2017-07-271-7/+0
|
* remove gpg from keychain when user's email changesAlexis Reigel2017-07-271-0/+7
|
* add profile gpg key page to manage gpg keysAlexis Reigel2017-07-271-0/+1
|
* Use Ghost user when edited_by, merged_by deleted34930-fix-edited-byJarka Kadlecova2017-07-191-1/+3
|
* Fixes the user order being overriden in the autocomplete controllerfix-exact-matches-of-username-and-email-on-top-of-the-user-searchTiago Botelho2017-07-141-1/+1
|
* Merge branch 'fixes-for-internal-auth-disabled' into 'master'Sean McGivern2017-07-141-4/+8
|\ | | | | | | | | Fixes needed when GitLab sign-in is not enabled See merge request !12491
| * Fixes needed when GitLab sign-in is not enabledRobin Bobbitt2017-07-131-4/+8
| | | | | | | | | | | | | | | | | | When sign-in is disabled: - skip password expiration checks - prevent password reset requests - don’t show Password tab in User Settings - don’t allow login with username/password for Git over HTTP requests - render 404 on requests to Profiles::PasswordsController
* | Stop sanitizing user 'name' when inserting into dbNathan Neulinger2017-07-121-1/+1
|/ | | | Add spec tests for encoding
* refactor created at filter to use model scopesJames Lopez2017-07-071-0/+1
|
* Rename ActiverecordSerialize copYorick Peterse2017-07-061-1/+1
| | | | | This cop has been renamed to ActiveRecordSerialize to match the way "ActiveRecord" is usually written.
* Added Cop to blacklist the use of `dependent:`Yorick Peterse2017-07-061-30/+30
| | | | | | | | This is allowed for existing instances so we don't end up 76 offenses right away, but for new code one should _only_ use this if they _have_ to remove non database data. Even then it's usually better to do this in a service class as this gives you more control over how to remove the data (e.g. in bulk).
* Merge branch '34078-allow-to-enable-feature-flags-with-more-granularity' ↵Robert Speicher2017-06-291-0/+1
|\ | | | | | | | | | | | | | | | | into 'master' Allow the feature flags to be enabled/disabled with more granularity Closes #34078 See merge request !12357