-
Notifications
You must be signed in to change notification settings - Fork 375
群组内一键添加好友 || One-click to add friends to the group #251
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
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 |
|---|---|---|
|
|
@@ -45,6 +45,10 @@ const schema = createMetaFormSchema({ | |
| newPassword: metaFormFieldSchema | ||
| .string() | ||
| .min(6, t('密码不能低于6位')) | ||
| .matches(/[A-Z]/, '密码必须包含大写字母') | ||
|
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. you should wrap with |
||
| .matches(/[a-z]/, '密码必须包含小写字母') | ||
| .matches(/\d/, '密码必须包含数字') | ||
| .matches(/[`~!@#$%^&*()_+./,;':"*]/, '密码必须包含符号') | ||
| .required(t('密码不能为空')), | ||
| newPasswordRepeat: metaFormFieldSchema | ||
| .string() | ||
|
|
||
| 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 | ||
|
|
||