-
-
Notifications
You must be signed in to change notification settings - Fork 286
feat: allow removing members from groups #1110
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
Open
amycatgirl
wants to merge
9
commits into
stoatchat:main
Choose a base branch
from
amycatgirl:feat/remove-from-group
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ade5b06
chore: create RemoveMember modal
amycatgirl 0b93231
feat: remove group members
amycatgirl 041448b
chore: prevent non-owners from removing the group owner
amycatgirl 7665381
chore: run formatter
amycatgirl 1fa08ac
chore: make prettier shut the fuck up about eol
amycatgirl 524901c
chore: run formatter (for real)
amycatgirl 9718ef7
chore: remove stray console log
amycatgirl 81338ba
Merge branch 'main' into feat/remove-from-group
amycatgirl 889e3b4
Merge branch 'main' into feat/remove-from-group
amycatgirl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { Trans } from "@lingui-solid/solid/macro"; | ||
|
|
||
| import { Avatar, Column, Dialog, DialogProps, Text } from "@revolt/ui"; | ||
|
|
||
| import { useMutation } from "@tanstack/solid-query"; | ||
| import { useModals } from ".."; | ||
| import { Modals } from "../types"; | ||
|
|
||
| /** | ||
| * Ban a server member with reason | ||
| */ | ||
| export function RemoveMemberModal( | ||
| props: DialogProps & Modals & { type: "remove_member" }, | ||
| ) { | ||
| const { showError } = useModals(); | ||
|
|
||
| const removeMember = useMutation(() => ({ | ||
| mutationFn: (user: string) => { | ||
| return props.group.removeMember(user); | ||
| }, | ||
| onError: showError, | ||
| })); | ||
|
|
||
| return ( | ||
| <Dialog | ||
| show={props.show} | ||
| onClose={props.onClose} | ||
| title={<Trans>Remove Member</Trans>} | ||
| actions={[ | ||
| { text: <Trans>Cancel</Trans> }, | ||
| { | ||
| text: <Trans>Remove</Trans>, | ||
| onClick: () => removeMember.mutateAsync(props.user.id), | ||
| }, | ||
| ]} | ||
| isDisabled={removeMember.isPending} | ||
| > | ||
| <Column align> | ||
| <Avatar src={props.user.animatedAvatarURL} size={64} /> | ||
| <Text> | ||
| <Trans> | ||
| Are you sure you want to remove{" "} | ||
| {props.user?.displayName ?? props.user.username} from{" "} | ||
| {props.group.name}? | ||
| </Trans> | ||
| </Text> | ||
| </Column> | ||
| </Dialog> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.