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

feat: JS Notification extender (#3974)

* feat: JS `Notification` extender

* fix
This commit is contained in:
Sami Mazouz
2024-05-14 21:10:07 +01:00
committed by GitHub
parent d273b1920f
commit 29ede5aa27
12 changed files with 53 additions and 22 deletions

View File

@@ -2,11 +2,15 @@ import Extend from 'flarum/common/extenders';
import Post from 'flarum/common/models/Post';
import User from 'flarum/common/models/User';
import LikesUserPage from './components/LikesUserPage';
import PostLikedNotification from './components/PostLikedNotification';
export default [
new Extend.Routes() //
.add('user.likes', '/u/:username/likes', LikesUserPage),
new Extend.Notification() //
.add('postLiked', PostLikedNotification),
new Extend.Model(Post) //
.hasMany<User>('likes')
.attribute<number>('likesCount')

View File

@@ -3,14 +3,11 @@ import app from 'flarum/forum/app';
import addLikeAction from './addLikeAction';
import addLikesList from './addLikesList';
import PostLikedNotification from './components/PostLikedNotification';
import addLikesTabToUserProfile from './addLikesTabToUserProfile';
export { default as extend } from './extend';
app.initializers.add('flarum-likes', () => {
app.notificationComponents.postLiked = PostLikedNotification;
addLikeAction();
addLikesList();
addLikesTabToUserProfile();