Skip to content

user invites: add collaborator discovery / email invites option

Warren Gifford requested to merge sg/user-invites into main

Created by: slimsag

This PR implements #27101 (closed)

image

How to test this branch

Run with sg start dotcom, navigate to https://sourcegraph.com/welcome?debug=1 and select a few repositories that should have collaborators in their commit history. Navigate to the third step and they should show up.

Important: Actual email sending is not yet implemented here, so once you click the invite buttons they'll just switch to loading state infinitely.

TODO before merge

  • @philipp-spiess We need the CopyableText for user invite URLs needs to log an event, e.g. UserInvitations_CopiedInviteLink I think we'll need to send another PR to add an onCopy callback to CopyableText so we can implement this.
  • @philipp-spiess After my changes here, the StartSearching function is now quite lengthy! We should refactor this so it instead uses UserInvites and ActivityLog components probably, maybe defined in the same StartSearching.tsx file though since they're really the same page?
  • @slimsag We need it to actually make the GraphQL request to send email invites. I'm working on the backend for this now.
  • @philipp-spiess or @slimsag: Is the way we're logging events here OK? https://sourcegraph.slack.com/archives/CN4FC7XT4/p1643836277948139
  • @philipp-spiess or @slimsag there appears to be some caching bug: if you first select one repository that doesn't have any (or very few) collaborators, you'll see those in the UI. But then if you go back and select more repos that should have many more collaborators, no further GraphQL request is made. I suspect because it doesn't change the Apollo request that useExternalServices makes but I am a n00b here. Not sure how to solve this yet.
  • @rrhyne I took some liberties with the design to account for not including the repo name in the list, which me and Rob agreed to, would like him to look over what I've done here and confirm this looks okay from a design POV.
  • new Update "Invite all" button text to "Invite [N] users" from figma
  • new Update the paragraph of text below the "Introduce friends and colleagues to Sourcegraph" header at top of page to new text from from figma
  • new Right now I removed the loading indicator instantly (when the request to send the email invite would've finished), but we need to change this to display the green check mark + invited text instead. https://github.com/sourcegraph/sourcegraph/pull/30595/files#diff-2246aaf22cb3ef43fd5b5dd7695b7b37f0bc52183c8a2bb9f08b86563344529aR184-R186

Dependencies

Fixes #27101 (closed)

Merge request reports

Loading