1. 06 Apr, 2017 5 commits
    • 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 32 commits