From 5d650a0e263a0d5fad03c9693360414f7f4a9252 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Wed, 16 Sep 2026 03:08:40 +0200 Subject: [PATCH] webui v177: close the modal when its form has succeeded On master every create/post/add form ended its success path with popupMessage([h3 'Success' ...]), and popupMessage re-mounts #modal-container, so the form was replaced by the notice and the modal was effectively closed. The design-system branch swaps those notices for toast.success(), which does not touch the modal: the form stays open with its fields filled and its button live, and a second click creates the channel / forum / board / post / thread / identity again, re-adds the shared directory or the file, or re-sends the friend certificate. Every success branch now calls widget.closePopupMessage() before the toast. Failure branches keep the form open so the user can correct and retry, as before. The forum reply toast also says "Reply" rather than "Thread" when it was a reply. Sites: channel create/post, forum create/thread/reply, board create/post, add-friend Finish (both certificate kinds), identity create (signed and pseudonymous), identity edit (signed and pseudonymous), add shared directory, add file by link. Co-Authored-By: Claude Fable 5.1 --- webui-src/app/boards/board_view.js | 3 +++ webui-src/app/channels/channel_view.js | 12 +++++++++--- webui-src/app/files/files_downloads.js | 3 ++- webui-src/app/files/files_manager.js | 1 + webui-src/app/forums/forum_view.js | 10 +++++++--- webui-src/app/home.js | 2 ++ webui-src/app/main.js | 2 +- webui-src/app/people/people_ownids.js | 12 ++++++++++-- 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/webui-src/app/boards/board_view.js b/webui-src/app/boards/board_view.js index c01fdaf1..c39472c1 100644 --- a/webui-src/app/boards/board_view.js +++ b/webui-src/app/boards/board_view.js @@ -4,6 +4,7 @@ const boardKanban = require('boards/board_kanban'); const rs = require('rswebui'); const peopleUtil = require('people/people_util'); const icon = require('icon'); +const widget = require('widgets'); const { CommentsSection } = require('comments'); const toast = require('toast'); const Data = util.Data; @@ -119,6 +120,7 @@ function createboard() { }), }); if (res.body.retval && vnode.attrs.onCreated) await vnode.attrs.onCreated(); + if (res.body.retval) widget.closePopupMessage(); res.body.retval ? toast.success('Board created successfully') : toast.error(res.body.errorMessage || 'Error in creating Board'); @@ -263,6 +265,7 @@ function CreatePost() { if (res.body.retval) { Data.Posts[vnode.attrs.boardId] = {}; await util.updateDisplayBoards(vnode.attrs.boardId); + widget.closePopupMessage(); toast.success('Post created successfully'); } else { toast.error(res.body.error_message || res.body.errorMessage || 'The post could not be created'); diff --git a/webui-src/app/channels/channel_view.js b/webui-src/app/channels/channel_view.js index dd70c764..72950260 100644 --- a/webui-src/app/channels/channel_view.js +++ b/webui-src/app/channels/channel_view.js @@ -264,6 +264,9 @@ function createchannel() { if (res.body.retval) { await util.updatedisplaychannels(res.body.channelId, undefined, false); if (vnode.attrs.onCreated) await vnode.attrs.onCreated(); + // The form is done: close it before the toast, or a second + // click would create the channel again. + widget.closePopupMessage(); m.redraw(); } res.body.retval === false @@ -409,9 +412,12 @@ const AddPost = () => { files: pfiles, // does not work for now thumbnail: { mData: { base64: pthumbnail } }, }); - res.body.retval === false - ? toast.error(res.body.errorMessage) - : toast.success('Post added successfully'); + if (res.body.retval === false) { + toast.error(res.body.errorMessage); + } else { + widget.closePopupMessage(); + toast.success('Post added successfully'); + } util.updatedisplaychannels(vnode.attrs.chanId); m.redraw(); } diff --git a/webui-src/app/files/files_downloads.js b/webui-src/app/files/files_downloads.js index d7c41f3c..fb8e16ab 100644 --- a/webui-src/app/files/files_downloads.js +++ b/webui-src/app/files/files_downloads.js @@ -109,7 +109,8 @@ function addFile(url) { }, }, (status) => { - toast.info('Successfully added file!'); + widget.closePopupMessage(); + toast.success('Successfully added file!'); } ); } diff --git a/webui-src/app/files/files_manager.js b/webui-src/app/files/files_manager.js index af74f9f3..23fa9bf4 100644 --- a/webui-src/app/files/files_manager.js +++ b/webui-src/app/files/files_manager.js @@ -63,6 +63,7 @@ const AddSharedDirForm = () => { rs.rsJsonApiRequest('/rsFiles/addSharedDirectory', { ...newSharedDir }).then((res) => { if (res.body.retval) { loadSharedDirectories(); + widget.closePopupMessage(); } toast.result(res.body.retval, 'Directory shared', diff --git a/webui-src/app/forums/forum_view.js b/webui-src/app/forums/forum_view.js index 63e47007..d7e0f7a9 100644 --- a/webui-src/app/forums/forum_view.js +++ b/webui-src/app/forums/forum_view.js @@ -144,6 +144,7 @@ function createforum() { if (res.body.retval) { await util.updatedisplayforums(res.body.forumId); if (vnode.attrs.onCreated) await vnode.attrs.onCreated(); + widget.closePopupMessage(); m.redraw(); } res.body.retval === false @@ -473,9 +474,12 @@ const AddThread = () => { authorId: identity, }); - res.body.retval === false - ? toast.error(res.body.errorMessage) - : toast.success('Thread added successfully'); + if (res.body.retval === false) { + toast.error(res.body.errorMessage); + } else { + widget.closePopupMessage(); + toast.success(vnode.attrs.parent_thread !== '' ? 'Reply added successfully' : 'Thread added successfully'); + } util.updatedisplayforums(vnode.attrs.forumId); m.redraw(); }, diff --git a/webui-src/app/home.js b/webui-src/app/home.js index 65f57134..35627925 100644 --- a/webui-src/app/home.js +++ b/webui-src/app/home.js @@ -199,6 +199,7 @@ function confirmAddPrompt(details, cert, long) { if (res.body.retval) { NetworkData.rememberPendingFriend(details); await refreshFriendLists(details.gpg_id || details.pgpId); + widget.closePopupMessage(); toast.success('Successfully added friend.'); } else { toast.error('An error occoured during adding. Friend not added.'); @@ -216,6 +217,7 @@ function confirmAddPrompt(details, cert, long) { if (res.body.retval) { NetworkData.rememberPendingFriend(details); await refreshFriendLists(details.gpg_id || details.pgpId); + widget.closePopupMessage(); toast.success('Successfully added friend.'); } else { toast.error('An error occoured during adding. Friend not added.'); diff --git a/webui-src/app/main.js b/webui-src/app/main.js index e87fb16a..626f419e 100644 --- a/webui-src/app/main.js +++ b/webui-src/app/main.js @@ -2,7 +2,7 @@ const m = require('mithril'); // Bumped at every change of the web UI; shown in the rail, the phone header // and the Debug page. -const WEBUI_VERSION = 'v176'; +const WEBUI_VERSION = 'v177'; const login = require('login'); const rs = require('rswebui'); diff --git a/webui-src/app/people/people_ownids.js b/webui-src/app/people/people_ownids.js index aa8034dd..9de17b2d 100644 --- a/webui-src/app/people/people_ownids.js +++ b/webui-src/app/people/people_ownids.js @@ -25,7 +25,10 @@ const SignedIdentity = () => { // Cleared here, not only in .catch(): a refused passphrase is a // valid answer, and the button would otherwise stay on "Creating…". submitting = false; - if (data && data.retval) await peopleUtil.refreshOwnIds(previousIds); + if (data && data.retval) { + await peopleUtil.refreshOwnIds(previousIds); + widget.closePopupMessage(); + } const message = data && data.retval ? 'Successfully created identity.' : 'Could not create the identity. Check your profile password and try again.'; @@ -145,7 +148,10 @@ const CreateIdentity = () => { pseudonimous, }, async (data) => { - if (data.retval) await peopleUtil.refreshOwnIds(); + if (data.retval) { + await peopleUtil.refreshOwnIds(); + widget.closePopupMessage(); + } const message = data.retval ? 'Successfully created identity.' : 'An error occured while creating identity.'; @@ -195,6 +201,7 @@ const SignedEditIdentity = () => { pgpPassword: passphrase, }, (data) => { + if (data && data.retval) widget.closePopupMessage(); const message = data && data.retval ? 'Identity updated.' : 'Could not update the identity. Check your profile password and try again.'; @@ -291,6 +298,7 @@ const EditIdentity = () => { pseudonimous: true, }, (data) => { + if (data && data.retval) widget.closePopupMessage(); const message = data && data.retval ? 'Identity updated.' : 'Could not update the identity.';