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

feat(organizations): add functions for managing members TASK-985 #5281

Merged
merged 60 commits into from
Dec 5, 2024

Conversation

magicznyleszek
Copy link
Member

@magicznyleszek magicznyleszek commented Nov 20, 2024

💭 Notes

Not testable per se until further PR is built atop this one and uses it :)

rajpatel24 and others added 30 commits November 7, 2024 01:42
…hook more customizable

and then use it in `MembersRoute`
…hook more customizable

and then use it in `MembersRoute`
@magicznyleszek magicznyleszek marked this pull request as ready for review November 21, 2024 14:37
@magicznyleszek magicznyleszek requested review from p2edwards and removed request for p2edwards November 21, 2024 14:47
Base automatically changed from leszek/task-980-members-table to main November 25, 2024 16:37
# Conflicts:
#	jsapp/js/account/organization/MembersRoute.tsx
#	jsapp/js/account/organization/membersQuery.ts
#	jsapp/js/api.endpoints.ts
#	kobo/apps/organizations/serializers.py
#	kobo/apps/organizations/views.py
Copy link
Contributor

@Akuukis Akuukis left a comment

Choose a reason for hiding this comment

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

LGTM, not tested. I like how simple getMemberEndpoint approach is, for now let's stick to that.

Once we get to API schema auto-generation and auto-generated types, preferrably with auto-generated helpers, then let's worry later about what concerns and restrictions that will bring.

Copy link
Contributor

@pauloamorimbr pauloamorimbr left a comment

Choose a reason for hiding this comment

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

LGTM! 👌🏻

Just left a non blocking comment.

jsapp/js/account/organization/membersQuery.ts Show resolved Hide resolved
Copy link
Contributor

@pauloamorimbr pauloamorimbr left a comment

Choose a reason for hiding this comment

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

LGTM! Nice!!! 👏🏻

* Mutation hook for updating organization member. It ensures that all related
* queries refetch data (are invalidated).
*/
export function usePatchOrganizationMember(username: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the hypothetical situation where we could need to call multiple usePatch... in the same view we might want to have the username as a parameter of the mutationFn itself instead of the hook.

But that's only to stay in our minds for the future. We can change this is needed.

@magicznyleszek magicznyleszek merged commit f93524c into main Dec 5, 2024
7 checks passed
@magicznyleszek magicznyleszek deleted the leszek/task-985-member-mutation-api branch December 5, 2024 17:26
magicznyleszek added a commit that referenced this pull request Dec 11, 2024
… members TASK-987 TASK-990 (#5309)

### 📣 Summary
In Members Table (from Account → Team/Organization → Members) add
actions dropdown with one action. The action allows removing a member or
leaving the organization.

### 📖 Description
The availability of "Remove" action is based on the role of the logged
in user. When trying to remove user (or leave organization) a
confirmation prompt is being shown.

### 👀 Preview steps
1. ℹ️ have multiple different users
2. for one of the users (e.g. "joe"), use
http://kf.kobo.local/admin/organizations/organization/ to add multiple
users into joe's organization
3. For one of the users (e.g. "sue") set the role to "admin"
4. enable "Multi-members override" for joe's organization
5. enable feature flag `mmosEnabled`
6. navigate to `#/account/organization/members`
7. 🟢 notice that a table of organization members displays a list of
users added in step 2
8. 🟢 notice that in the table "joe" (as owner) has an ability to remove
all organization members (excluding themselves) including "sue" who's an
admin

As continuation for above steps:
1. log in as "sue"
2. navigate to `#/account/organization/members`
3. 🟢 notice that in the table "joe" (the owner) has no actions available
4. 🟢 notice that any "member" user in the table has actions available,
and if you click "Remove" a confirmation prompt will appear
5. 🟢 notice that for "sue" the action available is "Leave team"/"Leave
organization", and if you click it, a confirmation prompt will appear -
and it will have different content than confirmation prompt for removing
a member

As continuation for above steps:
1. pick a "member" user and use "Remove" action
2. confirm prompt
3. 🟢 verify that user was removed successfuly

### 💭 Notes
Build atop #5281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants