mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	fix: Remove orphan members from inbox (#1797)
This commit is contained in:
		| @@ -0,0 +1,13 @@ | ||||
| class RemoveOrphanInboxMembersFromInboxes < ActiveRecord::Migration[6.0] | ||||
|   def change | ||||
|     Account.all.map do |account| | ||||
|       user_ids = account.users.all.map(&:id) | ||||
|       inboxes = account.inboxes | ||||
|       inboxes.each do |inbox| | ||||
|         inbox.inbox_members.each do |inbox_member| | ||||
|           inbox_member.destroy! unless user_ids.include?(inbox_member.user_id) | ||||
|         end | ||||
|       end | ||||
|     end | ||||
|   end | ||||
| end | ||||
| @@ -10,7 +10,7 @@ | ||||
| # | ||||
| # It's strongly recommended that you check this file into your version control system. | ||||
|  | ||||
| ActiveRecord::Schema.define(version: 2021_02_12_154240) do | ||||
| ActiveRecord::Schema.define(version: 2021_02_17_154129) do | ||||
|  | ||||
|   # These are extensions that must be enabled in order to support this database | ||||
|   enable_extension "pg_stat_statements" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Pranav Raj S
					Pranav Raj S