-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add Clone Group functionality #4056
Conversation
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.
LGTM apart from parameter mutation, did not test.
if (groupImage && groupImage !== '') { | ||
await BackendRemote.rpc.setChatProfileImage(accountId, chatId, groupImage) | ||
} | ||
groupMembers.push(...chat.contactIds) |
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.
Is it OK to mutate the parameter? Would it not add the same members twice to the same array if you cloned the group twice?
I'd just clone the array.
return BackendRemote.rpc.addContactToChat(accountId, chatId, contactId) | ||
}) | ||
) | ||
finalGroupName = `Copy: ${chat.name}` |
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.
Not internationalized, but perhaps it's fine.
const createGroup = useCallback(async () => { | ||
const isVerified = await areAllContactsVerified(accountId, groupMembers) | ||
const createGroup = useCallback( | ||
async (groupTemplateId?: number | null) => { |
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.
async (groupTemplateId?: number | null) => { | |
async (groupTemplateId?: number) => { |
[accountId, groupImage, groupMembers, groupName] | ||
) | ||
|
||
return async (groupTemplateId?: number | null) => { |
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.
return async (groupTemplateId?: number | null) => { | |
return async (groupTemplateId?: number) => { |
thanks for pushing this forward. some remarks:
so, in general, we should do the same as on android: open the "Create Group" screen with some memberlist/name/avatar preset from the old group, but crate the group only when the user explicitly hits "Create". see android/ios to get a feeling about the flow |
8d7b1b3
to
924571e
Compare
924571e
to
6026b16
Compare
- useCreateGroup returned function (CreateGroup) now accepts optional groupTemplateId same way Android/iOS version do, this is a group chat id to base new chat on - resolves #3933
6026b16
to
52eb279
Compare
useCreateGroup returned function (CreateGroup) now accepts optional groupTemplateId same way Android/iOS version do, this is a group chat id to base new chat on
resolves add "clone group" #3933