Skip to content

refactor: unify frontend initializers naming#4003

Merged
SychO9 merged 2 commits intoflarum:2.xfrom
glowingblue:di/change-frontend-initializers
Jun 22, 2024
Merged

refactor: unify frontend initializers naming#4003
SychO9 merged 2 commits intoflarum:2.xfrom
glowingblue:di/change-frontend-initializers

Conversation

@DavideIadeluca
Copy link
Contributor

@DavideIadeluca DavideIadeluca commented Jun 19, 2024

Fixes #0000

Changes proposed in this pull request:
Use consistent naming for frontend initializers (and slightly change syntax), as the current best practice seems to be acme-foobar. Some bundled extensions were still initialized like this: acme/foobar or foobar.

Reviewers should focus on:
Seems like no bundled extension does any check in the frontend if another extension is initialized, for example:

if (app.initializers.has('flarum-tags')) {
    ...
}

So, as far as I can tell, the changes introduced in the PR should work standalone. But please double-check that I've not missed anything else for this to work out of the box (I have not yet setup 2.x for local development..)

Extension developers need to refactor their frontend initializer checks when upgrading their extensions for 2.x, so this must be included in the upgrade guide and potentially also noted as a breaking change.

Screenshot

QA

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.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

@DavideIadeluca DavideIadeluca marked this pull request as ready for review June 19, 2024 08:33
@DavideIadeluca DavideIadeluca requested a review from a team as a code owner June 19, 2024 08:33
@SychO9 SychO9 added extension-breaking javascript Pull requests that update Javascript code labels Jun 22, 2024
@SychO9 SychO9 added this to the 2.0 milestone Jun 22, 2024
@SychO9 SychO9 merged commit c8dc8f6 into flarum:2.x Jun 22, 2024
@DavideIadeluca DavideIadeluca deleted the di/change-frontend-initializers branch June 22, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension-breaking javascript Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants