Merge branch 'release/1.18.1'
This commit is contained in:
@@ -21,6 +21,27 @@ class ConversationFinder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
|
set_up
|
||||||
|
|
||||||
|
mine_count, unassigned_count, all_count, = set_count_for_all_conversations
|
||||||
|
assigned_count = all_count - unassigned_count
|
||||||
|
|
||||||
|
filter_by_assignee_type
|
||||||
|
|
||||||
|
{
|
||||||
|
conversations: conversations,
|
||||||
|
count: {
|
||||||
|
mine_count: mine_count,
|
||||||
|
assigned_count: assigned_count,
|
||||||
|
unassigned_count: unassigned_count,
|
||||||
|
all_count: all_count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_up
|
||||||
set_inboxes
|
set_inboxes
|
||||||
set_team
|
set_team
|
||||||
set_assignee_type
|
set_assignee_type
|
||||||
@@ -30,23 +51,8 @@ class ConversationFinder
|
|||||||
filter_by_team if @team
|
filter_by_team if @team
|
||||||
filter_by_labels if params[:labels]
|
filter_by_labels if params[:labels]
|
||||||
filter_by_query if params[:q]
|
filter_by_query if params[:q]
|
||||||
|
|
||||||
mine_count, unassigned_count, all_count = set_count_for_all_conversations
|
|
||||||
|
|
||||||
filter_by_assignee_type
|
|
||||||
|
|
||||||
{
|
|
||||||
conversations: conversations,
|
|
||||||
count: {
|
|
||||||
mine_count: mine_count,
|
|
||||||
unassigned_count: unassigned_count,
|
|
||||||
all_count: all_count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_inboxes
|
def set_inboxes
|
||||||
@inbox_ids = if params[:inbox_id]
|
@inbox_ids = if params[:inbox_id]
|
||||||
current_account.inboxes.where(id: params[:inbox_id])
|
current_account.inboxes.where(id: params[:inbox_id])
|
||||||
@@ -74,7 +80,7 @@ class ConversationFinder
|
|||||||
when 'unassigned'
|
when 'unassigned'
|
||||||
@conversations = @conversations.unassigned
|
@conversations = @conversations.unassigned
|
||||||
when 'assigned'
|
when 'assigned'
|
||||||
@conversations = @conversations.where.not(assignee_id: nil)
|
@conversations = @conversations.assigned
|
||||||
end
|
end
|
||||||
@conversations
|
@conversations
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -134,11 +134,17 @@ export default {
|
|||||||
const {
|
const {
|
||||||
email: {
|
email: {
|
||||||
html_content: { full: fullHTMLContent, reply: replyHTMLContent } = {},
|
html_content: { full: fullHTMLContent, reply: replyHTMLContent } = {},
|
||||||
|
text_content: { full: fullTextContent, reply: replyTextContent } = {},
|
||||||
} = {},
|
} = {},
|
||||||
} = this.contentAttributes;
|
} = this.contentAttributes;
|
||||||
|
|
||||||
if ((replyHTMLContent || fullHTMLContent) && this.isIncoming) {
|
let contentToBeParsed =
|
||||||
let contentToBeParsed = replyHTMLContent || fullHTMLContent || '';
|
replyHTMLContent ||
|
||||||
|
replyTextContent ||
|
||||||
|
fullHTMLContent ||
|
||||||
|
fullTextContent ||
|
||||||
|
'';
|
||||||
|
if (contentToBeParsed && this.isIncoming) {
|
||||||
const parsedContent = this.stripStyleCharacters(contentToBeParsed);
|
const parsedContent = this.stripStyleCharacters(contentToBeParsed);
|
||||||
if (parsedContent) {
|
if (parsedContent) {
|
||||||
return parsedContent;
|
return parsedContent;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default {
|
|||||||
profiles: additional.social_profiles || {},
|
profiles: additional.social_profiles || {},
|
||||||
city: additional.city || '---',
|
city: additional.city || '---',
|
||||||
country: additional.country || '---',
|
country: additional.country || '---',
|
||||||
conversations_count: item.conversations_count || '---',
|
conversationsCount: item.conversations_count || '---',
|
||||||
last_activity_at: lastActivityAt
|
last_activity_at: lastActivityAt
|
||||||
? this.dynamicTime(lastActivityAt)
|
? this.dynamicTime(lastActivityAt)
|
||||||
: '---',
|
: '---',
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class Conversation < ApplicationRecord
|
|||||||
|
|
||||||
scope :latest, -> { order(last_activity_at: :desc) }
|
scope :latest, -> { order(last_activity_at: :desc) }
|
||||||
scope :unassigned, -> { where(assignee_id: nil) }
|
scope :unassigned, -> { where(assignee_id: nil) }
|
||||||
|
scope :assigned, -> { where.not(assignee_id: nil) }
|
||||||
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
|
scope :assigned_to, ->(agent) { where(assignee_id: agent.id) }
|
||||||
|
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
json.data do
|
json.data do
|
||||||
json.meta do
|
json.meta do
|
||||||
json.mine_count @conversations_count[:mine_count]
|
json.mine_count @conversations_count[:mine_count]
|
||||||
|
json.assigned_count @conversations_count[:assigned_count]
|
||||||
json.unassigned_count @conversations_count[:unassigned_count]
|
json.unassigned_count @conversations_count[:unassigned_count]
|
||||||
json.all_count @conversations_count[:all_count]
|
json.all_count @conversations_count[:all_count]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
json.meta do
|
json.meta do
|
||||||
json.mine_count @conversations_count[:mine_count]
|
json.mine_count @conversations_count[:mine_count]
|
||||||
|
json.assigned_count @conversations_count[:assigned_count]
|
||||||
json.unassigned_count @conversations_count[:unassigned_count]
|
json.unassigned_count @conversations_count[:unassigned_count]
|
||||||
json.all_count @conversations_count[:all_count]
|
json.all_count @conversations_count[:all_count]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
shared: &shared
|
shared: &shared
|
||||||
version: '1.18.0'
|
version: '1.18.1'
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *shared
|
<<: *shared
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ internal_check_new_versions_job:
|
|||||||
queue: scheduled_jobs
|
queue: scheduled_jobs
|
||||||
|
|
||||||
# executed At every 5th minute..
|
# executed At every 5th minute..
|
||||||
internal_check_new_versions_job:
|
trigger_scheduled_items_job:
|
||||||
cron: "*/5 * * * *"
|
cron: "*/5 * * * *"
|
||||||
class: "TriggerScheduledItemsJob"
|
class: "TriggerScheduledItemsJob"
|
||||||
queue: scheduled_jobs
|
queue: scheduled_jobs
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@chatwoot/chatwoot",
|
"name": "@chatwoot/chatwoot",
|
||||||
"version": "1.18.0",
|
"version": "1.18.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"eslint": "eslint app/javascript --fix",
|
"eslint": "eslint app/javascript --fix",
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ RSpec.describe 'Conversations API', type: :request do
|
|||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
body = JSON.parse(response.body, symbolize_names: true)
|
body = JSON.parse(response.body, symbolize_names: true)
|
||||||
expect(body[:data][:meta][:all_count]).to eq(1)
|
expect(body[:data][:meta][:all_count]).to eq(1)
|
||||||
|
expect(body[:data][:meta].keys).to include(:all_count, :mine_count, :assigned_count, :unassigned_count)
|
||||||
expect(body[:data][:payload].first[:messages].first[:id]).to eq(message.id)
|
expect(body[:data][:payload].first[:messages].first[:id]).to eq(message.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -68,7 +69,9 @@ RSpec.describe 'Conversations API', type: :request do
|
|||||||
as: :json
|
as: :json
|
||||||
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
expect(JSON.parse(response.body, symbolize_names: true)[:meta][:all_count]).to eq(1)
|
body = JSON.parse(response.body, symbolize_names: true)
|
||||||
|
expect(body[:meta].keys).to include(:all_count, :mine_count, :assigned_count, :unassigned_count)
|
||||||
|
expect(body[:meta][:all_count]).to eq(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ describe ::ConversationFinder do
|
|||||||
result = conversation_finder.perform
|
result = conversation_finder.perform
|
||||||
expect(result[:conversations].count).to be 3
|
expect(result[:conversations].count).to be 3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns the correct meta' do
|
||||||
|
result = conversation_finder.perform
|
||||||
|
expect(result[:count]).to eq({
|
||||||
|
mine_count: 2,
|
||||||
|
assigned_count: 3,
|
||||||
|
unassigned_count: 1,
|
||||||
|
all_count: 4
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with team' do
|
context 'with team' do
|
||||||
|
|||||||
Reference in New Issue
Block a user