This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 0434c6480 fix(settings): offer the DingTalk secret clear control after 
saving (#6931)
0434c6480 is described below

commit 0434c6480e0be95422b675b83a8b12108b360bfc
Author: Chstercc <[email protected]>
AuthorDate: Fri Nov 27 11:53:06 2026 +0800

    fix(settings): offer the DingTalk secret clear control after saving (#6931)
---
 web/src/pages/settings/GeneralSettingsTab.tsx              |  6 ++++++
 .../pages/settings/__tests__/GeneralSettingsTab.test.tsx   | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/web/src/pages/settings/GeneralSettingsTab.tsx 
b/web/src/pages/settings/GeneralSettingsTab.tsx
index f7f8d9d52..8db27bed8 100644
--- a/web/src/pages/settings/GeneralSettingsTab.tsx
+++ b/web/src/pages/settings/GeneralSettingsTab.tsx
@@ -152,6 +152,12 @@ export const GeneralSettingsTab = () => {
       await saveGeneralSettings(buildPayload({ ...base, ...patch }));
       const statePatch = { ...patch };
       delete statePatch.clearDingtalkSigningSecret;
+      // The save endpoint echoes nothing back and the fresh read predates the 
write, so a
+      // secret stored by this request has to mark itself configured here. The 
clear path
+      // already carries `dingtalkSigningSecretConfigured: false` in its own 
patch.
+      if (patch.dingtalkSigningSecret?.trim()) {
+        statePatch.dingtalkSigningSecretConfigured = true;
+      }
       setSettings({ ...base, ...statePatch });
       return true;
     } catch {
diff --git a/web/src/pages/settings/__tests__/GeneralSettingsTab.test.tsx 
b/web/src/pages/settings/__tests__/GeneralSettingsTab.test.tsx
index 2cf1f3e76..7abb795cd 100644
--- a/web/src/pages/settings/__tests__/GeneralSettingsTab.test.tsx
+++ b/web/src/pages/settings/__tests__/GeneralSettingsTab.test.tsx
@@ -335,4 +335,18 @@ describe('GeneralSettingsTab', () => {
       ),
     );
   });
+
+  it('offers the clear control immediately after saving a signing secret', 
async () => {
+    vi.mocked(saveGeneralSettings).mockResolvedValue();
+    const user = userEvent.setup();
+    renderTab();
+
+    const secretInput = await screen.findByPlaceholderText('SEC...');
+    await user.type(secretInput, 'SEC-just-saved');
+    fireEvent.submit(secretInput.closest('form')!);
+
+    // The button is queried by its text because antd's loading icon (still 
animating out in
+    // jsdom) contributes an aria-label to the accessible name during the save.
+    expect((await 
screen.findByText('清除钉钉签名密钥')).closest('button')).not.toBeNull();
+  });
 });

Reply via email to