From 0245e01763c9296ab1b51e4ef100c87a139b39b5 Mon Sep 17 00:00:00 2001 From: GitStart <1501599+gitstart@users.noreply.github.com> Date: Wed, 13 Sep 2023 09:36:34 +0200 Subject: [PATCH 1/9] fix: Enable serbian translation (#7905) Enable language: Serbian. Co-authored-by: BikashSah999 <51731962+BikashSah999@users.noreply.github.com> --- app/javascript/dashboard/i18n/index.js | 2 ++ app/javascript/survey/i18n/index.js | 2 ++ app/javascript/widget/i18n/index.js | 2 ++ config/initializers/languages.rb | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/i18n/index.js b/app/javascript/dashboard/i18n/index.js index 919fcef11..d0e85b43a 100644 --- a/app/javascript/dashboard/i18n/index.js +++ b/app/javascript/dashboard/i18n/index.js @@ -26,6 +26,7 @@ import pt_BR from './locale/pt_BR'; import ro from './locale/ro'; import ru from './locale/ru'; import sk from './locale/sk'; +import sr from './locale/sr'; import sv from './locale/sv'; import ta from './locale/ta'; import th from './locale/th'; @@ -66,6 +67,7 @@ export default { ro, ru, sk, + sr, sv, ta, th, diff --git a/app/javascript/survey/i18n/index.js b/app/javascript/survey/i18n/index.js index 5c3659a02..372017c5e 100644 --- a/app/javascript/survey/i18n/index.js +++ b/app/javascript/survey/i18n/index.js @@ -28,6 +28,7 @@ import pt_BR from './locale/pt_BR.json'; import ro from './locale/ro.json'; import ru from './locale/ru.json'; import sk from './locale/sk.json'; +import sr from './locale/sr.json'; import sv from './locale/sv.json'; import ta from './locale/ta.json'; import th from './locale/th.json'; @@ -68,6 +69,7 @@ export default { ro, ru, sk, + sr, sv, ta, th, diff --git a/app/javascript/widget/i18n/index.js b/app/javascript/widget/i18n/index.js index a76585069..8e602a4b5 100644 --- a/app/javascript/widget/i18n/index.js +++ b/app/javascript/widget/i18n/index.js @@ -28,6 +28,7 @@ import pt_BR from './locale/pt_BR.json'; import ro from './locale/ro.json'; import ru from './locale/ru.json'; import sk from './locale/sk.json'; +import sr from './locale/sr.json'; import sv from './locale/sv.json'; import ta from './locale/ta.json'; import th from './locale/th.json'; @@ -68,6 +69,7 @@ export default { ro, ru, sk, + sr, sv, ta, th, diff --git a/config/initializers/languages.rb b/config/initializers/languages.rb index 3f8a9f1b4..899359a4c 100644 --- a/config/initializers/languages.rb +++ b/config/initializers/languages.rb @@ -40,7 +40,8 @@ LANGUAGES_CONFIG = { 35 => { name: 'latviešu valoda (lv)', iso_639_3_code: 'lav', iso_639_1_code: 'lv', enabled: true }, 36 => { name: 'íslenska (is)', iso_639_3_code: 'isl', iso_639_1_code: 'is', enabled: true }, 37 => { name: 'עִברִית (he)', iso_639_3_code: 'heb', iso_639_1_code: 'he', enabled: true }, - 38 => { name: 'lietuvių (lt)', iso_639_3_code: 'lit', iso_639_1_code: 'lt', enabled: true } + 38 => { name: 'lietuvių (lt)', iso_639_3_code: 'lit', iso_639_1_code: 'lt', enabled: true }, + 39 => { name: 'Српски (sr)', iso_639_3_code: 'srp', iso_639_1_code: 'sr', enabled: true } }.filter { |_key, val| val[:enabled] }.freeze Rails.configuration.i18n.available_locales = LANGUAGES_CONFIG.map { |_index, lang| lang[:iso_639_1_code].to_sym } From 18e9e771b53246bc8d6115cf2ab350e764599012 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Wed, 13 Sep 2023 13:40:26 +0530 Subject: [PATCH 2/9] fix: Check body exists before deleting null bytes in Twilio (#7910) --- app/services/twilio/incoming_message_service.rb | 2 +- .../services/twilio/incoming_message_service_spec.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/services/twilio/incoming_message_service.rb b/app/services/twilio/incoming_message_service.rb index 097274d44..99295be0c 100644 --- a/app/services/twilio/incoming_message_service.rb +++ b/app/services/twilio/incoming_message_service.rb @@ -47,7 +47,7 @@ class Twilio::IncomingMessageService end def message_body - params[:Body].delete("\u0000") + params[:Body]&.delete("\u0000") end def set_contact diff --git a/spec/services/twilio/incoming_message_service_spec.rb b/spec/services/twilio/incoming_message_service_spec.rb index cf9d42874..1155ec265 100644 --- a/spec/services/twilio/incoming_message_service_spec.rb +++ b/spec/services/twilio/incoming_message_service_spec.rb @@ -37,6 +37,18 @@ describe Twilio::IncomingMessageService do expect(conversation.reload.messages.last.content).to eq('remove null bytes') end + it 'wont throw error when the body is empty' do + params = { + SmsSid: 'SMxx', + From: '+12345', + AccountSid: 'ACxxx', + MessagingServiceSid: twilio_channel.messaging_service_sid + } + + described_class.new(params: params).perform + expect(conversation.reload.messages.last.content).to be_nil + end + it 'creates a new conversation' do params = { SmsSid: 'SMxx', From 5e6e234afe0d4511881a5b85de3e12af2b3835e5 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Thu, 14 Sep 2023 08:49:37 +0530 Subject: [PATCH 3/9] feat (perf): Remove conversation count in contacts list view (#7915) Co-authored-by: Pranav Raj S --- .../api/v1/accounts/contacts_controller.rb | 21 ++++++++----------- .../contacts/components/ContactsTable.vue | 9 +------- .../v1/accounts/contacts_controller_spec.rb | 3 +-- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/app/controllers/api/v1/accounts/contacts_controller.rb b/app/controllers/api/v1/accounts/contacts_controller.rb index 587e082ce..d75dc71b5 100644 --- a/app/controllers/api/v1/accounts/contacts_controller.rb +++ b/app/controllers/api/v1/accounts/contacts_controller.rb @@ -18,7 +18,7 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController def index @contacts_count = resolved_contacts.count - @contacts = fetch_contacts_with_conversation_count(resolved_contacts) + @contacts = fetch_contacts(resolved_contacts) end def search @@ -29,7 +29,7 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController search: "%#{params[:q].strip}%" ) @contacts_count = contacts.count - @contacts = fetch_contacts_with_conversation_count(contacts) + @contacts = fetch_contacts(contacts) end def import @@ -63,7 +63,7 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController result = ::Contacts::FilterService.new(params.permit!, current_user).perform contacts = result[:contacts] @contacts_count = result[:count] - @contacts = fetch_contacts_with_conversation_count(contacts) + @contacts = fetch_contacts(contacts) end def contactable_inboxes @@ -125,17 +125,14 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController @current_page = params[:page] || 1 end - def fetch_contacts_with_conversation_count(contacts) - conversation_count_sub_query = 'SELECT COUNT(*) FROM "conversations" WHERE "conversations"."contact_id" = "contacts"."id"' - contacts_with_conversation_count = filtrate(contacts) - .select("contacts.*, (#{conversation_count_sub_query}) as conversations_count") - .group('contacts.id') - .includes([{ avatar_attachment: [:blob] }]) - .page(@current_page).per(RESULTS_PER_PAGE) + def fetch_contacts(contacts) + contacts_with_avatar = filtrate(contacts) + .includes([{ avatar_attachment: [:blob] }]) + .page(@current_page).per(RESULTS_PER_PAGE) - return contacts_with_conversation_count.includes([{ contact_inboxes: [:inbox] }]) if @include_contact_inboxes + return contacts_with_avatar.includes([{ contact_inboxes: [:inbox] }]) if @include_contact_inboxes - contacts_with_conversation_count + contacts_with_avatar end def build_contact_inbox diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue index d2b3c75ce..3c77653e9 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue @@ -1,6 +1,6 @@