From 9caa2a37c818f2f8f3a127a107a2788ed5dbdf95 Mon Sep 17 00:00:00 2001 From: Kristaps Fabians Geikins Date: Wed, 7 Feb 2024 14:26:59 +0200 Subject: [PATCH] feat(fe): auto accept stream/project invite on email link click [WBX-73] (#2017) * feat(fe2): project invite auto accept * fix(fe2): improved CSR error logging * feat(fe1): auto accept stream invite on email link click * minor type fix * tests fix --- .../components/projects/invite/Banner.vue | 33 ++++++++++++++++--- .../frontend-2/lib/core/configs/apollo.ts | 7 ++-- .../frontend-2/pages/projects/[id]/index.vue | 30 ++++++++++++++--- packages/frontend-2/plugins/001-logger.ts | 14 ++++++-- .../frontend-2/type-augmentations/apollo.d.ts | 12 +++++++ .../lib/stream/mixins/streamInviteMixin.ts | 9 +++++ .../src/main/pages/stream/TheStream.vue | 5 +++ .../services/inviteCreationService.js | 2 +- .../serverinvites/tests/invites.spec.js | 2 +- 9 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 packages/frontend-2/type-augmentations/apollo.d.ts diff --git a/packages/frontend-2/components/projects/invite/Banner.vue b/packages/frontend-2/components/projects/invite/Banner.vue index a3fb67ce5a..1a428ad4b4 100644 --- a/packages/frontend-2/components/projects/invite/Banner.vue +++ b/packages/frontend-2/components/projects/invite/Banner.vue @@ -1,5 +1,6 @@ +
diff --git a/packages/frontend-2/lib/core/configs/apollo.ts b/packages/frontend-2/lib/core/configs/apollo.ts index bda2e39351..eaafc8018c 100644 --- a/packages/frontend-2/lib/core/configs/apollo.ts +++ b/packages/frontend-2/lib/core/configs/apollo.ts @@ -22,7 +22,7 @@ import { onError } from '@apollo/client/link/error' import { useNavigateToLogin, loginRoute } from '~~/lib/common/helpers/route' import { useAppErrorState } from '~~/lib/core/composables/appErrorState' import { isInvalidAuth } from '~~/lib/common/helpers/graphql' -import { omit } from 'lodash-es' +import { isBoolean, omit } from 'lodash-es' import { useRequestId } from '~/lib/core/composables/server' const appName = 'frontend-2' @@ -302,7 +302,10 @@ function createLink(params: { 'need a token to subscribe' ) - const shouldSkip = !!res.operation.getContext().skipLoggingErrors + const skipLoggingErrors = res.operation.getContext().skipLoggingErrors + const shouldSkip = isBoolean(skipLoggingErrors) + ? skipLoggingErrors + : skipLoggingErrors?.(res) if (!isSubTokenMissingError && !shouldSkip) { const errMsg = res.networkError?.message || res.graphQLErrors?.[0]?.message logger.error( diff --git a/packages/frontend-2/pages/projects/[id]/index.vue b/packages/frontend-2/pages/projects/[id]/index.vue index 6cf9797d35..81c4109fd3 100644 --- a/packages/frontend-2/pages/projects/[id]/index.vue +++ b/packages/frontend-2/pages/projects/[id]/index.vue @@ -1,7 +1,12 @@