Skip to content

fix(core): dispatch one Renamed event per group rename, and none on create - #5264

Merged
imorland merged 1 commit into
2.xfrom
im/group-renamed-on-create
Oct 20, 2026
Merged

imorland merged 1 commit into
2.xfrom
im/group-renamed-on-create

Conversation

@imorland

Copy link
Copy Markdown
Member

Fixes #5263

Changes proposed in this pull request:
GroupResource sets each group name with its own Group::rename() call, and rename() raised Renamed whenever the names were dirty. So creating a group dispatched Renamed twice, and a rename from the admin's edit group modal, which sends both names, dispatched it twice too; Audit logged each one as group.renamed. rename() now raises nothing for a group that doesn't exist yet, and replaces any Renamed already pending, so a save dispatches at most one event with the original names.

Reviewers should focus on:

  • New tests in core (groups\CreateTest, new groups\UpdateTest) and stricter Audit CoreGroupTest assertions; all failed before the fix.

Screenshot
N/A

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. (No frontend changes.)
  • Frontend changes: tests are green (run yarn test in js/). (No frontend changes.)
  • Frontend changes: tests have been added, or are not appropriate here. (No frontend changes.)
  • 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.

@imorland
imorland requested a review from a team as a code owner October 20, 2026 06:51
@imorland imorland added this to the 2.1 milestone Oct 20, 2026
@imorland
imorland merged commit 3b8c4c6 into 2.x Oct 20, 2026
29 checks passed
@imorland
imorland deleted the im/group-renamed-on-create branch October 20, 2026 07:16
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] Creating a group dispatches the Renamed event twice

1 participant