Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3489252
D4364.id13841.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D4364.id13841.diff
View Options
diff --git a/web/settings/relationship/add-users-list.css b/web/settings/relationship/add-users-list.css
--- a/web/settings/relationship/add-users-list.css
+++ b/web/settings/relationship/add-users-list.css
@@ -52,3 +52,12 @@
visibility: hidden;
height: 0;
}
+
+.error {
+ padding-bottom: 8px;
+ font-size: var(--s-font-14);
+ line-height: var(--line-height-display);
+ color: var(--error);
+ padding-left: 6px;
+ font-style: italic;
+}
diff --git a/web/settings/relationship/add-users-list.react.js b/web/settings/relationship/add-users-list.react.js
--- a/web/settings/relationship/add-users-list.react.js
+++ b/web/settings/relationship/add-users-list.react.js
@@ -185,15 +185,22 @@
[filteredUsers, selectUser],
);
+ const [errorMessage, setErrorMessage] = React.useState('');
const callUpdateRelationships = useServerCall(updateRelationships);
const dispatchActionPromise = useDispatchActionPromise();
const updateRelationshipsPromiseCreator = React.useCallback(async () => {
- const result = await callUpdateRelationships({
- action: relationshipAction,
- userIDs: Array.from(pendingUserIDs),
- });
- closeModal();
- return result;
+ try {
+ setErrorMessage('');
+ const result = await callUpdateRelationships({
+ action: relationshipAction,
+ userIDs: Array.from(pendingUserIDs),
+ });
+ closeModal();
+ return result;
+ } catch (e) {
+ setErrorMessage('unknown error');
+ throw e;
+ }
}, [callUpdateRelationships, closeModal, pendingUserIDs, relationshipAction]);
const confirmSelection = React.useCallback(
() =>
@@ -214,10 +221,16 @@
);
}
+ let errors = null;
+ if (errorMessage.length > 0) {
+ errors = <div className={css.error}>{errorMessage}</div>;
+ }
+
return (
<div className={css.container}>
{userTags}
<div className={css.userRowsContainer}>{userRows}</div>
+ {errors}
<div className={css.buttons}>
<Button variant="secondary" onClick={closeModal}>
Cancel
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 11:55 AM (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677242
Default Alt Text
D4364.id13841.diff (2 KB)
Attached To
Mode
D4364: [web] Display an error message when adding new user failed
Attached
Detach File
Event Timeline
Log In to Comment