mirror of
https://github.com/flarum/core.git
synced 2025-08-06 00:17:31 +02:00
feat: frontend Model
extender (#3646)
* 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 <sychocouldy@gmail.com>
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
import Extend from 'flarum/common/extenders';
|
||||
import Discussion from 'flarum/common/models/Discussion';
|
||||
import DiscussionLockedPost from './components/DiscussionLockedPost';
|
||||
|
||||
export default [new Extend.PostTypes().add('discussionLocked', DiscussionLockedPost)];
|
||||
export default [
|
||||
new Extend.PostTypes() //
|
||||
.add('discussionLocked', DiscussionLockedPost),
|
||||
|
||||
new Extend.Model(Discussion) //
|
||||
.attribute<boolean>('isLocked')
|
||||
.attribute<boolean>('canLock'),
|
||||
];
|
||||
|
@@ -1,7 +1,5 @@
|
||||
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 NotificationGrid from 'flarum/forum/components/NotificationGrid';
|
||||
|
||||
import DiscussionLockedNotification from './components/DiscussionLockedNotification';
|
||||
@@ -13,9 +11,6 @@ export { default as extend } from './extend';
|
||||
app.initializers.add('flarum-lock', () => {
|
||||
app.notificationComponents.discussionLocked = DiscussionLockedNotification;
|
||||
|
||||
Discussion.prototype.isLocked = Model.attribute('isLocked');
|
||||
Discussion.prototype.canLock = Model.attribute('canLock');
|
||||
|
||||
addLockBadge();
|
||||
addLockControl();
|
||||
|
||||
|
Reference in New Issue
Block a user