From 027dea8ebd9148aa5344ecce73e7a42f28388601 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 16 Oct 2023 20:29:01 +0200 Subject: [PATCH 1/2] fix: revert usage of short links in QRcode and displayed link --- src/components/item/sharing/SharingLink.tsx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/components/item/sharing/SharingLink.tsx b/src/components/item/sharing/SharingLink.tsx index a0956aa8b..e5f5b4e8e 100644 --- a/src/components/item/sharing/SharingLink.tsx +++ b/src/components/item/sharing/SharingLink.tsx @@ -11,8 +11,6 @@ import Tooltip from '@mui/material/Tooltip'; import { Context } from '@graasp/sdk'; import { FAILURE_MESSAGES, SUCCESS_MESSAGES } from '@graasp/translations'; -import shortUUID from 'short-uuid'; - import QRCode from '@/components/common/QRCode'; import { SHARE_LINK_COLOR, @@ -60,7 +58,6 @@ type Props = { itemId?: string; }; -const { fromUUID } = shortUUID(); const SharingLink = ({ itemId }: Props): JSX.Element => { const { t: translateMessages } = useMessagesTranslation(); const { t: translateBuilder } = useBuilderTranslation(); @@ -73,11 +70,11 @@ const SharingLink = ({ itemId }: Props): JSX.Element => { if (itemId) { switch (linkType) { case Context.Builder: { - setLink(buildGraaspBuilderView(fromUUID(itemId || ''))); + setLink(buildGraaspBuilderView(itemId || '')); break; } case Context.Player: { - setLink(buildGraaspPlayerView(fromUUID(itemId || ''))); + setLink(buildGraaspPlayerView(itemId || '')); break; } default: @@ -137,18 +134,8 @@ const SharingLink = ({ itemId }: Props): JSX.Element => { renderValue={(value) => enumT(value)} id={SHARE_ITEM_DIALOG_LINK_SELECT_ID} > - - {enumT(Context.Builder)} - - - {enumT(Context.Player)} - + {enumT(Context.Builder)} + {enumT(Context.Player)} From 6df2411fec09e88830272cf023b49f76953289a9 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Mon, 23 Oct 2023 08:45:01 +0200 Subject: [PATCH 2/2] chore(test): adapt tests for revert --- cypress/e2e/item/share/shareItem.cy.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/item/share/shareItem.cy.ts b/cypress/e2e/item/share/shareItem.cy.ts index fc65060a3..7535c4be0 100644 --- a/cypress/e2e/item/share/shareItem.cy.ts +++ b/cypress/e2e/item/share/shareItem.cy.ts @@ -1,7 +1,5 @@ import { Context, ItemLoginSchemaType, ItemTagType } from '@graasp/sdk'; -import shortUUID from 'short-uuid'; - import { buildItemPath } from '@/config/paths'; import { SETTINGS } from '../../../../src/config/constants'; @@ -41,17 +39,16 @@ describe('Share Item', () => { cy.visit(buildItemPath(item.id)); openShareItemTab(item.id); - const { fromUUID } = shortUUID(); // sharing link cy.get(`#${SHARE_ITEM_DIALOG_LINK_ID}`).should( 'contain', - `${buildGraaspPlayerView(fromUUID(item.id))}`, + `${buildGraaspPlayerView(item.id)}`, ); cy.get(`#${SHARE_ITEM_DIALOG_LINK_SELECT_ID}`).click(); cy.get(`li[data-value="${Context.Builder}"]`).click(); cy.get(`#${SHARE_ITEM_DIALOG_LINK_ID}`).should( 'have.text', - `${buildGraaspBuilderView(fromUUID(item.id))}`, + `${buildGraaspBuilderView(item.id)}`, ); const visiblitySelect = cy.get(