Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Gate write share actions (embed publish, public link) on write access (#72752, GHY-3814) (#77528)

Eric Normand5246357b5c46
diff --git a/e2e/test/scenarios/admin/remote-sync.cy.spec.ts b/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
index 0ab2a25acbe..7ff2c340512 100644
--- a/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
+++ b/e2e/test/scenarios/admin/remote-sync.cy.spec.ts
@@ -655,6 +655,26 @@ describe("Remote Sync", () => {
.click();
H.collectionTable().findByText(UPDATED_REMOTE_QUESTION_NAME);
});
+
+ it("keeps the Embed sharing option available for a question in a read-only synced collection (metabase#72752)", () => {
+ H.copySyncedCollectionFixture();
+ H.commitToRepo();
+ // Enable static embedding instance-wide so the Embed option is offered.
+ H.updateSetting("enable-embedding-static", true);
+ H.configureGitAndPullChanges("read-only");
+
+ cy.visit("/");
+
+ H.navigationSidebar()
+ .findByRole("treeitem", { name: /Synced Collection/ })
+ .click();
+ H.collectionTable().findByText(REMOTE_QUESTION_NAME).click();
+
+ // The Embed option stays available on a read-only synced question; the
+ // Publish button inside the modal is disabled instead (unit-tested).
+ H.openSharingMenu();
+ H.sharingMenu().findByText("Embed").should("be.visible");
+ });
});
describe("shared tenant collections", () => {
diff --git a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.tsx b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.tsx
index 9d55faca93c..6a737e3b84d 100644
--- a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.tsx
@@ -75,6 +75,12 @@ function AdminDashboardSharingMenu({ dashboard }: { dashboard: Dashboard }) {
const isAnalytics =
dashboard.collection && isInstanceAnalyticsCollection(dashboard.collection);
const canShare = !isAnalytics;
+ // Creating a public link is a write, so hide that action when the dashboard is
+ // not writable (e.g. a remote-synced entity on a read-only instance). An
+ // existing public link stays visible either way — viewing and copying it are
+ // reads. Embedding stays available; its Publish button is disabled instead.
+ const canWrite = canShare && dashboard.can_write;
+ const hasPublicLink = Boolean(dashboard.public_uuid);
// x-ray dashboards have string ids and can't be invite targets.
const inviteTarget: InviteTarget | undefined =
typeof dashboard.id === "number"
@@ -86,9 +92,9 @@ function AdminDashboardSharingMenu({ dashboard }: { dashboard: Dashboard }) {
<SharingMenu>
<InviteToViewMenuItem onClick={openInvite} />
<CopyDashboardLinkMenuItem dashboard={dashboard} />
- {canShare && isPublicSharingEnabled && (
+ {canShare && isPublicSharingEnabled && (hasPublicLink || canWrite) && (
<PublicLinkMenuItem
- hasPublicLink={Boolean(dashboard.public_uuid)}
+ hasPublicLink={hasPublicLink}
onClick={() => setModalType("dashboard-public-link")}
/>
)}
diff --git a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.unit.spec.tsx
index 31ea414c7f7..18601c04024 100644
--- a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/DashboardSharingMenu/DashboardSharingMenu.unit.spec.tsx
@@ -109,6 +109,35 @@ describe("DashboardSharingMenu", () => {
).not.toBeInTheDocument();
});
+ // Creating a public link is a write; on a read-only remote-synced dashboard
+ // (can_write=false) the "Create" action is hidden (MB #72752)...
+ it("should hide 'Create a public link' when the dashboard is not writable", async () => {
+ setupDashboardSharingMenu({
+ isAdmin: true,
+ isPublicSharingEnabled: true,
+ hasPublicLink: false,
+ dashboard: { can_write: false },
+ });
+ await openMenu();
+ expect(
+ screen.queryByText("Create a public link"),
+ ).not.toBeInTheDocument();
+ expect(screen.queryByText("Public link")).not.toBeInTheDocument();
+ });
+
+ // ...but an existing public link stays visible so it can still be
+ // viewed/copied/revoked, which are reads.
+ it("should keep an existing 'Public link' visible when the dashboard is not writable", async () => {
+ setupDashboardSharingMenu({
+ isAdmin: true,
+ isPublicSharingEnabled: true,
+ hasPublicLink: true,
+ dashboard: { can_write: false },
+ });
+ await openMenu();
+ expect(screen.getByText("Public link")).toBeInTheDocument();
+ });
+
it("should hide the public link option if public sharing is disabled", async () => {
setupDashboardSharingMenu({
isAdmin: true,
@@ -170,6 +199,29 @@ describe("DashboardSharingMenu", () => {
);
});
+ it("should show the 'Embed' option for a writable dashboard", async () => {
+ setupDashboardSharingMenu({
+ isAdmin: true,
+ isEmbeddingEnabled: true,
+ dashboard: { can_write: true },
+ });
+ await openMenu();
+ expect(screen.getByText("Embed")).toBeInTheDocument();
+ });
+
+ // The Embed option stays available even on a read-only remote-synced
+ // dashboard (can_write=false); the Publish button inside the modal is
+ // disabled instead of hiding the entry point (MB #72752).
+ it("should still show the 'Embed' option when the dashboard is not writable", async () => {
+ setupDashboardSharingMenu({
+ isAdmin: true,
+ isEmbeddingEnabled: true,
+ dashboard: { can_write: false },
+ });
+ await openMenu();
+ expect(screen.getByText("Embed")).toBeInTheDocument();
+ });
+
// note: if public sharing is disabled, the dashboard object provided by the backend should not have a UUID
});
diff --git a/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx b/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
index ba878d48d97..f000c5287ce 100644
--- a/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
@@ -58,6 +58,7 @@ export const DashboardPublicLinkPopover = ({
deletePublicLink={handleDeletePublicDashboardLink}
url={url}
onCopyLink={onCopyLink}
+ canRemoveLink={dashboard.can_write}
/>
);
};
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
index a4f29bbe0b8..c54991bb3df 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
@@ -1,15 +1,20 @@
import { useState } from "react";
+import { match } from "ts-pattern";
import { t } from "ttag";
import CS from "metabase/css/core/index.css";
import type { EmbedResourceType } from "metabase/embedding/types";
-import { Button, Flex, Group, Text } from "metabase/ui";
+import { Box, Button, Flex, Group, Text, Tooltip } from "metabase/ui";
interface EmbedModalContentStatusBarProps {
isPublished: boolean;
resourceType: EmbedResourceType;
hasSettingsChanges: boolean;
isFetching?: boolean;
+ // When the resource can't be written (e.g. a remote-synced entity on a
+ // read-only instance) publishing and unpublishing are disabled, since those
+ // writes would fail; an explanatory tooltip replaces the action.
+ isReadOnly?: boolean;
onDiscard: () => void;
onUnpublish: () => Promise<void>;
onSave: () => Promise<void>;
@@ -20,6 +25,7 @@ export const EmbedModalContentStatusBar = ({
resourceType,
hasSettingsChanges,
isFetching,
+ isReadOnly = false,
onDiscard,
onUnpublish,
onSave,
@@ -27,6 +33,27 @@ export const EmbedModalContentStatusBar = ({
const [isPublishing, setIsPublishing] = useState(false);
const [isUnpublishing, setIsUnpublishing] = useState(false);
+ // One whole sentence per resource type rather than an interpolated noun: the
+ // noun is not translatable on its own, and the rest of the sentence has to
+ // agree with its gender in many languages.
+ const readOnlyTooltip = match(resourceType)
+ .with(
+ "dashboard",
+ () =>
+ t`This dashboard is synced from another instance and is read-only here, so its embed settings can’t be changed.`,
+ )
+ .with(
+ "question",
+ () =>
+ t`This question is synced from another instance and is read-only here, so its embed settings can’t be changed.`,
+ )
+ .with(
+ "document",
+ () =>
+ t`This document is synced from another instance and is read-only here, so its embed settings can’t be changed.`,
+ )
+ .exhaustive();
+
return (
<Flex
w="100%"
@@ -53,30 +80,42 @@ export const EmbedModalContentStatusBar = ({
(hasSettingsChanges ? (
<Button onClick={onDiscard}>{t`Discard changes`}</Button>
) : (
- <Button
- variant="subtle"
- color="feedback-negative"
- loading={isUnpublishing || isFetching}
- onClick={() => {
- setIsUnpublishing(true);
- onUnpublish().finally(() => setIsUnpublishing(false));
- }}
- >{t`Unpublish`}</Button>
+ <Tooltip label={readOnlyTooltip} disabled={!isReadOnly}>
+ {/* Wrapper so the tooltip still shows over the disabled button,
+ which itself does not emit pointer events. */}
+ <Box component="span" display="inline-flex">
+ <Button
+ variant="subtle"
+ color="feedback-negative"
+ disabled={isReadOnly}
+ loading={isUnpublishing || isFetching}
+ onClick={() => {
+ setIsUnpublishing(true);
+ onUnpublish().finally(() => setIsUnpublishing(false));
+ }}
+ >{t`Unpublish`}</Button>
+ </Box>
+ </Tooltip>
))}
{(!isPublished || hasSettingsChanges) && (
- <Button
- variant="filled"
- loading={isPublishing || isFetching}
- onClick={() => {
- setIsPublishing(true);
- onSave().finally(() => setIsPublishing(false));
- }}
- >
- {hasSettingsChanges && isPublished
- ? t`Publish changes`
- : t`Publish`}
- </Button>
+ <Tooltip label={readOnlyTooltip} disabled={!isReadOnly}>
+ <Box component="span" display="inline-flex">
+ <Button
+ variant="filled"
+ disabled={isReadOnly}
+ loading={isPublishing || isFetching}
+ onClick={() => {
+ setIsPublishing(true);
+ onSave().finally(() => setIsPublishing(false));
+ }}
+ >
+ {hasSettingsChanges && isPublished
+ ? t`Publish changes`
+ : t`Publish`}
+ </Button>
+ </Box>
+ </Tooltip>
)}
</Group>
</Flex>
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.unit.spec.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.unit.spec.tsx
new file mode 100644
index 00000000000..ab807f17aac
--- /dev/null
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.unit.spec.tsx
@@ -0,0 +1,62 @@
+import userEvent from "@testing-library/user-event";
+
+import { renderWithProviders, screen } from "__support__/ui";
+
+import { EmbedModalContentStatusBar } from "./EmbedModalContentStatusBar";
+
+const setup = (
+ props: Partial<React.ComponentProps<typeof EmbedModalContentStatusBar>> = {},
+) => {
+ const onSave = jest.fn().mockResolvedValue(undefined);
+ const onUnpublish = jest.fn().mockResolvedValue(undefined);
+ const onDiscard = jest.fn();
+
+ renderWithProviders(
+ <EmbedModalContentStatusBar
+ resourceType="dashboard"
+ isPublished={false}
+ hasSettingsChanges={false}
+ onSave={onSave}
+ onUnpublish={onUnpublish}
+ onDiscard={onDiscard}
+ {...props}
+ />,
+ );
+
+ return { onSave, onUnpublish, onDiscard };
+};
+
+describe("EmbedModalContentStatusBar", () => {
+ it("publishes when the resource is writable", async () => {
+ const { onSave } = setup({ isReadOnly: false });
+
+ const publish = screen.getByRole("button", { name: "Publish" });
+ expect(publish).toBeEnabled();
+
+ await userEvent.click(publish);
+ expect(onSave).toHaveBeenCalledTimes(1);
+ });
+
+ // On a read-only remote-synced resource (can_write=false) the embed entry
+ // point stays available, but publishing is disabled since the write would
+ // fail (MB #72752).
+ describe("read-only resource", () => {
+ it("disables Publish and explains why in a tooltip", async () => {
+ setup({ isReadOnly: true });
+
+ const publish = screen.getByRole("button", { name: "Publish" });
+ expect(publish).toBeDisabled();
+
+ await userEvent.hover(publish);
+ expect(
+ await screen.findByText(/synced from another instance/),
+ ).toBeInTheDocument();
+ });
+
+ it("disables Unpublish for an already-published read-only resource", () => {
+ setup({ isReadOnly: true, isPublished: true });
+
+ expect(screen.getByRole("button", { name: "Unpublish" })).toBeDisabled();
+ });
+ });
+});
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
index 78517f1623d..d90d917eac0 100644
--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
@@ -19,6 +19,10 @@ export type PublicLinkPopoverProps = {
selectedExtension?: ExportFormat | null;
setSelectedExtension?: (extension: ExportFormat | null) => void;
onCopyLink?: () => void;
+ // Removing a public link is a write. Defaults to true; callers pass the
+ // resource's write access so the remove action is hidden when it can't be
+ // performed (e.g. a remote-synced entity on a read-only instance).
+ canRemoveLink?: boolean;
};
export const PublicLinkPopover = ({
@@ -32,6 +36,7 @@ export const PublicLinkPopover = ({
selectedExtension,
setSelectedExtension,
onCopyLink,
+ canRemoveLink = true,
}: PublicLinkPopoverProps) => {
const isAdmin = useSelector(getUserIsAdmin);
@@ -73,7 +78,7 @@ export const PublicLinkPopover = ({
<PublicLinkCopyPanel
loading={loading}
url={url}
- onRemoveLink={isAdmin ? onRemoveLink : undefined}
+ onRemoveLink={isAdmin && canRemoveLink ? onRemoveLink : undefined}
extensions={extensions}
selectedExtension={selectedExtension}
onChangeExtension={setSelectedExtension}
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.unit.spec.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.unit.spec.tsx
index 7454b495585..9db706d7864 100644
--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.unit.spec.tsx
+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.unit.spec.tsx
@@ -16,6 +16,7 @@ const TestComponent = ({
isOpen: mockIsOpen,
onClose: mockIsClosed,
url,
+ canRemoveLink,
}: Omit<PublicLinkPopoverProps, "target">) => {
const target = (
<button data-testid="target" onClick={() => setIsOpen(true)}>
@@ -44,6 +45,7 @@ const TestComponent = ({
extensions={extensions}
selectedExtension={extension}
setSelectedExtension={setExtension}
+ canRemoveLink={canRemoveLink}
/>
);
};
@@ -53,11 +55,13 @@ const setup = ({
isOpen = true,
extensions = [],
isAdmin = false,
+ canRemoveLink = true,
}: {
hasUUID?: boolean;
isOpen?: boolean;
extensions?: ExportFormat[];
isAdmin?: boolean;
+ canRemoveLink?: boolean;
} = {}) => {
const createPublicLink = jest.fn();
const deletePublicLink = jest.fn();
@@ -71,6 +75,7 @@ const setup = ({
onClose={onClose}
extensions={extensions}
url={hasUUID ? "sample-public-link" : null}
+ canRemoveLink={canRemoveLink}
/>,
{
storeInitialState: createMockState({
@@ -134,6 +139,18 @@ describe("PublicLinkPopover", () => {
expect(screen.queryByText("Remove public link")).not.toBeInTheDocument();
});
+
+ // Removing a link is a write; hidden when the resource isn't writable (e.g. a
+ // remote-synced entity on a read-only instance), while the link itself stays
+ // viewable/copyable (MB #72752).
+ it("should not render `Remove public link` when canRemoveLink is false, even for admins", async () => {
+ setup({ isAdmin: true, canRemoveLink: false });
+
+ expect(
+ await screen.findByDisplayValue("sample-public-link"),
+ ).toBeInTheDocument();
+ expect(screen.queryByText("Remove public link")).not.toBeInTheDocument();
+ });
});
describe("when creating public links", () => {
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/SdkIframeGuestEmbedStatusBar.tsx b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/SdkIframeGuestEmbedStatusBar.tsx
index 42b591d23fb..3e557b15e4d 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/SdkIframeGuestEmbedStatusBar.tsx
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk-setup/components/SdkIframeGuestEmbedStatusBar.tsx
@@ -52,6 +52,7 @@ export const SdkIframeGuestEmbedStatusBar = () => {
isPublished={resource.enable_embedding}
isFetching={isFetching}
hasSettingsChanges={hasParamsChanged}
+ isReadOnly={!resource.can_write}
onSave={handleSave}
onUnpublish={handleUnpublish}
onDiscard={handleDiscard}
diff --git a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.tsx b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.tsx
index ac3340ee517..cc6e1ed827a 100644
--- a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.tsx
+++ b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.tsx
@@ -93,6 +93,12 @@ function AdminQuestionSharingMenu({ question }: { question: Question }) {
const [isInviteOpen, { open: openInvite, close: closeInvite }] =
useDisclosure();
const isPublicSharingEnabled = useSetting("enable-public-sharing");
+ // Creating a public link is a write, so hide that action when the question is
+ // not writable (e.g. a remote-synced entity on a read-only instance). An
+ // existing public link stays visible either way — viewing and copying it are
+ // reads. Embedding stays available; its Publish button is disabled instead.
+ const canWrite = question.canWrite();
+ const hasPublicLink = Boolean(question.publicUUID?.());
const shareUrl = useQuestionAppUrl(question);
return (
@@ -100,9 +106,9 @@ function AdminQuestionSharingMenu({ question }: { question: Question }) {
<SharingMenu>
<InviteToViewMenuItem onClick={openInvite} />
<CopyQuestionLinkMenuItem question={question} />
- {isPublicSharingEnabled && (
+ {isPublicSharingEnabled && (hasPublicLink || canWrite) && (
<PublicLinkMenuItem
- hasPublicLink={Boolean(question.publicUUID?.())}
+ hasPublicLink={hasPublicLink}
onClick={() => setModalType("question-public-link")}
/>
)}
diff --git a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.unit.spec.tsx b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.unit.spec.tsx
index 850bcc6b581..2d2f44cd717 100644
--- a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.unit.spec.tsx
+++ b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ViewTitleHeaderRightSide/QuestionSharingMenu/QuestionSharingMenu.unit.spec.tsx
@@ -95,6 +95,35 @@ describe("QuestionSharingMenu", () => {
).not.toBeInTheDocument();
});
+ // Creating a public link is a write; on a read-only remote-synced question
+ // (can_write=false) the "Create" action is hidden (MB #72752)...
+ it("should hide 'Create a public link' when the question is not writable", async () => {
+ await setupQuestionSharingMenu({
+ isAdmin: true,
+ isPublicSharingEnabled: true,
+ hasPublicLink: false,
+ question: { can_write: false },
+ });
+ await openMenu();
+ expect(
+ screen.queryByText("Create a public link"),
+ ).not.toBeInTheDocument();
+ expect(screen.queryByText("Public link")).not.toBeInTheDocument();
+ });
+
+ // ...but an existing public link stays visible so it can still be
+ // viewed/copied/revoked, which are reads.
+ it("should keep an existing 'Public link' visible when the question is not writable", async () => {
+ await setupQuestionSharingMenu({
+ isAdmin: true,
+ isPublicSharingEnabled: true,
+ hasPublicLink: true,
+ question: { can_write: false },
+ });
+ await openMenu();
+ expect(screen.getByText("Public link")).toBeInTheDocument();
+ });
+
it("should hide the public link option if public sharing is disabled", async () => {
await setupQuestionSharingMenu({
isAdmin: true,
@@ -212,6 +241,31 @@ describe("QuestionSharingMenu", () => {
expect(screen.queryByText("Embed")).not.toBeInTheDocument();
});
});
+
+ describe("admins", () => {
+ it("should expose the 'Embed' option for a writable question", async () => {
+ await setupQuestionSharingMenu({
+ isAdmin: true,
+ isEmbeddingEnabled: true,
+ question: { can_write: true },
+ });
+ await openMenu();
+ expect(screen.getByText("Embed")).toBeInTheDocument();
+ });
+
+ // The Embed option stays available even on a read-only remote-synced
+ // question (can_write=false); the Publish button inside the modal is
+ // disabled instead of hiding the entry point (MB #72752).
+ it("should still show the 'Embed' option when the question is not writable", async () => {
+ await setupQuestionSharingMenu({
+ isAdmin: true,
+ isEmbeddingEnabled: true,
+ question: { can_write: false },
+ });
+ await openMenu();
+ expect(screen.getByText("Embed")).toBeInTheDocument();
+ });
+ });
});
describe("invite to view", () => {
diff --git a/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx b/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
index e10f683c805..cf8c6c799c0 100644
--- a/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
+++ b/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
@@ -68,6 +68,7 @@ export const QuestionPublicLinkPopover = ({
selectedExtension={extension}
setSelectedExtension={setExtension}
onCopyLink={onCopyLink}
+ canRemoveLink={question.canWrite()}
/>
);
};