MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getInviteInfo

Function getInviteInfo

packages/web/src/app/invite/actions.ts:166–206  ·  view source on GitHub ↗
(inviteId: string)

Source from the content-addressed store, hash-verified

164
165// eslint-disable-next-line authz/require-auth-wrapper -- runs pre-org-membership; uses getAuthenticatedUser() directly since the invitee is not yet a member
166export const getInviteInfo = async (inviteId: string) => sew(async () => {
167 const authResult = await getAuthenticatedUser();
168 if (!authResult) {
169 return notAuthenticated();
170 }
171
172 const { user } = authResult;
173
174 const invite = await __unsafePrisma.invite.findUnique({
175 where: {
176 id: inviteId,
177 },
178 include: {
179 org: true,
180 host: true,
181 }
182 });
183
184 if (!invite) {
185 return notFound();
186 }
187
188 if (invite.recipientEmail !== user.email) {
189 return notFound();
190 }
191
192 return {
193 id: invite.id,
194 orgName: invite.org.name,
195 orgImageUrl: invite.org.imageUrl ?? undefined,
196 host: {
197 name: invite.host.name ?? undefined,
198 email: invite.host.email,
199 avatarUrl: invite.host.image ?? undefined,
200 },
201 recipient: {
202 name: user.name ?? undefined,
203 email: user.email,
204 }
205 };
206});

Callers 1

RedeemPageFunction · 0.90

Calls 4

sewFunction · 0.90
getAuthenticatedUserFunction · 0.90
notAuthenticatedFunction · 0.90
notFoundFunction · 0.90

Tested by

no test coverage detected