Fix bad query when deleting users (#556)

This commit is contained in:
Andy Zhao 2018-07-09 17:46:08 -04:00 committed by Ben Halpern
parent 36fa056d24
commit 3bbfa03114

View file

@ -468,7 +468,7 @@ class User < ApplicationRecord
return if chat_channels.empty? ||
chat_channels.where(channel_type: "direct").empty?
empty_dm_channels = chat_channels.where(channel_type: "direct").
messages.select { |chat_channel| chat_channel.messages.empty? }
select { |chat_channel| chat_channel.messages.empty? }
empty_dm_channels.destroy_all
end