Fix creation of user records after janitor trials
Previously, a negative "demoted from janitor trial" record would always be created after a janitor trial ended, regardless of whether or not the user in question was actually demoted or not. This commit removes the culprit, an overly aggressive after_destroy callback, and instead directly invokes user record creation in the "demote!" method.
This commit is contained in:
@@ -3,7 +3,6 @@ class JanitorTrial < ActiveRecord::Base
|
||||
before_create :initialize_original_level
|
||||
after_create :send_dmail
|
||||
after_create :promote_user
|
||||
after_destroy :create_feedback
|
||||
validates_presence_of :user
|
||||
before_validation :initialize_creator
|
||||
|
||||
@@ -61,6 +60,7 @@ class JanitorTrial < ActiveRecord::Base
|
||||
|
||||
def demote!
|
||||
user.update_column(:level, original_level)
|
||||
self.create_feedback
|
||||
destroy
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user