chore: Add controllers for conversation participants (#6462)

Co-authored-by: Aswin Dev P.S <aswindevps@gmail.com>
Co-authored-by: Sojan Jose <sojan@chatwoot.com>
This commit is contained in:
Pranav Raj S
2023-02-15 16:33:31 -08:00
committed by GitHub
parent 949ddf68ba
commit 7044eda281
34 changed files with 546 additions and 63 deletions

View File

@@ -34,7 +34,8 @@ class Notification < ApplicationRecord
conversation_creation: 1,
conversation_assignment: 2,
assigned_conversation_new_message: 3,
conversation_mention: 4
conversation_mention: 4,
participating_conversation_new_message: 5
}.freeze
enum notification_type: NOTIFICATION_TYPES
@@ -94,7 +95,7 @@ class Notification < ApplicationRecord
I18n.t('notifications.notification_title.conversation_creation', display_id: primary_actor.display_id, inbox_name: primary_actor.inbox.name)
when 'conversation_assignment'
I18n.t('notifications.notification_title.conversation_assignment', display_id: primary_actor.display_id)
when 'assigned_conversation_new_message'
when 'assigned_conversation_new_message', 'participating_conversation_new_message'
I18n.t(
'notifications.notification_title.assigned_conversation_new_message',
display_id: conversation.display_id,
@@ -109,7 +110,11 @@ class Notification < ApplicationRecord
# rubocop:enable Metrics/CyclomaticComplexity
def conversation
return primary_actor.conversation if %w[assigned_conversation_new_message conversation_mention].include? notification_type
return primary_actor.conversation if %w[
assigned_conversation_new_message
participating_conversation_new_message
conversation_mention
].include? notification_type
primary_actor
end