feat: improvements to priority (#6981)

* fix: colors for urgent icon

* feat: trigger updated event on priority change

* fix: specs
This commit is contained in:
Shivam Mishra
2023-04-25 22:28:19 +05:30
committed by GitHub
parent 402428fb4d
commit d95283f5c2
5 changed files with 10 additions and 5 deletions

View File

@@ -48,15 +48,17 @@ export default {
<style scoped lang="scss">
.conversation-priority-mark {
align-items: center;
flex-shrink: 0;
background: var(--s-50);
border-radius: var(--border-radius-small);
color: var(--s-600);
display: inline-flex;
width: var(--space-snug);
height: var(--space-snug);
&.urgent {
background: var(--r-500);
color: var(--w-25);
background: var(--r-50);
color: var(--r-500);
}
}
</style>

View File

@@ -221,14 +221,14 @@ class Conversation < ApplicationRecord
end
def notify_conversation_updation
return unless previous_changes.keys.present? && whitelisted_keys?
return unless previous_changes.keys.present? && allowed_keys?
dispatcher_dispatch(CONVERSATION_UPDATED, previous_changes)
end
def whitelisted_keys?
def allowed_keys?
(
(previous_changes.keys & %w[team_id assignee_id status snoozed_until custom_attributes label_list first_reply_created_at]).present? ||
(previous_changes.keys & %w[team_id assignee_id status snoozed_until custom_attributes label_list first_reply_created_at priority]).present? ||
(previous_changes['additional_attributes'].present? && (previous_changes['additional_attributes'][1].keys & %w[conversation_language]).present?)
)
end

View File

@@ -15,6 +15,7 @@ class Conversations::EventDataPresenter < SimpleDelegator
snoozed_until: snoozed_until,
unread_count: unread_incoming_messages.count,
first_reply_created_at: first_reply_created_at,
priority: priority,
**push_timestamps
}
end

View File

@@ -518,6 +518,7 @@ RSpec.describe Conversation, type: :model do
contact_last_seen_at: conversation.contact_last_seen_at.to_i,
agent_last_seen_at: conversation.agent_last_seen_at.to_i,
created_at: conversation.created_at.to_i,
priority: nil,
unread_count: 0
}
end

View File

@@ -31,6 +31,7 @@ RSpec.describe Conversations::EventDataPresenter do
contact_last_seen_at: conversation.contact_last_seen_at.to_i,
agent_last_seen_at: conversation.agent_last_seen_at.to_i,
created_at: conversation.created_at.to_i,
priority: nil,
unread_count: 0
}
end