-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
群组内一键添加好友 || One-click to add friends to the group #251
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think you should use |
||
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<{ | |
<div className="pt-2">{pluginUserExtraInfoEl}</div> | ||
|
||
<div className="text-right"> | ||
<Tooltip title={t('添加好友')}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think its should also have a permission check like |
||
<IconBtn | ||
icon="mdi:account-multiple-plus" | ||
onClick={handleAddFriend} | ||
/> | ||
</Tooltip> | ||
{allowSendMessage && ( | ||
<Tooltip title={t('发送消息')}> | ||
<IconBtn | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should wrap with
t
which can include translation support