Skip to content

fix: keep if conditions when moving a canvas item across containers - #10041

Closed
nishantmonu51 wants to merge 1 commit into
mainfrom
nishant/fix-canvas-move-drops-if
Closed

nishantmonu51 wants to merge 1 commit into
mainfrom
nishant/fix-canvas-move-drops-if

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator
  • moveItemAcrossContainers spliced the raw YAML item into the destination without reading the if of the source tab group, tab or row, so an item dragged into another tab, out of a tab group or onto the top-level rows became visible to every viewer. In embeds and public URLs restricted to the canvas, its metrics view became queryable too.
  • Fold the source container's conditions that the destination doesn't already apply into the item's own if, as the same-container move and deleteTab already do.
  • Covers tab to tab in one group, tab to top-level rows, top-level rows to tab, and tab group to tab group, including the "new row" branch.

Steps to reproduce:

  1. Create a canvas with a tab group. On tab "Finance", set if: '{{ has "finance" .user.groups }}' and add a KPI.
  2. In the editor, drag the KPI onto tab "Overview" or out of the tab group.
  3. Before this fix the YAML shows the KPI with no if, and "View as" a user outside finance shows it.

Introduced by #10006. Not present in 0.90.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Dragging a canvas item into another tab, out of a tab group, or into the
top-level rows goes through `moveItemAcrossContainers`, which spliced the
raw YAML item into the destination without reading the `if` conditions
of the source tab group, tab or row. The moved item lost the visibility
it inherited and became visible to every viewer; in embeds and public
URLs restricted to the canvas, its metrics view also became queryable.

Fold the source container's conditions that the destination doesn't
already apply into the item's own `if`, mirroring what the same-container
move and `deleteTab` already do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant