Commit Graph

9 Commits

Author SHA1 Message Date
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Kamil Trzciński 650f40865e Forbid the use of `#reload` and prefer `#reset`
The `#reload` makes to load all objects into memory,
and the main purpose of `#reload` is to drop the association cache.

The `#reset` seems to solve exactly that case.
2019-04-15 13:05:14 +02:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
gfyoung 0cf45debb4 Enable more frozen string in app/services/**/*.rb
Partially addresses #47424.
2018-07-18 14:07:50 -07:00
Olivier Gonzalez 065d44538b
Cleanly handle plural name for ghost user migration 2018-05-07 23:38:05 -04:00
Jarka Kadlecova 906d2f03d1 Refactor issuable destroy action 2017-11-06 13:02:50 +01:00
Jarka Kadlecova a9d940bffc Use Ghost user when edited_by, merged_by deleted 2017-07-19 11:35:17 +02:00
Timothy Andrew 133f00bedd Move records to the ghost user in a transaction.
- While deleting a user, some of the user's associated records are moved to the
  ghost user so they aren't deleted. The user is blocked before these records
  are moved, to prevent the user from creating new records while the migration
  is happening, and so preventing a data race.

- Previously, if the migration failed, the user would _remain_ blocked, which is
  not the expected behavior. On the other hand, we can't just stick the block +
  migration into a transaction, because we want the block to be committed before
  the migration starts (for the data race reason mentioned above).

- One solution (implemented in this commit) is to block the user in a parent
  transaction, migrate the associated records in a nested sub-transaction, and
  then unblock the user in the parent transaction if the sub-transaction fails.
2017-04-24 06:46:10 +00:00
Timothy Andrew 1c42505b02
Implement review comments from @DouweM for !10467.
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.
2017-04-06 22:39:40 +05:30