gab-social/app/models/form/chat_message_batch.rb
mgabdev ee91809e8d Progress
Albums almost done, group, chat moderation, photo, video page updates
2020-12-21 13:25:05 -05:00

27 lines
520 B
Ruby

# frozen_string_literal: true
class Form::ChatMessageBatch
include ActiveModel::Model
include AccountableConcern
attr_accessor :chat_message_ids, :action, :current_account
def save
case action
when 'delete'
delete_chat_messages
end
end
private
def delete_chat_messages
ChatMessage.where(id: chat_message_ids).reorder(nil).find_each do |chat_message|
DeleteChatMessageWorker.perform_async(chat_message.id)
log_action :destroy, chat_message
end
true
end
end