From 72bd47190db6a4f9acec9654b41366fb3b7d8a6a Mon Sep 17 00:00:00 2001 From: ee L Date: Tue, 27 Aug 2024 13:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E7=BB=84=E5=86=85=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A5=BD=E5=8F=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popover/UserPopover/GroupUserPopover.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/web/src/components/popover/UserPopover/GroupUserPopover.tsx b/client/web/src/components/popover/UserPopover/GroupUserPopover.tsx index 96329fc4..ba0189e3 100644 --- a/client/web/src/components/popover/UserPopover/GroupUserPopover.tsx +++ b/client/web/src/components/popover/UserPopover/GroupUserPopover.tsx @@ -13,6 +13,8 @@ import { useAsyncRequest, UserBaseInfo, useUserId, + request, + showToasts, } from 'tailchat-shared'; import { UserProfileContainer } from '../../UserProfileContainer'; import { usePluginUserExtraInfo } from './usePluginUserExtraInfo'; @@ -41,6 +43,15 @@ export const GroupUserPopover: React.FC<{ navigate(`/main/personal/converse/${converse._id}`); }, [navigate]); + // 一键添加好友 + const [, handleAddFriend] = useAsyncRequest(async () => { + const { data } = await request.post('/api/friend/request/add', { + to: userId, + }); + showToasts(t('成功发送好友申请')); + return data; + }, [userId, request]); + useEffect(() => { if (userInfo.avatar) { fetchImagePrimaryColor(userInfo.avatar).then((rgba) => { @@ -84,6 +95,12 @@ export const GroupUserPopover: React.FC<{
{pluginUserExtraInfoEl}
+ + + {allowSendMessage && (