Once the user joined the community and became its member, they can leave the community. In this case community posts and comments, created by the user before, will be presaved and still returned in the getCommunityPosts query results. However, the user will not be able to create a new posts in the same community.
The community owner cannot leave the community. The mutation is available only for the community members.
To leave the community, leaveCommunity mutation should be executed. It accepts one required incoming parameter - communityId that represents ID of the community to be left by the current API user.
  mutation leaveCommunity {
    leaveCommunity(communityId: 1) {
      response
      errors
    }
  }
If the mutation executed without any errors, a boolean value will be returned as a response, indicating the execution status.
The user can join the same community again or be invited to this community after they left it.