mobilizon/js/src/graphql/member.ts
Thomas Citharel 7c11807c14
Allow to join an open group
Also:

* Refactor interacting with a remote event so that you can interact with
  a remote group as well
* Add a setting for group admins to pick between an open and invite-only
  group
* Fix new groups without posts/todos/resources/events/conversations URL
  set
* Repair local groups that haven't got their
  posts/todos/resources/events/conversations URL set
* Add a scheduled job to refresh remote groups every hour
* Add a user setting to pick when to receive notifications when there's
  new members to approve (will be used when this feature is available)
* Fix pagination for members

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-11-06 15:19:36 +01:00

112 lines
2 KiB
TypeScript

import gql from "graphql-tag";
export const MEMBER_FRAGMENT = gql`
fragment MemberFragment on Member {
id
role
parent {
id
preferredUsername
domain
name
avatar {
id
url
}
}
actor {
id
preferredUsername
domain
name
avatar {
id
url
}
}
insertedAt
}
`;
export const INVITE_MEMBER = gql`
mutation InviteMember($groupId: ID!, $targetActorUsername: String!) {
inviteMember(groupId: $groupId, targetActorUsername: $targetActorUsername) {
...MemberFragment
}
}
${MEMBER_FRAGMENT}
`;
export const ACCEPT_INVITATION = gql`
mutation AcceptInvitation($id: ID!) {
acceptInvitation(id: $id) {
...MemberFragment
}
}
${MEMBER_FRAGMENT}
`;
export const REJECT_INVITATION = gql`
mutation RejectInvitation($id: ID!) {
rejectInvitation(id: $id) {
id
}
}
`;
export const GROUP_MEMBERS = gql`
query($name: String!, $roles: String, $page: Int, $limit: Int) {
group(preferredUsername: $name) {
id
url
name
domain
preferredUsername
members(page: $page, limit: $limit, roles: $roles) {
elements {
id
role
actor {
id
name
domain
preferredUsername
avatar {
id
url
}
}
insertedAt
}
total
}
}
}
`;
export const UPDATE_MEMBER = gql`
mutation UpdateMember($memberId: ID!, $role: MemberRoleEnum!) {
updateMember(memberId: $memberId, role: $role) {
id
role
}
}
`;
export const REMOVE_MEMBER = gql`
mutation RemoveMember($groupId: ID!, $memberId: ID!) {
removeMember(groupId: $groupId, memberId: $memberId) {
id
}
}
`;
export const JOIN_GROUP = gql`
mutation JoinGroup($groupId: ID!) {
joinGroup(groupId: $groupId) {
...MemberFragment
}
}
${MEMBER_FRAGMENT}
`;