From 40bd9aed0a865fc1769324fb7b5cb1bcc2b17a1b Mon Sep 17 00:00:00 2001 From: Clifton Cunningham Date: Wed, 30 Dec 2020 18:35:18 +0100 Subject: [PATCH] fix: miro - use the incoming domain to ensure access to logged in boards works (#1756) --- app/embeds/Miro.js | 10 ++++++---- app/embeds/Miro.test.js | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/embeds/Miro.js b/app/embeds/Miro.js index 51e7ccb2d..cdc8d91be 100644 --- a/app/embeds/Miro.js +++ b/app/embeds/Miro.js @@ -2,7 +2,7 @@ import * as React from "react"; import Frame from "./components/Frame"; -const URL_REGEX = /^https:\/\/(?:realtimeboard|miro).com\/app\/board\/(.*)$/; +const URL_REGEX = /^https:\/\/(realtimeboard|miro).com\/app\/board\/(.*)$/; type Props = {| attrs: {| @@ -16,13 +16,15 @@ export default class RealtimeBoard extends React.Component { render() { const { matches } = this.props.attrs; - const boardId = matches[1]; + const domain = matches[1]; + const boardId = matches[2]; + const titleName = domain === "realtimeboard" ? "RealtimeBoard" : "Miro"; return ( ); } diff --git a/app/embeds/Miro.test.js b/app/embeds/Miro.test.js index f87cb6c19..5e65d58d9 100644 --- a/app/embeds/Miro.test.js +++ b/app/embeds/Miro.test.js @@ -13,6 +13,12 @@ describe("Miro", () => { expect("https://miro.com/app/board/o9J_k0fwiss=".match(match)).toBeTruthy(); }); + test("to extract the domain as part of the match for later use", () => { + expect( + "https://realtimeboard.com/app/board/o9J_k0fwiss=".match(match)[1] + ).toBe("realtimeboard"); + }); + test("to not be enabled elsewhere", () => { expect("https://miro.com".match(match)).toBe(null); expect("https://realtimeboard.com".match(match)).toBe(null);