Skip to content
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 remove user groups option to group chat context menu #16360

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

iurimatias
Copy link
Member

@iurimatias iurimatias commented Sep 18, 2024

closes #16130

requires #16334

What does the PR do

Adds "Remove from group" to context menu in group chats

Affected areas

Should only affect group chats

Screenshot of functionality (including design for comparison)

How to test

  1. create or use an existing group chat
  2. right click on the user list and click 'remove from group'
    OR
  3. right on a message from that user and click "remove from group'
    expected: user is removed from the group and the message "user has left the group" is displayed for everyone
  • What kind of user flows should be checked?
  • this option should NOT be available for self (i.e a user cannot remove himself from the group)
  • this option should NOT be available if the user is not the group admin
  • this option should only be available in group chats, e.g going to the community member list and right clicking should not have this option

Risk

Worst case scenario this option appears somewhere it shouldn't (like community member list) and clicking it has unknown behaviour (probably not happens)

@status-im-auto
Copy link
Member

status-im-auto commented Sep 18, 2024

Jenkins Builds

Click to see older builds (26)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6a687d2 #1 2024-09-18 15:54:33 ~6 min macos/aarch64 🍎dmg
✔️ 6a687d2 #1 2024-09-18 15:54:49 ~6 min tests/nim 📄log
✔️ 6a687d2 #1 2024-09-18 15:59:41 ~11 min tests/ui 📄log
✔️ 6a687d2 #1 2024-09-18 15:59:58 ~11 min macos/x86_64 🍎dmg
✔️ 6a687d2 #1 2024-09-18 16:04:47 ~16 min linux/x86_64 📦tgz
✔️ 6a687d2 #1 2024-09-18 16:06:58 ~19 min linux-nix/x86_64 📦tgz
✔️ 6a687d2 #2 2024-09-18 16:32:11 ~3 min macos/aarch64 🍎dmg
✔️ 68d7b20 #3 2024-09-18 16:40:12 ~6 min tests/nim 📄log
✔️ 68d7b20 #3 2024-09-18 16:42:50 ~8 min macos/aarch64 🍎dmg
✔️ 68d7b20 #3 2024-09-18 16:45:43 ~11 min tests/ui 📄log
✔️ 68d7b20 #3 2024-09-18 16:45:51 ~11 min macos/x86_64 🍎dmg
✔️ 68d7b20 #3 2024-09-18 16:49:02 ~14 min linux-nix/x86_64 📦tgz
✔️ 68d7b20 #3 2024-09-18 16:50:43 ~16 min linux/x86_64 📦tgz
✔️ 68d7b20 #3 2024-09-18 17:00:48 ~26 min windows/x86_64 💿exe
✔️ 517e651 #4 2024-09-19 17:39:29 ~6 min macos/aarch64 🍎dmg
✔️ 517e651 #4 2024-09-19 17:40:01 ~6 min tests/nim 📄log
✔️ 517e651 #4 2024-09-19 17:44:46 ~11 min macos/x86_64 🍎dmg
✔️ 517e651 #4 2024-09-19 17:44:56 ~11 min tests/ui 📄log
✔️ 517e651 #4 2024-09-19 17:46:20 ~13 min linux-nix/x86_64 📦tgz
✔️ 517e651 #4 2024-09-19 17:48:43 ~15 min linux/x86_64 📦tgz
✔️ e74aa19 #5 2024-09-20 19:30:33 ~6 min macos/aarch64 🍎dmg
✔️ e74aa19 #5 2024-09-20 19:30:43 ~6 min tests/nim 📄log
✔️ e74aa19 #5 2024-09-20 19:33:23 ~8 min macos/x86_64 🍎dmg
✔️ e74aa19 #5 2024-09-20 19:35:55 ~11 min tests/ui 📄log
✔️ e74aa19 #5 2024-09-20 19:36:13 ~11 min linux-nix/x86_64 📦tgz
✔️ e74aa19 #5 2024-09-20 19:39:24 ~14 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 5cf658b #6 2024-09-23 16:22:21 ~6 min macos/aarch64 🍎dmg
✔️ 5cf658b #6 2024-09-23 16:23:26 ~7 min tests/nim 📄log
✔️ 5cf658b #6 2024-09-23 16:29:47 ~13 min linux-nix/x86_64 📦tgz
✔️ 5cf658b #6 2024-09-23 16:29:56 ~13 min tests/ui 📄log
✔️ 5cf658b #6 2024-09-23 16:30:58 ~14 min macos/x86_64 🍎dmg
✔️ 5cf658b #6 2024-09-23 16:33:08 ~16 min linux/x86_64 📦tgz
✔️ 5cf658b #7 2024-09-24 14:11:05 ~6 min tests/nim 📄log
✔️ 5cf658b #7 2024-09-24 14:11:41 ~7 min macos/aarch64 🍎dmg
✔️ 5cf658b #7 2024-09-24 14:16:06 ~11 min macos/x86_64 🍎dmg
✔️ 5cf658b #7 2024-09-24 14:16:51 ~12 min tests/ui 📄log
✔️ 5cf658b #7 2024-09-24 14:17:14 ~12 min linux-nix/x86_64 📦tgz
✔️ 5cf658b #7 2024-09-24 14:18:40 ~14 min linux/x86_64 📦tgz
✔️ 3100535 #9 2024-09-24 15:07:07 ~4 min macos/aarch64 🍎dmg
✔️ 3100535 #9 2024-09-24 15:08:48 ~6 min tests/nim 📄log
✔️ 3100535 #9 2024-09-24 15:12:46 ~10 min macos/x86_64 🍎dmg
3100535 #9 2024-09-24 15:14:04 ~11 min tests/ui 📄log
✔️ 3100535 #9 2024-09-24 15:17:35 ~15 min linux-nix/x86_64 📦tgz
✔️ 3100535 #9 2024-09-24 15:18:30 ~16 min linux/x86_64 📦tgz
✔️ 3100535 #10 2024-09-24 16:32:44 ~11 min tests/ui 📄log

@status-im-auto
Copy link
Member

@iurimatias iurimatias changed the base branch from master to refactor/16286_refactor_profile_context_menu September 18, 2024 16:27
@iurimatias iurimatias requested review from a team, jrainville, glitchminer and micieslak and removed request for a team September 18, 2024 16:34
@iurimatias iurimatias marked this pull request as ready for review September 18, 2024 16:34
Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a suggestion.

Also, the issue has designs for the community options, could you open a new issue for those since the og issue will be closed with this PR. Thanks.

@@ -212,6 +214,10 @@ Item {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.blockContactRequested(publicKey, contactDetails)
}
onRemoveFromGroup: (publicKey) => {
const chatId = root.store.chatCommunitySectionModule.activeItem.id
root.store.chatCommunitySectionModule.removeMemberFromGroupChat("", chatId, publicKey)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, but we could create a removeMemberFromActiveGroupChat(publicKey) function in the store that would do the two calls above and hide some of the logic. No need to use chatCommunitySectionModule in the component that way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's also important rule (affects testing) that context properties should be accessed only from stores and not exposed from them directly. So chatCommunitySectionModule should not be used (and even accessible) from root.store directly like root.store.chatCommunitySectionModule.

@@ -1214,6 +1216,10 @@ Loader {
const contactDetails = publicKey === "" ? {} : Utils.getContactDetailsAsJson(publicKey, true, true)
Global.blockContactRequested(publicKey, contactDetails)
}
onRemoveFromGroup: (publicKey) => {
const chatId = root.rootStore.chatCommunitySectionModule.activeItem.id
root.rootStore.chatCommunitySectionModule.removeMemberFromGroupChat("", chatId, publicKey)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@iurimatias iurimatias force-pushed the refactor/16286_refactor_profile_context_menu branch from 93f17b2 to 8e0b619 Compare September 19, 2024 16:48
@status-im-auto
Copy link
Member

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think you just need to rebase on the other branch

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to resolve the conflicts (rebase)

@iurimatias iurimatias force-pushed the refactor/16286_refactor_profile_context_menu branch from 8e0b619 to e423081 Compare September 20, 2024 14:29
@iurimatias iurimatias force-pushed the feature/16130_remove_user_groups branch from 517e651 to e74aa19 Compare September 20, 2024 19:24
@status-im-auto
Copy link
Member

@iurimatias iurimatias force-pushed the refactor/16286_refactor_profile_context_menu branch from 0d80878 to a09b773 Compare September 23, 2024 16:04
@iurimatias iurimatias force-pushed the feature/16130_remove_user_groups branch from e74aa19 to 5cf658b Compare September 23, 2024 16:16
@status-im-auto
Copy link
Member

Copy link
Contributor

@glitchminer glitchminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Clicking remove from group on the menu opened from a message does nothing
  • After a member has been removed the menu opened from a message still displays the option to remove from group

image

Base automatically changed from refactor/16286_refactor_profile_context_menu to master September 24, 2024 14:04
@status-im-auto
Copy link
Member

@iurimatias iurimatias force-pushed the feature/16130_remove_user_groups branch from 5cf658b to d1d7199 Compare September 24, 2024 14:59
feature: add remove from group option to group chats

refactor ProfileContextMenu to make it a functional component

refactor ProfileContextMenu to make it a functional component

This refactor ProfileContextMenu to make it a functional component by:

refactored out direct calls to backend, and passing backend data structures and moved this logic to the callers, also refactored common calls between the callers
common types of context menus have been extracted to their sub components which removes a lot of logic too and makes the behaviour very clear
user verification workflow (which was already disabled) has been removed

refactor: use signals and call singletons on the parent instead

remove unused code for now from profile context menu

refactor profile context menu into two components; add property to storybook

extract blocked profile context menu and self profile context menu

use profileType instead of individual bools

refactor to pass trustStatus as an argument

make contact type a parameter

remove unnecessary method from RegularProfileContextMenu

add ensVerified property to ProfileContextMenu components

add onlineStatus property to ProfileContextMenu components

move ProfileContextMenu storybook controls to the right sidebar

move contactDetails logic up from the view

add local nickname property to ProfileContextMenu components

fix issue with missing signal; fix logs in storybook

use constant for profileType instead of string

refactor common code into a single method

refactor getProfileContext

remove references to contactDetails which are not longer needed

remove unnecessary comments

fix bridged constant

refactor into a single ProfileContextMenu component

refactor into a single ProfileContextMenu component

refactor into a single ProfileContextMenu component

simplify imports

remove unused store field

move methods from utils to contacts store

remove onClosed signal

remove unused param

feature: add remove from group option to group chats

feature: add remove from group option to group chats

add isAdmin property

move removeMemberFromGroupChat to root store

hide remove from group option from message context menu
@status-im-auto
Copy link
Member

Copy link
Contributor

@glitchminer glitchminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - "remove from group" via right click on message in a group chat was descoped pending additional refactor

@iurimatias iurimatias merged commit 86fdc66 into master Sep 25, 2024
9 checks passed
@iurimatias iurimatias deleted the feature/16130_remove_user_groups branch September 25, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a group admin, I want to remove a user from a group using the member list
6 participants