Progress
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MuteChatMessengerService < BaseService
|
||||
def call(account, target_account)
|
||||
return if account.id == target_account.id
|
||||
mute = account.chat_mute!(target_account)
|
||||
mute
|
||||
end
|
||||
end
|
||||
@@ -52,16 +52,17 @@ class PostChatMessageService < BaseService
|
||||
@chat_conversation_recipients_accounts = ChatConversationAccount.where(chat_conversation: @chat_conversation)
|
||||
@chat_conversation_recipients_accounts.each do |recipient|
|
||||
recipient.last_chat_message_id = @chat.id
|
||||
recipient.is_hidden = false # reset to show unless blocked
|
||||
recipient.is_hidden = false # : todo : reset to show unless blocked
|
||||
|
||||
# Get not mine
|
||||
if @account_conversation.id != recipient.id
|
||||
recipient.unread_count = recipient.unread_count + 1
|
||||
|
||||
# : todo :
|
||||
# check if muting, redis
|
||||
payload = InlineRenderer.render(@chat, recipient.account, :chat_message)
|
||||
Redis.current.publish("chat_messages:#{recipient.account.id}", Oj.dump(event: :notification, payload: payload))
|
||||
# check if muting
|
||||
unless recipient.is_muted
|
||||
payload = InlineRenderer.render(@chat, recipient.account, :chat_message)
|
||||
Redis.current.publish("chat_messages:#{recipient.account.id}", Oj.dump(event: :notification, payload: payload))
|
||||
end
|
||||
else
|
||||
recipient.unread_count = 0
|
||||
end
|
||||
@@ -80,8 +81,10 @@ class PostChatMessageService < BaseService
|
||||
raise ActiveRecord::RecordInvalid
|
||||
end
|
||||
|
||||
def set_message_expiration_date
|
||||
case @account_conversation.expiration_policy
|
||||
def set_message_expiration_date!
|
||||
@expires_at = nil
|
||||
|
||||
case @account_conversation.chat_message_expiration_policy
|
||||
when :five_minutes
|
||||
@expires_at = 5.minutes
|
||||
when :sixty_minutes
|
||||
|
||||
@@ -111,6 +111,8 @@ class PostStatusService < BaseService
|
||||
return if group_id.blank?
|
||||
return if @autoJoinGroup
|
||||
|
||||
# : todo : check removedaccounts if exist dont allow
|
||||
|
||||
raise GabSocial::ValidationError, I18n.t('statuses.not_a_member_of_group') if not GroupAccount.where(account: @account, group_id: group_id).exists?
|
||||
end
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UnmuteChatMessengerService < BaseService
|
||||
def call(account, target_account)
|
||||
return unless account.chat_muting?(target_account)
|
||||
account.chat_unmute!(target_account)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user