1
0
mirror of https://github.com/flarum/core.git synced 2025-08-23 08:33:45 +02:00

feat: introduce frontend extenders (#3645)

* feat: reintroduce frontend extenders
* chore: used `Routes` extender in bundled extensions
* chore: used `PostTypes` extender in bundled extensions
* chore: `yarn format`
* chore: naming
* chore(review): unnecessary check
* chore(review): stay consistent
* chore: unused import

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
Sami Mazouz
2023-01-17 19:10:24 +01:00
committed by GitHub
parent 5fe3cfd837
commit d7f4975330
30 changed files with 213 additions and 101 deletions

View File

@@ -0,0 +1,4 @@
import Extend from 'flarum/common/extenders';
import MentionsUserPage from './components/MentionsUserPage';
export default [new Extend.Routes().add('user.mentions', '/u/:username/mentions', MentionsUserPage)];

View File

@@ -13,10 +13,11 @@ import UserMentionedNotification from './components/UserMentionedNotification';
import GroupMentionedNotification from './components/GroupMentionedNotification';
import UserPage from 'flarum/forum/components/UserPage';
import LinkButton from 'flarum/common/components/LinkButton';
import MentionsUserPage from './components/MentionsUserPage';
import User from 'flarum/common/models/User';
import Model from 'flarum/common/Model';
export { default as extend } from './extend';
app.initializers.add('flarum-mentions', function () {
User.prototype.canMentionGroups = Model.attribute('canMentionGroups');
@@ -65,7 +66,6 @@ app.initializers.add('flarum-mentions', function () {
});
// Add mentions tab in user profile
app.routes['user.mentions'] = { path: '/u/:username/mentions', component: MentionsUserPage };
extend(UserPage.prototype, 'navItems', function (items) {
const user = this.user;
items.add(