1. 06 Apr, 2017 8 commits
    • Timothy Andrew's avatar
      Implement review comments from @DouweM for !10467. · 1c42505b
      Timothy Andrew authored
      1. Have `MigrateToGhostUser` be a service rather than a mixed-in module, to keep
         things explicit. Specs testing the behavior of this class are moved into a
         separate service spec file.
      
      2. Add a `user.reported_abuse_reports` association to make the
         `migrate_abuse_reports` method more consistent with the other `migrate_`
         methods.
      1c42505b
    • Timothy Andrew's avatar
    • Timothy Andrew's avatar
      Add CHANGELOG entry for !10467 · 07f365e3
      Timothy Andrew authored
      07f365e3
    • Timothy Andrew's avatar
      Move a user's award emoji to the ghost user · 3e1a1242
      Timothy Andrew authored
      ... when the user is destroyed.
      
      1. Normally, for a given awardable and award emoji name, a user is only allowed
         to create a single award emoji.
      
      2. This validation needs to be removed for ghost users, since:
      
         - User A and User B have created award emoji - with the same name and against
           the same awardable
         - User A is deleted. Their award emoji is moved to the ghost user
         - User B is deleted. Their award emoji needs to be moved to the ghost user.
           However, this breaks the uniqueness validation, since the ghost user is
           only allowed to have one award emoji of a given name for a given awardable
      3e1a1242
    • Timothy Andrew's avatar
      Move a user's abuse reports to the ghost user · 68298754
      Timothy Andrew authored
      ... when the user is destroyed.
      
      To clarify, this regards abuse reports that the to-be-deleted user has _reported_.
      68298754
    • Timothy Andrew's avatar
      Fix a bug with the User#abuse_report association. · 6a065074
      Timothy Andrew authored
      Introduction
      ------------
      
      1. The foreign key was not explicitly specified on the association.
      2. The `AbuseReport` model contains two references to user - `reporter_id` and
         `user_id`
      3. `user.abuse_report` is supposed to return the single abuse report where
         `user_id` refers to the given user.
      
      Bug Description
      ---------------
      
      1. `user.abuse_report` would return an abuse report where `reporter_id` referred
         to the current user, if such an abuse report was present.
      
      2. This implies a slightly more serious bug as well:
      
         - Assume User A filed an abuse report against User B
         - We have an abuse report where `reporter_id` is User A and `user_id` is User B
         - If User A is updated (`user_a.block`, for example), the abuse report would
           also be updated, such that both `reporter_id` _and_ `user_id` point to User A.
      
      Fix
      ---
      
      Explicitly declare the foreign key `user_id` in the `has_one` declaration
      6a065074
    • Timothy Andrew's avatar
      Move a user's notes to the ghost user · 97cbf7c2
      Timothy Andrew authored
      ... when the user is destroyed.
      97cbf7c2
    • Timothy Andrew's avatar
      Move a user's merge requests to the ghost user. · 72580f07
      Timothy Andrew authored
      1. When the user is deleted.
      
      2. Refactor out code relating to "migrating records to the ghost user" into a
         `MigrateToGhostUser` concern, which is tested using a shared example.
      72580f07
  2. 04 Apr, 2017 3 commits
  3. 03 Apr, 2017 29 commits