mirror of
https://github.com/flarum/core.git
synced 2025-08-08 17:36:38 +02:00
feat: JS Notification
extender (#3974)
* feat: JS `Notification` extender * fix
This commit is contained in:
@@ -3,10 +3,16 @@ import User from 'flarum/common/models/User';
|
||||
import Model from 'flarum/common/Model';
|
||||
|
||||
import commonExtend from '../common/extend';
|
||||
import UserSuspendedNotification from './components/UserSuspendedNotification';
|
||||
import UserUnsuspendedNotification from './components/UserUnsuspendedNotification';
|
||||
|
||||
export default [
|
||||
...commonExtend,
|
||||
|
||||
new Extend.Notification() //
|
||||
.add('userSuspended', UserSuspendedNotification)
|
||||
.add('userUnsuspended', UserUnsuspendedNotification),
|
||||
|
||||
new Extend.Model(User)
|
||||
.attribute<Date | null | undefined, string | null | undefined>('suspendedUntil', Model.transformDate)
|
||||
.attribute<string | null | undefined>('suspendReason')
|
||||
|
@@ -6,16 +6,11 @@ import Badge from 'flarum/common/components/Badge';
|
||||
import User from 'flarum/common/models/User';
|
||||
|
||||
import SuspendUserModal from './components/SuspendUserModal';
|
||||
import UserSuspendedNotification from './components/UserSuspendedNotification';
|
||||
import UserUnsuspendedNotification from './components/UserUnsuspendedNotification';
|
||||
import checkForSuspension from './checkForSuspension';
|
||||
|
||||
export { default as extend } from './extend';
|
||||
|
||||
app.initializers.add('flarum-suspend', () => {
|
||||
app.notificationComponents.userSuspended = UserSuspendedNotification;
|
||||
app.notificationComponents.userUnsuspended = UserUnsuspendedNotification;
|
||||
|
||||
extend(UserControls, 'moderationControls', (items, user) => {
|
||||
if (user.canSuspend()) {
|
||||
items.add(
|
||||
|
Reference in New Issue
Block a user