Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3488586
D8223.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D8223.diff
View Options
diff --git a/lib/shared/search-utils.js b/lib/shared/search-utils.js
--- a/lib/shared/search-utils.js
+++ b/lib/shared/search-utils.js
@@ -172,43 +172,51 @@
relationshipStatus,
...result
}) => {
- let notice, alertText, alertTitle;
+ let notice, alert;
const username = result.username;
if (blockedRelationshipsStatuses.has(relationshipStatus)) {
notice = 'user is blocked';
- alertTitle = 'User is blocked';
- alertText =
- `Before you add ${username} to this chat, ` +
- 'you’ll need to unblock them. You can do this from the Block List ' +
- 'in the Profile tab.';
+ alert = {
+ title: 'User is blocked',
+ text:
+ `Before you add ${username} to this chat, ` +
+ 'you’ll need to unblock them. You can do this from the Block List ' +
+ 'in the Profile tab.',
+ };
} else if (!isMemberOfContainingThread && containingThreadInfo) {
if (threadType !== threadTypes.SIDEBAR) {
notice = 'not in community';
- alertTitle = 'Not in community';
- alertText = 'You can only add members of the community to this chat';
+ alert = {
+ title: 'Not in community',
+ text: 'You can only add members of the community to this chat',
+ };
} else {
notice = 'not in parent chat';
- alertTitle = 'Not in parent chat';
- alertText = 'You can only add members of the parent chat to a thread';
+ alert = {
+ title: 'Not in parent chat',
+ text: 'You can only add members of the parent chat to a thread',
+ };
}
} else if (
!containingThreadInfo &&
relationshipStatus !== userRelationshipStatus.FRIEND
) {
notice = notFriendNotice;
- alertTitle = 'Not a friend';
- alertText =
- `Before you add ${username} to this chat, ` +
- 'you’ll need to send them a friend request. ' +
- 'You can do this from the Friend List in the Profile tab.';
+ alert = {
+ title: 'Not a friend',
+ text:
+ `Before you add ${username} to this chat, ` +
+ 'you’ll need to send them a friend request. ' +
+ 'You can do this from the Friend List in the Profile tab.',
+ };
} else if (parentThreadInfo && !isMemberOfParentThread) {
notice = 'not in parent chat';
}
if (notice) {
result = { ...result, notice };
}
- if (alertTitle) {
- result = { ...result, alertTitle, alertText };
+ if (alert) {
+ result = { ...result, alert };
}
return result;
},
diff --git a/lib/types/user-types.js b/lib/types/user-types.js
--- a/lib/types/user-types.js
+++ b/lib/types/user-types.js
@@ -134,6 +134,9 @@
...AccountUserInfo,
+disabled?: boolean,
+notice?: string,
- +alertText?: string,
- +alertTitle?: string,
+ +alert?: {
+ +text: string,
+ +title: string,
+ },
+ +avatar?: ?ClientAvatar,
};
diff --git a/native/chat/message-list-thread-search.react.js b/native/chat/message-list-thread-search.react.js
--- a/native/chat/message-list-thread-search.react.js
+++ b/native/chat/message-list-thread-search.react.js
@@ -52,7 +52,7 @@
continue;
}
nonFriendsSet.add(searchResult.id);
- const { alertText, alertTitle, ...rest } = searchResult;
+ const { alert, ...rest } = searchResult;
userListItemsArr.push(rest);
}
return [userListItemsArr, nonFriendsSet];
diff --git a/native/components/user-list-user.react.js b/native/components/user-list-user.react.js
--- a/native/components/user-list-user.react.js
+++ b/native/components/user-list-user.react.js
@@ -57,13 +57,12 @@
onSelect = () => {
const { userInfo } = this.props;
- if (!userInfo.alertText) {
- const { alertText, alertTitle, notice, disabled, ...accountUserInfo } =
- userInfo;
+ if (!userInfo.alert) {
+ const { alert, notice, disabled, ...accountUserInfo } = userInfo;
this.props.onSelect(accountUserInfo);
return;
}
- Alert.alert(userInfo.alertTitle, userInfo.alertText, [{ text: 'OK' }], {
+ Alert.alert(userInfo.alert.title, userInfo.alert.text, [{ text: 'OK' }], {
cancelable: true,
});
};
diff --git a/web/chat/chat-thread-composer.react.js b/web/chat/chat-thread-composer.react.js
--- a/web/chat/chat-thread-composer.react.js
+++ b/web/chat/chat-thread-composer.react.js
@@ -111,7 +111,7 @@
const userItems = userListItemsWithENSNames.map(
(userSearchResult: UserListItem) => {
- const { alertTitle, alertText, notice, disabled, ...accountUserInfo } =
+ const { alert, notice, disabled, ...accountUserInfo } =
userSearchResult;
return (
<li key={userSearchResult.id} className={css.searchResultsItem}>
@@ -124,7 +124,7 @@
<UserAvatar size="small" userID={userSearchResult.id} />
<div className={css.userName}>{userSearchResult.username}</div>
</div>
- <div className={css.userInfo}>{userSearchResult.alertTitle}</div>
+ <div className={css.userInfo}>{userSearchResult.notice}</div>
</Button>
</li>
);
diff --git a/web/modals/components/add-members-item.react.js b/web/modals/components/add-members-item.react.js
--- a/web/modals/components/add-members-item.react.js
+++ b/web/modals/components/add-members-item.react.js
@@ -17,7 +17,7 @@
function AddMemberItem(props: AddMembersItemProps): React.Node {
const { userInfo, onClick, userAdded = false } = props;
- const canBeAdded = !userInfo.alertText;
+ const canBeAdded = !userInfo.alert;
const onClickCallback = React.useCallback(() => {
if (!canBeAdded) {
@@ -28,14 +28,14 @@
const action = React.useMemo(() => {
if (!canBeAdded) {
- return userInfo.alertTitle;
+ return userInfo.alert?.title;
}
if (userAdded) {
return <span className={css.danger}>Remove</span>;
} else {
return 'Add';
}
- }, [canBeAdded, userAdded, userInfo.alertTitle]);
+ }, [canBeAdded, userAdded, userInfo.alert?.title]);
return (
<Button
diff --git a/web/modals/threads/members/add-members-list-content.react.js b/web/modals/threads/members/add-members-list-content.react.js
--- a/web/modals/threads/members/add-members-list-content.react.js
+++ b/web/modals/threads/members/add-members-list-content.react.js
@@ -20,7 +20,7 @@
props;
const usersAvailableToAdd = React.useMemo(
- () => userListItems.filter(user => !user.alertText),
+ () => userListItems.filter(user => !user.alert),
[userListItems],
);
@@ -50,7 +50,7 @@
);
const usersUnavailableToAdd = React.useMemo(() => {
- const usersUnavailable = userListItems.filter(user => user.alertText);
+ const usersUnavailable = userListItems.filter(user => user.alert);
if (!usersUnavailable.length) {
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 10:47 AM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676779
Default Alt Text
D8223.diff (6 KB)
Attached To
Mode
D8223: [web] Change alert type in UserListItem
Attached
Detach File
Event Timeline
Log In to Comment