mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
fix: Limit the number of unread messages returned in the API (#1504)
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
<span class="timestamp">
|
<span class="timestamp">
|
||||||
{{ dynamicTime(chat.timestamp) }}
|
{{ dynamicTime(chat.timestamp) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="unread">{{ getUnreadCount }}</span>
|
<span class="unread">{{ unreadCount > 9 ? '9+' : unreadCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -108,12 +108,12 @@ export default {
|
|||||||
return this.currentChat.id === this.chat.id;
|
return this.currentChat.id === this.chat.id;
|
||||||
},
|
},
|
||||||
|
|
||||||
getUnreadCount() {
|
unreadCount() {
|
||||||
return this.unreadMessagesCount(this.chat);
|
return this.unreadMessagesCount(this.chat);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasUnread() {
|
hasUnread() {
|
||||||
return this.getUnreadCount > 0;
|
return this.unreadCount > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
isInboxNameVisible() {
|
isInboxNameVisible() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ json.id conversation.display_id
|
|||||||
if conversation.unread_incoming_messages.count.zero?
|
if conversation.unread_incoming_messages.count.zero?
|
||||||
json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)]
|
json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)]
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
json.inbox_id conversation.inbox_id
|
json.inbox_id conversation.inbox_id
|
||||||
|
|||||||
Reference in New Issue
Block a user