Skip to content

[2.x] fix(tags): preserve tag kinds and disable secondary reordering - #5457

Open
imorland wants to merge 4 commits into
2.xfrom
im/investigate-issue-5236
Open

imorland wants to merge 4 commits into
2.xfrom
im/investigate-issue-5236

Conversation

@imorland

Copy link
Copy Markdown
Member

Fixes #5236

Changes proposed in this pull request:
Stop offering reordering within the alphabetical secondary-tag list while keeping moves between primary and secondary tags. Editing a tag now preserves its kind; changing isPrimary alone returns 422, while an unchanged value remains accepted. An upgrade migration repairs incorrect flags and duplicate positions.

Reviewers should focus on:

  • Repairing flags from positions and renumbering each tag list.
  • The API rule for changing a tag’s kind.

Screenshot
Before: dragging Charlie temporarily changes the secondary list, then the order is discarded.

Before

After: the secondary list stays alphabetical during the same drag.

After

Before recording · After recording

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Frontend changes: tests are green (run yarn test in js/).
  • Frontend changes: tests have been added, or are not appropriate here.
  • Backend changes: tests are green (run composer test).
  • Backend changes: tests have been added, or are not appropriate here.
  • Where applicable, changes are suitable for all supported database drivers (MySQL, MariaDB, PostgreSQL, SQLite).
  • Core developer confirmed locally this works as intended.
  • The description above is written by me and describes what this pull request actually does.

Required changes:

Secondary tags have no stored order: they are listed by name, and the
tag order only carries primary tags and their children. Dragging one
within its list sent an order request without it and snapped back.
Sorting within the secondary list is now off; tags can still be dragged
between the primary and secondary lists.

Fixes #5236
Saving an existing tag from the edit modal sent isPrimary: false, as
the modal only knows the kind of a tag it creates. That cleared the
flag on primary tags while their position stayed, so the API and the
MCP tag list reported them as secondary.

- The modal now sends isPrimary only when creating a tag.
- The API refuses a change to isPrimary on update with a 422; sending
  it back unchanged still saves. A tag changes kind through the tag
  order, which also sets its position.
- A migration sets is_primary from position again, and renumbers
  positions within each list where tags created meanwhile share one.
@imorland
imorland marked this pull request as ready for review November 10, 2026 23:52
@imorland
imorland requested a review from a team as a code owner November 10, 2026 23:52
@imorland imorland added this to the 2.1 milestone Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2.x] Secondary tags are draggable in admin, but their order is discarded

1 participant