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

Open
wants to merge 4 commits into
base: refactor/16286_refactor_profile_context_menu
Choose a base branch
from

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)

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
@status-im-auto
Copy link
Member

status-im-auto commented Sep 18, 2024

Jenkins Builds

Click to see older builds (7)
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
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 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

@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)

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
5 participants