Skip to content

Commit

Permalink
feat: frontend Model extender (#3646)
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`
* feat: `Model` frontend extender
* chore: naming
* chore(review): attributes can be nullable or undefined
* chore(review): delay extender implementation
* chore(review): unnecessary check
* chore(review): stay consistent
* chore: merge conflicts
* chore: unused import
* chore: multiline extenders
* feat: add Store extender

Signed-off-by: Sami Mazouz <[email protected]>
  • Loading branch information
SychO9 committed Feb 8, 2023
1 parent 38a6589 commit d005375
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 8 additions & 1 deletion js/src/forum/extend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import Extend from 'flarum/common/extenders';
import IndexPage from 'flarum/forum/components/IndexPage';
import Discussion from 'flarum/common/models/Discussion';

export default [new Extend.Routes().add('following', '/following', IndexPage)];
export default [
new Extend.Routes() //
.add('following', '/following', IndexPage),

new Extend.Model(Discussion) //
.attribute('subscription'),
];
2 changes: 0 additions & 2 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export { default as extend } from './extend';
app.initializers.add('subscriptions', function () {
app.notificationComponents.newPost = NewPostNotification;

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

addSubscriptionBadge();
addSubscriptionControls();
addSubscriptionFilter();
Expand Down

0 comments on commit d005375

Please sign in to comment.