diff --git a/app/controllers/api/v1/widget/conversations_controller.rb b/app/controllers/api/v1/widget/conversations_controller.rb index cc1b16b75..3b0a460e4 100644 --- a/app/controllers/api/v1/widget/conversations_controller.rb +++ b/app/controllers/api/v1/widget/conversations_controller.rb @@ -45,7 +45,10 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController end def toggle_status - head :not_found && return if conversation.nil? + return head :not_found if conversation.nil? + + return head :forbidden unless @web_widget.end_conversation? + unless conversation.resolved? conversation.status = :resolved conversation.save diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 538d6d5f0..83a28de43 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -395,7 +395,8 @@ "FEATURES": { "LABEL": "Features", "DISPLAY_FILE_PICKER": "Display file picker on the widget", - "DISPLAY_EMOJI_PICKER": "Display emoji picker on the widget" + "DISPLAY_EMOJI_PICKER": "Display emoji picker on the widget", + "ALLOW_END_CONVERSATION": "Allow users to end conversation from the widget" }, "SETTINGS_POPUP": { "MESSENGER_HEADING": "Messenger Script", diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index 31f435a82..5b29091f7 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -285,6 +285,17 @@ {{ $t('INBOX_MGMT.FEATURES.DISPLAY_EMOJI_PICKER') }} +
+ + +