From df4681a1149d6afd5ef9b064f9544f97a56c705f Mon Sep 17 00:00:00 2001 From: rhymes Date: Tue, 19 May 2020 12:44:31 +0200 Subject: [PATCH] Remove destroy_empty_dm_channels callback (#7911) --- app/models/user.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index c81faf235..36a88338c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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