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} />
|
<Edit size={28} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
{(user.relationship === RelationshipStatus.Incoming ||
|
{!user.bot &&
|
||||||
user.relationship === RelationshipStatus.None) && (
|
(user.relationship ===
|
||||||
<IconButton onClick={() => user.addFriend()}>
|
RelationshipStatus.Incoming ||
|
||||||
<UserPlus size={28} />
|
user.relationship ===
|
||||||
</IconButton>
|
RelationshipStatus.None) && (
|
||||||
)}
|
<IconButton onClick={() => user.addFriend()}>
|
||||||
|
<UserPlus size={28} />
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.tabs}>
|
<div className={styles.tabs}>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -585,58 +585,60 @@ function ContextMenus(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
let actions: Action["action"][];
|
if (!user.bot) {
|
||||||
switch (user.relationship) {
|
let actions: Action["action"][];
|
||||||
case RelationshipStatus.User:
|
switch (user.relationship) {
|
||||||
actions = [];
|
case RelationshipStatus.User:
|
||||||
break;
|
actions = [];
|
||||||
case RelationshipStatus.Friend:
|
break;
|
||||||
actions = ["remove_friend", "block_user"];
|
case RelationshipStatus.Friend:
|
||||||
break;
|
actions = ["remove_friend", "block_user"];
|
||||||
case RelationshipStatus.Incoming:
|
break;
|
||||||
actions = [
|
case RelationshipStatus.Incoming:
|
||||||
"add_friend",
|
actions = [
|
||||||
"cancel_friend",
|
"add_friend",
|
||||||
"block_user",
|
"cancel_friend",
|
||||||
];
|
"block_user",
|
||||||
break;
|
];
|
||||||
case RelationshipStatus.Outgoing:
|
break;
|
||||||
actions = ["cancel_friend", "block_user"];
|
case RelationshipStatus.Outgoing:
|
||||||
break;
|
actions = ["cancel_friend", "block_user"];
|
||||||
case RelationshipStatus.Blocked:
|
break;
|
||||||
actions = ["unblock_user"];
|
case RelationshipStatus.Blocked:
|
||||||
break;
|
actions = ["unblock_user"];
|
||||||
case RelationshipStatus.BlockedOther:
|
break;
|
||||||
actions = ["block_user"];
|
case RelationshipStatus.BlockedOther:
|
||||||
break;
|
actions = ["block_user"];
|
||||||
case RelationshipStatus.None:
|
break;
|
||||||
default:
|
case RelationshipStatus.None:
|
||||||
actions = ["add_friend", "block_user"];
|
default:
|
||||||
}
|
actions = ["add_friend", "block_user"];
|
||||||
|
}
|
||||||
|
|
||||||
if (userPermissions & UserPermission.ViewProfile) {
|
if (userPermissions & UserPermission.ViewProfile) {
|
||||||
generateAction({
|
generateAction({
|
||||||
action: "view_profile",
|
action: "view_profile",
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user._id !== userId &&
|
user._id !== userId &&
|
||||||
userPermissions & UserPermission.SendMessage
|
userPermissions & UserPermission.SendMessage
|
||||||
) {
|
) {
|
||||||
generateAction({
|
generateAction({
|
||||||
action: "message_user",
|
action: "message_user",
|
||||||
user,
|
user,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < actions.length; i++) {
|
for (let i = 0; i < actions.length; i++) {
|
||||||
// Typescript can't determine that user the actions are linked together correctly
|
// Typescript can't determine that user the actions are linked together correctly
|
||||||
generateAction({
|
generateAction({
|
||||||
action: actions[i],
|
action: actions[i],
|
||||||
user,
|
user,
|
||||||
} as unknown as Action);
|
} as unknown as Action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue