feat: Add friend functionality and refactor user context menus

This commit is contained in:
2026-06-28 20:12:39 +07:00
parent e10e002593
commit 851b696f67
11 changed files with 306 additions and 105 deletions
+1
View File
@@ -37,6 +37,7 @@ const handlers = {
"user:search": (query) => guard(() => users.searchUsers(query)),
"friends:list": () => guard(() => friends.listFriends()),
"friends:add": (userId) => guard(() => friends.addFriend(userId)),
"friends:unfriend": (userId) => guard(() => friends.unfriend(userId)),
"friends:invite": (p) => guard(() => friends.inviteUser(p.userId, p.instanceLocation)),
"friends:requestInvite": (userId) => guard(() => friends.requestInvite(userId)),
+5
View File
@@ -37,6 +37,11 @@ export async function listFriends(): Promise<UserProfile[]> {
});
}
export async function addFriend(userId: string): Promise<void> {
const vrc = requireActiveClient();
await vrc.friend({ path: { userId }, throwOnError: true });
}
export async function unfriend(userId: string): Promise<void> {
const vrc = requireActiveClient();
await vrc.unfriend({ path: { userId }, throwOnError: true });