Skip to content

Commit

Permalink
feat: introduce frontend extenders (#3645)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
SychO9 committed Jan 17, 2023
1 parent 27c87fc commit 78fc5e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions js/src/forum/extend.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Extend from 'flarum/common/extenders';
import IndexPage from 'flarum/forum/components/IndexPage';

export default [new Extend.Routes().add('following', '/following', IndexPage)];
4 changes: 2 additions & 2 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { extend } from 'flarum/common/extend';
import app from 'flarum/forum/app';
import Model from 'flarum/common/Model';
import Discussion from 'flarum/common/models/Discussion';
import IndexPage from 'flarum/forum/components/IndexPage';
import NotificationGrid from 'flarum/forum/components/NotificationGrid';

import addSubscriptionBadge from './addSubscriptionBadge';
Expand All @@ -12,8 +11,9 @@ import addSubscriptionSettings from './addSubscriptionSettings';

import NewPostNotification from './components/NewPostNotification';

export { default as extend } from './extend';

app.initializers.add('subscriptions', function () {
app.routes.following = { path: '/following', component: IndexPage };
app.notificationComponents.newPost = NewPostNotification;

Discussion.prototype.subscription = Model.attribute('subscription');
Expand Down

0 comments on commit 78fc5e2

Please sign in to comment.