Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3399909
D5583.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
D5583.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
@@ -138,43 +138,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
@@ -71,6 +71,8 @@
+username: string,
+disabled?: boolean,
+notice?: string,
- +alertText?: string,
- +alertTitle?: string,
+ +alert?: {
+ title: string,
+ text: string,
+ },
};
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
@@ -54,7 +54,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
@@ -54,11 +54,11 @@
onSelect = () => {
const { userInfo } = this.props;
- if (!userInfo.alertText) {
+ if (!userInfo.alert) {
this.props.onSelect(userInfo.id);
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
@@ -159,7 +159,9 @@
className={css.searchResultsButton}
>
<div className={css.userName}>{userSearchResult.username}</div>
- <div className={css.userInfo}>{userSearchResult.alertTitle}</div>
+ <div className={css.userInfo}>
+ {userSearchResult.alert?.title}
+ </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
@@ -16,7 +16,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) {
@@ -27,14 +27,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]);
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
Tue, Dec 3, 5:16 AM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610370
Default Alt Text
D5583.diff (6 KB)
Attached To
Mode
D5583: [web] Change alert type in UserListItem
Attached
Detach File
Event Timeline
Log In to Comment