diff --git a/keyserver/src/fetchers/link-fetchers.js b/keyserver/src/fetchers/link-fetchers.js --- a/keyserver/src/fetchers/link-fetchers.js +++ b/keyserver/src/fetchers/link-fetchers.js @@ -1,7 +1,7 @@ // @flow import type { - InviteLink, + InviteLinkWithHolder, InviteLinkVerificationRequest, InviteLinkVerificationResponse, } from 'lib/types/link-types.js'; @@ -58,7 +58,7 @@ async function fetchPrimaryInviteLinks( viewer: Viewer, -): Promise<$ReadOnlyArray> { +): Promise<$ReadOnlyArray> { if (!viewer.loggedIn) { return []; } @@ -66,7 +66,7 @@ const query = SQL` SELECT i.name, i.role, i.community, i.expiration_time AS expirationTime, i.limit_of_uses AS limitOfUses, i.number_of_uses AS numberOfUses, - i.\`primary\` + i.\`primary\`, blob_holder AS blobHolder FROM invite_links i INNER JOIN memberships m ON i.community = m.thread AND m.user = ${viewer.userID} @@ -81,6 +81,7 @@ expirationTime: row.expirationTime, limitOfUses: row.limitOfUses, numberOfUses: row.numberOfUses, + blobHolder: row.blobHolder, })); } diff --git a/keyserver/src/responders/link-responders.js b/keyserver/src/responders/link-responders.js --- a/keyserver/src/responders/link-responders.js +++ b/keyserver/src/responders/link-responders.js @@ -10,6 +10,7 @@ inviteLinkValidator, type CreateOrUpdatePublicLinkRequest, type DisableInviteLinkRequest, + type InviteLinkWithHolder, } from 'lib/types/link-types.js'; import { tShape, tID } from 'lib/utils/validation-utils.js'; @@ -57,7 +58,9 @@ ): Promise { const primaryLinks = await fetchPrimaryInviteLinks(viewer); return { - links: primaryLinks, + links: primaryLinks.map( + ({ blobHolder, ...rest }: InviteLinkWithHolder) => rest, + ), }; } diff --git a/keyserver/src/responders/redux-state-responders.js b/keyserver/src/responders/redux-state-responders.js --- a/keyserver/src/responders/redux-state-responders.js +++ b/keyserver/src/responders/redux-state-responders.js @@ -20,6 +20,7 @@ import { inviteLinksStoreValidator, type CommunityLinks, + type InviteLinkWithHolder, } from 'lib/types/link-types.js'; import { defaultNumberPerThread, @@ -324,7 +325,10 @@ const inviteLinksStorePromise = (async () => { const primaryInviteLinks = await fetchPrimaryInviteLinks(viewer); const links: { [string]: CommunityLinks } = {}; - for (const link of primaryInviteLinks) { + for (const { + blobHolder, + ...link + }: InviteLinkWithHolder of primaryInviteLinks) { if (link.primary) { links[link.communityID] = { primaryLink: link, diff --git a/lib/types/link-types.js b/lib/types/link-types.js --- a/lib/types/link-types.js +++ b/lib/types/link-types.js @@ -30,6 +30,11 @@ +numberOfUses: number, }; +export type InviteLinkWithHolder = $ReadOnly<{ + ...InviteLink, + +blobHolder: ?string, +}>; + export const inviteLinkValidator: TInterface = tShape({ name: t.String, primary: t.Boolean,