mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
Remove ability to add bot as a friend.
This commit is contained in:
parent
f548d91a7c
commit
c5a36b09d9
2 changed files with 60 additions and 55 deletions
|
@ -190,12 +190,15 @@ export const UserProfile = observer(
|
|||
<Edit size={28} />
|
||||
</IconButton>
|
||||
)}
|
||||
{(user.relationship === RelationshipStatus.Incoming ||
|
||||
user.relationship === RelationshipStatus.None) && (
|
||||
<IconButton onClick={() => user.addFriend()}>
|
||||
<UserPlus size={28} />
|
||||
</IconButton>
|
||||
)}
|
||||
{!user.bot &&
|
||||
(user.relationship ===
|
||||
RelationshipStatus.Incoming ||
|
||||
user.relationship ===
|
||||
RelationshipStatus.None) && (
|
||||
<IconButton onClick={() => user.addFriend()}>
|
||||
<UserPlus size={28} />
|
||||
</IconButton>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.tabs}>
|
||||
<div
|
||||
|
|
|
@ -585,58 +585,60 @@ function ContextMenus(props: Props) {
|
|||
}
|
||||
|
||||
if (user) {
|
||||
let actions: Action["action"][];
|
||||
switch (user.relationship) {
|
||||
case RelationshipStatus.User:
|
||||
actions = [];
|
||||
break;
|
||||
case RelationshipStatus.Friend:
|
||||
actions = ["remove_friend", "block_user"];
|
||||
break;
|
||||
case RelationshipStatus.Incoming:
|
||||
actions = [
|
||||
"add_friend",
|
||||
"cancel_friend",
|
||||
"block_user",
|
||||
];
|
||||
break;
|
||||
case RelationshipStatus.Outgoing:
|
||||
actions = ["cancel_friend", "block_user"];
|
||||
break;
|
||||
case RelationshipStatus.Blocked:
|
||||
actions = ["unblock_user"];
|
||||
break;
|
||||
case RelationshipStatus.BlockedOther:
|
||||
actions = ["block_user"];
|
||||
break;
|
||||
case RelationshipStatus.None:
|
||||
default:
|
||||
actions = ["add_friend", "block_user"];
|
||||
}
|
||||
if (!user.bot) {
|
||||
let actions: Action["action"][];
|
||||
switch (user.relationship) {
|
||||
case RelationshipStatus.User:
|
||||
actions = [];
|
||||
break;
|
||||
case RelationshipStatus.Friend:
|
||||
actions = ["remove_friend", "block_user"];
|
||||
break;
|
||||
case RelationshipStatus.Incoming:
|
||||
actions = [
|
||||
"add_friend",
|
||||
"cancel_friend",
|
||||
"block_user",
|
||||
];
|
||||
break;
|
||||
case RelationshipStatus.Outgoing:
|
||||
actions = ["cancel_friend", "block_user"];
|
||||
break;
|
||||
case RelationshipStatus.Blocked:
|
||||
actions = ["unblock_user"];
|
||||
break;
|
||||
case RelationshipStatus.BlockedOther:
|
||||
actions = ["block_user"];
|
||||
break;
|
||||
case RelationshipStatus.None:
|
||||
default:
|
||||
actions = ["add_friend", "block_user"];
|
||||
}
|
||||
|
||||
if (userPermissions & UserPermission.ViewProfile) {
|
||||
generateAction({
|
||||
action: "view_profile",
|
||||
user,
|
||||
});
|
||||
}
|
||||
if (userPermissions & UserPermission.ViewProfile) {
|
||||
generateAction({
|
||||
action: "view_profile",
|
||||
user,
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
user._id !== userId &&
|
||||
userPermissions & UserPermission.SendMessage
|
||||
) {
|
||||
generateAction({
|
||||
action: "message_user",
|
||||
user,
|
||||
});
|
||||
}
|
||||
if (
|
||||
user._id !== userId &&
|
||||
userPermissions & UserPermission.SendMessage
|
||||
) {
|
||||
generateAction({
|
||||
action: "message_user",
|
||||
user,
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
// Typescript can't determine that user the actions are linked together correctly
|
||||
generateAction({
|
||||
action: actions[i],
|
||||
user,
|
||||
} as unknown as Action);
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
// Typescript can't determine that user the actions are linked together correctly
|
||||
generateAction({
|
||||
action: actions[i],
|
||||
user,
|
||||
} as unknown as Action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue