diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue index 9c7c78959..163a845c5 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue @@ -39,7 +39,7 @@ {{ dynamicTime(chat.timestamp) }} - {{ getUnreadCount }} + {{ unreadCount > 9 ? '9+' : unreadCount }} @@ -108,12 +108,12 @@ export default { return this.currentChat.id === this.chat.id; }, - getUnreadCount() { + unreadCount() { return this.unreadMessagesCount(this.chat); }, hasUnread() { - return this.getUnreadCount > 0; + return this.unreadCount > 0; }, isInboxNameVisible() { diff --git a/app/views/api/v1/conversations/partials/_conversation.json.jbuilder b/app/views/api/v1/conversations/partials/_conversation.json.jbuilder index 735b47699..517f31054 100644 --- a/app/views/api/v1/conversations/partials/_conversation.json.jbuilder +++ b/app/views/api/v1/conversations/partials/_conversation.json.jbuilder @@ -14,7 +14,7 @@ json.id conversation.display_id if conversation.unread_incoming_messages.count.zero? json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)] else - json.messages conversation.unread_messages.includes([:user, { attachments: [{ file_attachment: [:blob] }] }]).map(&:push_event_data) + json.messages conversation.unread_messages.includes([:user, { attachments: [{ file_attachment: [:blob] }] }]).last(10).map(&:push_event_data) end json.inbox_id conversation.inbox_id