Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions webui-src/app/boards/board_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
12 changes: 9 additions & 3 deletions webui-src/app/channels/channel_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion webui-src/app/files/files_downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ function addFile(url) {
},
},
(status) => {
toast.info('Successfully added file!');
widget.closePopupMessage();
toast.success('Successfully added file!');
}
);
}
Expand Down
1 change: 1 addition & 0 deletions webui-src/app/files/files_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 7 additions & 3 deletions webui-src/app/forums/forum_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
},
Expand Down
2 changes: 2 additions & 0 deletions webui-src/app/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand All @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion webui-src/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
12 changes: 10 additions & 2 deletions webui-src/app/people/people_ownids.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down Expand Up @@ -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.';
Expand Down Expand Up @@ -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.';
Expand Down Expand Up @@ -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.';
Expand Down