Skip to content

[DREAM-775] Add shared sortable-lists move menu - #25464

Open
myabc wants to merge 2 commits into
devfrom
implementation/dream-775-shared-move-menu-helper
Open

myabc wants to merge 2 commits into
devfrom
implementation/dream-775-shared-move-menu-helper

Conversation

@myabc

@myabc myabc commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/DREAM-775

What are you trying to accomplish?

First slice of DREAM-775: one shared descriptor for the four-direction move menu used by sortable-lists consumers.

The roles table and the text transform actions list each carried an identical MOVE_ITEMS constant and item builder. The enumeration lists (DREAM-789) would have been the third copy, so this lands first and that migration stacks on it.

What approach did you choose and why?

SortableLists::MoveMenu is a mixin with a frozen DIRECTIONS descriptor (label key, direction value, icon, Stimulus data) and one private builder, with_move_items(menu), that adds the four items to any ActionMenu or submenu.

Consumers keep ownership of the surrounding menu. Roles nests the items in a "Move" submenu; text transform actions renders them flat between two dividers. A helper that also owned the submenu wrapper would have needed an escape hatch for the flat layout straight away, and for Backlogs later. A data-only constant would have left the item builder duplicated in every consumer.

Both retrofits are pure refactors: the rendered menus are unchanged.

DREAM-775 stays open. Covered here: "one descriptor defines labels, icons, direction values and Stimulus data" and "supports list rows beyond Backlogs cards". Not covered: Backlogs adoption, the project attributes retrofit, and Resource Planner (DREAM-793).

AI involvement

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Roles and text transform actions each hand-roll the same four move items
and their Stimulus wiring, and the enumeration lists are about to become
the third copy. Adds one descriptor and a thin builder so consumers keep
their own menu layout, submenu or flat.

https://community.openproject.org/wp/DREAM-775
Swaps the duplicated move item constants and builders in the roles table
and the text transform actions list for the shared helper, so the item
wiring has a single owner. The rendered menus do not change.

https://community.openproject.org/wp/DREAM-775

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactor cleanly centralizes previously duplicated move-menu wiring and includes targeted component specs to prevent regressions.

Pull request overview

This PR introduces a shared SortableLists::MoveMenu mixin to centralize the four-direction “move” action menu items used by sortable-lists UI consumers, replacing previously duplicated constants/builders while keeping rendered menus unchanged.

Changes:

  • Added SortableLists::MoveMenu with a frozen DIRECTIONS descriptor and a private with_move_items(menu) builder.
  • Refactored Roles row action menu and Admin text transform actions menu to use with_move_items instead of local MOVE_ITEMS/builder code.
  • Added a component spec verifying ordering, Stimulus wiring, labels/icons, and privacy of the builder.
File summaries
File Description
app/components/sortable_lists/move_menu.rb New shared mixin defining the canonical move directions and item wiring.
spec/components/sortable_lists/move_menu_spec.rb New spec covering direction order, Stimulus data, labels/icons, and API privacy.
app/components/roles/row_component.rb Replaces per-component move item constant/builder with the shared mixin helper.
app/components/admin/text_transform_actions/row_component.rb Removes duplicated move item builder and includes the shared mixin.
app/components/admin/text_transform_actions/row_component.html.erb Switches the menu rendering to use with_move_items(menu).
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/team_planner/spec/features/team_planner_overview_spec.rb[1:4:4:1]
  • rspec ./spec/features/notifications/navigation_spec.rb[1:1:1]
  • rspec ./spec/features/roles/report_spec.rb[1:2]
  • rspec ./spec/features/roles/report_spec.rb[1:3]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #25464, linked for reference only):

- `rspec ./modules/team_planner/spec/features/team_planner_overview_spec.rb[1:4:4:1]`
- `rspec ./spec/features/notifications/navigation_spec.rb[1:1:1]`
- `rspec ./spec/features/roles/report_spec.rb[1:2]`
- `rspec ./spec/features/roles/report_spec.rb[1:3]`

Treat this as a standalone task, unrelated to PR #25464. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25464 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @myabc to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @myabc, and request a review from @myabc.
On every commit, set @myabc as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@myabc
myabc marked this pull request as ready for review September 18, 2026 16:20
@github-actions

Copy link
Copy Markdown

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants