From b4d137c0de02c992f6da0579ff2d66df703acbca Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 5 Mar 2026 12:30:26 +0200 Subject: [PATCH] remove flash --- app/controllers/mcp_settings_controller.rb | 4 ++-- app/views/mcp_settings/index.html.erb | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/mcp_settings_controller.rb b/app/controllers/mcp_settings_controller.rb index a6d7597e..78ee4681 100644 --- a/app/controllers/mcp_settings_controller.rb +++ b/app/controllers/mcp_settings_controller.rb @@ -15,9 +15,9 @@ class McpSettingsController < ApplicationController @mcp_token = current_user.mcp_tokens.new(mcp_token_params) if @mcp_token.save - flash[:mcp_token] = @mcp_token.token + @mcp_tokens = [@mcp_token] - redirect_back fallback_location: settings_mcp_index_path, notice: I18n.t('mcp_token_has_been_created') + render :index, status: :created else render turbo_stream: turbo_stream.replace(:modal, template: 'mcp_settings/new'), status: :unprocessable_content end diff --git a/app/views/mcp_settings/index.html.erb b/app/views/mcp_settings/index.html.erb index b276cf0d..736f011b 100644 --- a/app/views/mcp_settings/index.html.erb +++ b/app/views/mcp_settings/index.html.erb @@ -14,7 +14,7 @@ - <% if flash[:mcp_token].present? %> + <% if @mcp_token.present? %>
@@ -22,8 +22,8 @@ <%= t('please_copy_the_token_below_now_as_it_wont_be_shown_again') %>:
- - <%= render 'shared/clipboard_copy', icon: 'copy', text: flash[:mcp_token], class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: t('copy'), copied_title: t('copied') %> + + <%= render 'shared/clipboard_copy', icon: 'copy', text: @mcp_token.token, class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: t('copy'), copied_title: t('copied') %>
@@ -31,12 +31,12 @@

<%= t('instructions') %>

-
+

<%= t('connect_to_docuseal_mcp') %>

<%= t('add_the_following_to_your_mcp_client_configuration') %>:

- <% text = JSON.pretty_generate({ mcpServers: { docuseal: { type: 'http', url: "#{root_url(Docuseal.default_url_options)}mcp", headers: { Authorization: "Bearer #{flash[:mcp_token]}" } } } }).strip %> + <% text = JSON.pretty_generate({ mcpServers: { docuseal: { type: 'http', url: "#{root_url(Docuseal.default_url_options)}mcp", headers: { Authorization: "Bearer #{@mcp_token.token}" } } } }).strip %> <%= render 'shared/clipboard_copy', icon: 'copy', text:, class: 'btn btn-ghost text-white', icon_class: 'w-6 h-6 text-white', copy_title: t('copy'), copied_title: t('copied') %> @@ -72,8 +72,8 @@ <%= mcp_token.name %> - <% if flash[:mcp_token].present? && mcp_token.token_prefix == flash[:mcp_token][0, 5] %> - <%= flash[:mcp_token] %> + <% if @mcp_token.present? && mcp_token.id == @mcp_token.id %> + <%= @mcp_token.token %> <% else %> <%= "#{mcp_token.token_prefix}#{'*' * 38}" %> <% end %>