diff --git a/app/controllers/public/api/v1/portals/articles_controller.rb b/app/controllers/public/api/v1/portals/articles_controller.rb index 02023559b..e6cc2aa69 100644 --- a/app/controllers/public/api/v1/portals/articles_controller.rb +++ b/app/controllers/public/api/v1/portals/articles_controller.rb @@ -17,7 +17,9 @@ class Public::Api::V1::Portals::ArticlesController < Public::Api::V1::Portals::B limit_results end - def show; end + def show + @og_image_url = helpers.set_og_image_url(@portal.name, @article.title) + end def tracking_pixel @article = @portal.articles.find_by(slug: permitted_params[:article_slug]) diff --git a/app/controllers/public/api/v1/portals/categories_controller.rb b/app/controllers/public/api/v1/portals/categories_controller.rb index c3a7b59e9..ebfcb310a 100644 --- a/app/controllers/public/api/v1/portals/categories_controller.rb +++ b/app/controllers/public/api/v1/portals/categories_controller.rb @@ -8,7 +8,9 @@ class Public::Api::V1::Portals::CategoriesController < Public::Api::V1::Portals: @categories = @portal.categories.order(position: :asc) end - def show; end + def show + @og_image_url = helpers.set_og_image_url(@portal.name, @category.name) + end private diff --git a/app/controllers/public/api/v1/portals_controller.rb b/app/controllers/public/api/v1/portals_controller.rb index e8fb867cb..df4552432 100644 --- a/app/controllers/public/api/v1/portals_controller.rb +++ b/app/controllers/public/api/v1/portals_controller.rb @@ -4,7 +4,9 @@ class Public::Api::V1::PortalsController < Public::Api::V1::Portals::BaseControl before_action :redirect_to_portal_with_locale, only: [:show] layout 'portal' - def show; end + def show + @og_image_url = helpers.set_og_image_url('', @portal.header_text) + end def sitemap @help_center_url = @portal.custom_domain || ChatwootApp.help_center_root diff --git a/app/helpers/message_format_helper.rb b/app/helpers/message_format_helper.rb index 2c50fd609..8b271e3a3 100644 --- a/app/helpers/message_format_helper.rb +++ b/app/helpers/message_format_helper.rb @@ -1,9 +1,13 @@ module MessageFormatHelper - include RegexHelper - def transform_user_mention_content(message_content) # attachment message without content, message_content is nil - message_content.presence ? message_content.gsub(MENTION_REGEX, '\1') : '' + return '' unless message_content.presence + + # Use CommonMarker to convert markdown to plain text for notifications + # This handles all markdown formatting (links, bold, italic, etc.) not just mentions + # Converts: [@👍 customer support](mention://team/1/%F0%9F%91%8D%20customer%20support) + # To: @👍 customer support + CommonMarker.render_doc(message_content).to_plaintext.strip end def render_message_content(message_content) diff --git a/app/helpers/portal_helper.rb b/app/helpers/portal_helper.rb index 2b1ab7b21..3ed303556 100644 --- a/app/helpers/portal_helper.rb +++ b/app/helpers/portal_helper.rb @@ -1,4 +1,21 @@ module PortalHelper + def set_og_image_url(portal_name, title) + cdn_url = GlobalConfig.get('OG_IMAGE_CDN_URL')['OG_IMAGE_CDN_URL'] + return if cdn_url.blank? + + client_ref = GlobalConfig.get('OG_IMAGE_CLIENT_REF')['OG_IMAGE_CLIENT_REF'] + + uri = URI.parse(cdn_url) + uri.path = '/og' + uri.query = URI.encode_www_form( + clientRef: client_ref, + title: title, + portalName: portal_name + ) + + uri.to_s + end + def generate_portal_bg_color(portal_color, theme) base_color = theme == 'dark' ? 'black' : 'white' "color-mix(in srgb, #{portal_color} 20%, #{base_color})" diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue index 7a3489265..cdcbd64b5 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue @@ -39,15 +39,21 @@ const chatMetadata = computed(() => props.chat.meta); const backButtonUrl = computed(() => { const { - params: { inbox_id: inboxId, label, teamId }, + params: { inbox_id: inboxId, label, teamId, id: customViewId }, name, } = route; + + const conversationTypeMap = { + conversation_through_mentions: 'mention', + conversation_through_unattended: 'unattended', + }; return conversationListPageURL({ - accountId, + accountId: accountId.value, inboxId, label, teamId, - conversationType: name === 'conversation_mentions' ? 'mention' : '', + conversationType: conversationTypeMap[name], + customViewId, }); }); diff --git a/app/javascript/dashboard/components/widgets/conversation/VariableList.vue b/app/javascript/dashboard/components/widgets/conversation/VariableList.vue index 1b935ad29..30e45749b 100644 --- a/app/javascript/dashboard/components/widgets/conversation/VariableList.vue +++ b/app/javascript/dashboard/components/widgets/conversation/VariableList.vue @@ -1,6 +1,7 @@