Remove destroy_empty_dm_channels callback (#7911)
This commit is contained in:
parent
691efd1f7b
commit
df4681a114
1 changed files with 0 additions and 10 deletions
|
|
@ -167,7 +167,6 @@ class User < ApplicationRecord
|
|||
before_validation :set_config_input
|
||||
before_validation :downcase_email
|
||||
before_validation :check_for_username_change
|
||||
before_destroy :destroy_empty_dm_channels, prepend: true
|
||||
before_destroy :destroy_follows, prepend: true
|
||||
before_destroy :unsubscribe_from_newsletters, prepend: true
|
||||
|
||||
|
|
@ -598,15 +597,6 @@ class User < ApplicationRecord
|
|||
score.to_i
|
||||
end
|
||||
|
||||
def destroy_empty_dm_channels
|
||||
return if chat_channels.empty? ||
|
||||
chat_channels.where(channel_type: "direct").empty?
|
||||
|
||||
empty_dm_channels = chat_channels.where(channel_type: "direct").
|
||||
select { |chat_channel| chat_channel.messages.empty? }
|
||||
empty_dm_channels.destroy_all
|
||||
end
|
||||
|
||||
def destroy_follows
|
||||
follower_relationships = Follow.followable_user(id)
|
||||
follower_relationships.destroy_all
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue