diff --git a/.husky/pre-commit b/.husky/pre-commit index 2525dde4e..adda426ad 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,11 +1,11 @@ -# #!/bin/sh -# . "$(dirname "$0")/_/husky.sh" +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" -# # lint js and vue files -# npx --no-install lint-staged +# lint js and vue files +npx --no-install lint-staged -# # lint only staged ruby files -# git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop --force-exclusion -a +# lint only staged ruby files +git diff --name-only --cached | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop --force-exclusion -a -# # stage rubocop changes to files -# git diff --name-only --cached | xargs git add +# stage rubocop changes to files +git diff --name-only --cached | xargs git add diff --git a/Gemfile b/Gemfile index 45e194e13..e8639a5bd 100644 --- a/Gemfile +++ b/Gemfile @@ -94,7 +94,7 @@ gem 'twitty', '~> 0.1.5' # facebook client gem 'koala' # slack client -gem 'slack-ruby-client', '~> 2.2.0' +gem 'slack-ruby-client', '~> 2.5.1' # for dialogflow integrations gem 'google-cloud-dialogflow-v2', '>= 0.24.0' gem 'grpc' @@ -138,9 +138,7 @@ gem 'procore-sift' # parse email gem 'email_reply_trimmer' -# TODO: we might have to fork this gem since 0.3.1 has hard depency on nokogir 1.10. -# and this gem hasn't been updated for a while. -gem 'html2text', git: 'https://github.com/chatwoot/html2text_ruby', branch: 'chatwoot' +gem 'html2text' # to calculate working hours gem 'working_hours' diff --git a/Gemfile.lock b/Gemfile.lock index fa45d1e89..080883b67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,14 +22,6 @@ GIT devise (>= 4.0.0, < 5.0.0) railties (>= 5.0.0, < 8.0.0) -GIT - remote: https://github.com/chatwoot/html2text_ruby - revision: cdbdbbbf898d846d0136d69d688a003c6b26074b - branch: chatwoot - specs: - html2text (0.3.1) - nokogiri (>= 1.13.6) - GEM remote: https://rubygems.org/ specs: @@ -280,7 +272,8 @@ GEM googleauth (~> 1.0) grpc (~> 1.36) geocoder (1.8.1) - gli (2.21.1) + gli (2.22.2) + ostruct globalid (1.2.1) activesupport (>= 6.1) gmail_xoauth (0.4.3) @@ -361,6 +354,8 @@ GEM hana (1.3.7) hashdiff (1.1.0) hashie (5.0.0) + html2text (0.4.0) + nokogiri (>= 1.0, < 2.0) http (5.1.1) addressable (~> 2.8) http-cookie (~> 1.0) @@ -503,14 +498,14 @@ GEM newrelic_rpm (9.6.0) base64 nio4r (2.7.3) - nokogiri (1.17.1) + nokogiri (1.18.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.17.1-arm64-darwin) + nokogiri (1.18.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.17.1-x86_64-darwin) + nokogiri (1.18.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.17.1-x86_64-linux) + nokogiri (1.18.2-x86_64-linux-gnu) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -543,6 +538,7 @@ GEM openssl (3.2.0) orm_adapter (0.5.0) os (1.1.4) + ostruct (0.6.1) parallel (1.23.0) parser (3.2.2.1) ast (~> 2.4.1) @@ -565,7 +561,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (2.2.10) + rack (2.2.11) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-contrib (2.5.0) @@ -751,12 +747,13 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - slack-ruby-client (2.2.0) + slack-ruby-client (2.5.1) faraday (>= 2.0) faraday-mashify faraday-multipart gli hashie + logger snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) @@ -897,7 +894,7 @@ DEPENDENCIES haikunator hairtrigger hashie - html2text! + html2text image_processing jbuilder json_refs @@ -957,7 +954,7 @@ DEPENDENCIES sidekiq (>= 7.3.1) sidekiq-cron (>= 1.12.0) simplecov (= 0.17.1) - slack-ruby-client (~> 2.2.0) + slack-ruby-client (~> 2.5.1) spring spring-watcher-listen squasher diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 6ddaab73b..f63e8f6bf 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -7,13 +7,17 @@ class DashboardController < ActionController::Base around_action :switch_locale before_action :ensure_installation_onboarding, only: [:index] before_action :render_hc_if_custom_domain, only: [:index] - + before_action :ensure_html_format layout 'vueapp' def index; end private + def ensure_html_format + head :not_acceptable unless request.format.html? + end + def set_global_config @global_config = GlobalConfig.get( 'LOGO', 'LOGO_DARK', 'LOGO_THUMBNAIL', diff --git a/app/helpers/super_admin/account_features_helper.rb b/app/helpers/super_admin/account_features_helper.rb index 759aec134..515c82000 100644 --- a/app/helpers/super_admin/account_features_helper.rb +++ b/app/helpers/super_admin/account_features_helper.rb @@ -6,4 +6,14 @@ module SuperAdmin::AccountFeaturesHelper def self.account_premium_features account_features.filter { |feature| feature['premium'] }.pluck('name') end + + # Accepts account.features as argument + def self.filtered_features(features) + deployment_env = GlobalConfig.get_value('DEPLOYMENT_ENV') + return features if deployment_env == 'cloud' + + # Filter out internal features for non-cloud environments + internal_features = account_features.select { |f| f['chatwoot_internal'] }.pluck('name') + features.except(*internal_features) + end end diff --git a/app/javascript/dashboard/components-next/Campaigns/Pages/CampaignPage/LiveChatCampaign/LiveChatCampaignDialog.vue b/app/javascript/dashboard/components-next/Campaigns/Pages/CampaignPage/LiveChatCampaign/LiveChatCampaignDialog.vue index 2c4b9848c..ea76c6130 100644 --- a/app/javascript/dashboard/components-next/Campaigns/Pages/CampaignPage/LiveChatCampaign/LiveChatCampaignDialog.vue +++ b/app/javascript/dashboard/components-next/Campaigns/Pages/CampaignPage/LiveChatCampaign/LiveChatCampaignDialog.vue @@ -21,11 +21,11 @@ const addCampaign = async campaignDetails => { type: CAMPAIGN_TYPES.ONGOING, }); - useAlert(t('CAMPAIGN.SMS.CREATE.FORM.API.SUCCESS_MESSAGE')); + useAlert(t('CAMPAIGN.LIVE_CHAT.CREATE.FORM.API.SUCCESS_MESSAGE')); } catch (error) { const errorMessage = error?.response?.message || - t('CAMPAIGN.SMS.CREATE.FORM.API.ERROR_MESSAGE'); + t('CAMPAIGN.LIVE_CHAT.CREATE.FORM.API.ERROR_MESSAGE'); useAlert(errorMessage); } }; diff --git a/app/javascript/dashboard/components-next/Contacts/ContactsDetailsLayout.vue b/app/javascript/dashboard/components-next/Contacts/ContactsDetailsLayout.vue index ad007af1c..57c4ba7c8 100644 --- a/app/javascript/dashboard/components-next/Contacts/ContactsDetailsLayout.vue +++ b/app/javascript/dashboard/components-next/Contacts/ContactsDetailsLayout.vue @@ -8,17 +8,17 @@ import Breadcrumb from 'dashboard/components-next/breadcrumb/Breadcrumb.vue'; import ComposeConversation from 'dashboard/components-next/NewConversation/ComposeConversation.vue'; const props = defineProps({ - buttonLabel: { - type: String, - default: '', - }, selectedContact: { type: Object, default: () => ({}), }, + isUpdating: { + type: Boolean, + default: false, + }, }); -const emit = defineEmits(['goToContactsList']); +const emit = defineEmits(['goToContactsList', 'toggleBlock']); const { t } = useI18n(); const slots = useSlots(); @@ -45,9 +45,17 @@ const breadcrumbItems = computed(() => { return items; }); +const isContactBlocked = computed(() => { + return props.selectedContact?.blocked; +}); + const handleBreadcrumbClick = () => { emit('goToContactsList'); }; + +const toggleBlock = () => { + emit('toggleBlock', isContactBlocked.value); +};