Skip to content

Add pending members GraphQl endpoint

What does this MR do and why?

For #348309 (closed)

Add pending members GraphQl endpoint that mirrors existing REST endpoint

Screenshots or screen recordings

Screenshot_2023-09-03_alle_6.55.29_PM

How to set up and validate locally

Part 1: CREATE SOME PENDING MEMBERS

NO USER PRESENT
  1. Run gdk/gitpod server and login
  2. Choose any group you're an admin of then go to Group > Manage > Members and click "Invite members" in the top right
  3. Enter a random email address (one that doesn't already exist in the gdk database)
  4. Be sure to click on the email address then "Invite" in the bottom right
USER PRESENT
  1. From your terminal, run gdk rails c
  2. From the console, locate the group where you chose to add pending members, choose an active member, update their state to awaiting
group = Group.find_by(name: "Flightjs")
member = group.members.first
member.update!(state: ::Member::STATE_AWAITING)

This will create a pending member with a user present. (I'm otherwise not sure how to do this from the UI the organic way - comments welcome!)

Part 2: QUERY IN GRAPHIQL

  1. Now that you have some pending members, go to http://127.0.0.1:3000/-/graphql-explorer and query away! For example:
query {
  group(fullPath: "flightjs") {
    fullPath
    pendingMembers {
      nodes {
        id
        name
        username
        email 
        webUrl
        invited
        avatarUrl 
        approved
      }
    }
  } 
}

Part 3: COMPARE TO THE EXISTING REST API

  1. Using your favorite tool to call an api (I like postman) query the same group for pending members and verify the data returned is the same:
http://127.0.0.1:3000/api/v4/groups/33/pending_members

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Missy Davies

Merge request reports