From 27f2f8c7f94b8d09eaf40646639f36e06b103c2a Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 19 Jun 2024 09:56:39 +0200 Subject: [PATCH 1/2] refactor: use consistent naming for frontend initializers --- extensions/lock/js/src/admin/index.js | 2 +- extensions/nicknames/js/src/admin/index.js | 2 +- extensions/nicknames/js/src/forum/index.js | 2 +- extensions/subscriptions/js/src/forum/index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/lock/js/src/admin/index.js b/extensions/lock/js/src/admin/index.js index f32f9daf78..cf3d66ac80 100644 --- a/extensions/lock/js/src/admin/index.js +++ b/extensions/lock/js/src/admin/index.js @@ -2,7 +2,7 @@ import app from 'flarum/admin/app'; export { default as extend } from './extend'; -app.initializers.add('lock', () => { +app.initializers.add('flarum-lock', () => { app.extensionData.for('flarum-lock').registerPermission( { icon: 'fas fa-lock', diff --git a/extensions/nicknames/js/src/admin/index.js b/extensions/nicknames/js/src/admin/index.js index 196821b7a2..ca298d39aa 100644 --- a/extensions/nicknames/js/src/admin/index.js +++ b/extensions/nicknames/js/src/admin/index.js @@ -5,7 +5,7 @@ import BasicsPage from 'flarum/admin/components/BasicsPage'; import extractText from 'flarum/common/utils/extractText'; import { extend } from 'flarum/common/extend'; -app.initializers.add('flarum/nicknames', () => { +app.initializers.add('flarum-nicknames', () => { app.extensionData .for('flarum-nicknames') .registerSetting(function () { diff --git a/extensions/nicknames/js/src/forum/index.js b/extensions/nicknames/js/src/forum/index.js index aea6faed88..e83f578236 100644 --- a/extensions/nicknames/js/src/forum/index.js +++ b/extensions/nicknames/js/src/forum/index.js @@ -7,7 +7,7 @@ import NickNameModal from './components/NicknameModal'; export { default as extend } from './extend'; -app.initializers.add('flarum/nicknames', () => { +app.initializers.add('flarum-nicknames', () => { extend('flarum/forum/components/SettingsPage', 'accountItems', function (items) { if (app.forum.attribute('displayNameDriver') !== 'nickname') return; diff --git a/extensions/subscriptions/js/src/forum/index.js b/extensions/subscriptions/js/src/forum/index.js index 49a9a0fc21..93cab26164 100644 --- a/extensions/subscriptions/js/src/forum/index.js +++ b/extensions/subscriptions/js/src/forum/index.js @@ -8,7 +8,7 @@ import addSubscriptionSettings from './addSubscriptionSettings'; export { default as extend } from './extend'; -app.initializers.add('subscriptions', function () { +app.initializers.add('flarum-subscriptions', function () { addSubscriptionBadge(); addSubscriptionControls(); addSubscriptionFilter(); From c2643edf5761f463e441805059c478af56e8d9aa Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 19 Jun 2024 10:03:17 +0200 Subject: [PATCH 2/2] refactor: use arrow functions for frontend initializers --- extensions/mentions/js/src/admin/index.js | 2 +- extensions/mentions/js/src/forum/index.js | 2 +- extensions/subscriptions/js/src/forum/index.js | 2 +- extensions/tags/js/src/forum/index.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/mentions/js/src/admin/index.js b/extensions/mentions/js/src/admin/index.js index f8bc9c9fcb..6dd8fad808 100644 --- a/extensions/mentions/js/src/admin/index.js +++ b/extensions/mentions/js/src/admin/index.js @@ -1,6 +1,6 @@ import app from 'flarum/admin/app'; -app.initializers.add('flarum-mentions', function () { +app.initializers.add('flarum-mentions', () => { app.extensionData .for('flarum-mentions') .registerSetting({ diff --git a/extensions/mentions/js/src/forum/index.js b/extensions/mentions/js/src/forum/index.js index 385f6960e5..83de4d6ba5 100644 --- a/extensions/mentions/js/src/forum/index.js +++ b/extensions/mentions/js/src/forum/index.js @@ -17,7 +17,7 @@ app.mentionFormats = new MentionFormats(); export { default as extend } from './extend'; -app.initializers.add('flarum-mentions', function () { +app.initializers.add('flarum-mentions', () => { // For every mention of a post inside a post's content, set up a hover handler // that shows a preview of the mentioned post. addPostMentionPreviews(); diff --git a/extensions/subscriptions/js/src/forum/index.js b/extensions/subscriptions/js/src/forum/index.js index 93cab26164..2f58a933ec 100644 --- a/extensions/subscriptions/js/src/forum/index.js +++ b/extensions/subscriptions/js/src/forum/index.js @@ -8,7 +8,7 @@ import addSubscriptionSettings from './addSubscriptionSettings'; export { default as extend } from './extend'; -app.initializers.add('flarum-subscriptions', function () { +app.initializers.add('flarum-subscriptions', () => { addSubscriptionBadge(); addSubscriptionControls(); addSubscriptionFilter(); diff --git a/extensions/tags/js/src/forum/index.ts b/extensions/tags/js/src/forum/index.ts index 7e6b7199e1..72c062bb97 100644 --- a/extensions/tags/js/src/forum/index.ts +++ b/extensions/tags/js/src/forum/index.ts @@ -10,7 +10,7 @@ import addTagComposer from './addTagComposer'; export { default as extend } from './extend'; -app.initializers.add('flarum-tags', function () { +app.initializers.add('flarum-tags', () => { app.tagList = new TagListState(); addTagList();