Compare commits

...
Author SHA1 Message Date
Pranav ffc0183809 Merge branch 'hotfix/3.11.1'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-08-12 15:11:19 +05:30
Pranav dcefd58240 Bump version to v3.11.1 2024-08-12 15:10:42 +05:30
Shivam MishraandGitHub 6196a6d99a fix: last_activity_at is nil when conv is created (#9934)
The payload does not include last_activity_at when the conversation is created. Because of this the frontend is not able to sort the conversations when appending this. Another problem is that the last_activity_at is not always present, it is added only when a message is created, and it updates it. So this can be nil when the conversation is created, so we fallback to created_at only at the presentation layer
2024-08-12 15:08:06 +05:30
Sojan 8ea412bc85 Merge branch 'release/3.11.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-07-16 19:23:03 -07:00
Sojan 862ef37e7f Merge branch 'release/3.10.2'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-06-26 17:08:38 -07:00
Sojan 9a1d5519ec Merge branch 'release/3.10.1'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-06-21 15:07:01 -07:00
Sojan e17f0ea753 Merge branch 'release/3.10.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-06-17 23:59:25 -07:00
Sojan f7580f864c Merge branch 'release/3.9.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-05-15 22:32:12 -07:00
Sojan 85aeaf2aee Merge branch 'release/3.8.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-04-16 17:09:07 -07:00
Sojan e93af2681e Merge branch 'release/3.7.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-03-18 17:27:13 +05:30
Sojan cb2b75ca17 Merge branch 'release/3.6.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-02-19 15:59:20 +05:30
Sojan 608592db0c Merge branch 'release/3.5.2'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-01-19 15:15:27 +04:00
Sojan ab1f803354 Merge branch 'release/3.5.1'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-01-17 13:48:22 +04:00
Sojan b81c722ac8 Merge branch 'release/3.5.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2024-01-16 11:15:11 +04:00
Sojan b40ad399f6 Merge branch 'release/3.4.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2023-12-18 21:22:55 -08:00
Sojan dcd18072b4 Merge branch 'release/3.3.1'
Publish Chatwoot CE docker images / build (push) Waiting to run
2023-11-18 10:24:25 -08:00
Sojan bda2d1d9a4 Merge branch 'release/3.3.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2023-11-17 20:37:25 -08:00
Sojan 83231b9678 Merge branch 'release/3.2.0'
Publish Chatwoot CE docker images / build (push) Waiting to run
2023-10-17 17:55:34 -07:00
5 changed files with 43 additions and 2 deletions
+4
View File
@@ -124,6 +124,10 @@ class Conversation < ApplicationRecord
last_message_in_messaging_window?(messaging_window)
end
def last_activity_at
self[:last_activity_at] || created_at
end
def last_incoming_message
messages&.incoming&.last
end
@@ -40,6 +40,7 @@ class Conversations::EventDataPresenter < SimpleDelegator
{
agent_last_seen_at: agent_last_seen_at.to_i,
contact_last_seen_at: contact_last_seen_at.to_i,
last_activity_at: last_activity_at.to_i,
timestamp: last_activity_at.to_i,
created_at: created_at.to_i
}
+1 -1
View File
@@ -1,5 +1,5 @@
shared: &shared
version: '3.11.0'
version: '3.11.1'
development:
<<: *shared
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@chatwoot/chatwoot",
"version": "3.11.0",
"version": "3.11.1",
"license": "MIT",
"scripts": {
"eslint": "eslint app/**/*.{js,vue}",
+36
View File
@@ -525,6 +525,7 @@ RSpec.describe Conversation do
id: conversation.display_id,
messages: [],
labels: [],
last_activity_at: conversation.last_activity_at.to_i,
inbox_id: conversation.inbox_id,
status: conversation.status,
contact_inbox: conversation.contact_inbox,
@@ -881,4 +882,39 @@ RSpec.describe Conversation do
expect(conversation.cached_label_list_array).to eq %w[customer-support enterprise paid-customer]
end
end
describe '#last_activity_at' do
let(:conversation) { create(:conversation) }
let(:message_params) do
{
conversation: conversation,
account: conversation.account,
inbox: conversation.inbox,
sender: conversation.assignee
}
end
context 'when a new conversation is created' do
it 'sets last_activity_at to the created_at time' do
expect(conversation.last_activity_at).to eq(conversation.created_at)
end
end
context 'when a new message is added' do
it 'updates the last_activity_at to the new message\'s created_at time' do
message = create(:message, created_at: 1.hour.from_now, **message_params)
conversation.reload
expect(conversation.last_activity_at).to be_within(1.second).of(message.created_at)
end
end
context 'when multiple messages are added' do
it 'sets last_activity_at to the most recent message\'s created_at time' do
create(:message, created_at: 2.hours.ago, **message_params)
latest_message = create(:message, created_at: 1.hour.from_now, **message_params)
conversation.reload
expect(conversation.last_activity_at).to be_within(1.second).of(latest_message.created_at)
end
end
end
end