From 080f553a0836e81b2e817dfc25ad2fbbdccb5225 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:49:05 -0400 Subject: [PATCH] Mithril 2 Update (#22) Update for Mithril 2 --- extensions/likes/js/src/forum/addLikeAction.js | 5 ++--- extensions/likes/js/src/forum/addLikesList.js | 4 ++-- .../likes/js/src/forum/components/PostLikedNotification.js | 6 +++--- extensions/likes/js/src/forum/components/PostLikesModal.js | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/extensions/likes/js/src/forum/addLikeAction.js b/extensions/likes/js/src/forum/addLikeAction.js index a1ac07c60..1190d6527 100644 --- a/extensions/likes/js/src/forum/addLikeAction.js +++ b/extensions/likes/js/src/forum/addLikeAction.js @@ -5,7 +5,7 @@ import CommentPost from 'flarum/components/CommentPost'; export default function() { extend(CommentPost.prototype, 'actionItems', function(items) { - const post = this.props.post; + const post = this.attrs.post; if (post.isHidden() || !post.canLike()) return; @@ -15,7 +15,6 @@ export default function() { items.add('like', Button.component({ - children: app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link'), className: 'Button Button--link', onclick: () => { isLiked = !isLiked; @@ -37,7 +36,7 @@ export default function() { data.unshift({type: 'users', id: app.session.user.id()}); } } - }) + }, app.translator.trans(isLiked ? 'flarum-likes.forum.post.unlike_link' : 'flarum-likes.forum.post.like_link')) ); }); } diff --git a/extensions/likes/js/src/forum/addLikesList.js b/extensions/likes/js/src/forum/addLikesList.js index 5e4200eab..e665c9b18 100644 --- a/extensions/likes/js/src/forum/addLikesList.js +++ b/extensions/likes/js/src/forum/addLikesList.js @@ -9,7 +9,7 @@ import PostLikesModal from './components/PostLikesModal'; export default function() { extend(CommentPost.prototype, 'footerItems', function(items) { - const post = this.props.post; + const post = this.attrs.post; const likes = post.likes(); if (likes && likes.length) { @@ -22,7 +22,7 @@ export default function() { .slice(0, overLimit ? limit - 1 : limit) .map(user => { return ( - + {user === app.session.user ? app.translator.trans('flarum-likes.forum.post.you_text') : username(user)} ); diff --git a/extensions/likes/js/src/forum/components/PostLikedNotification.js b/extensions/likes/js/src/forum/components/PostLikedNotification.js index 94daca787..a71b86ca3 100644 --- a/extensions/likes/js/src/forum/components/PostLikedNotification.js +++ b/extensions/likes/js/src/forum/components/PostLikedNotification.js @@ -7,17 +7,17 @@ export default class PostLikedNotification extends Notification { } href() { - return app.route.post(this.props.notification.subject()); + return app.route.post(this.attrs.notification.subject()); } content() { - const notification = this.props.notification; + const notification = this.attrs.notification; const user = notification.fromUser(); return app.translator.transChoice('flarum-likes.forum.notifications.post_liked_text', 1, {user}); } excerpt() { - return truncate(this.props.notification.subject().contentPlain(), 200); + return truncate(this.attrs.notification.subject().contentPlain(), 200); } } diff --git a/extensions/likes/js/src/forum/components/PostLikesModal.js b/extensions/likes/js/src/forum/components/PostLikesModal.js index 62f3d7649..2503f4d1e 100644 --- a/extensions/likes/js/src/forum/components/PostLikesModal.js +++ b/extensions/likes/js/src/forum/components/PostLikesModal.js @@ -15,9 +15,9 @@ export default class PostLikesModal extends Modal { return (