diff --git a/extensions/subscriptions/js/src/forum/addSubscriptionBadge.js b/extensions/subscriptions/js/src/forum/addSubscriptionBadge.js index 317131a24..91b32a350 100644 --- a/extensions/subscriptions/js/src/forum/addSubscriptionBadge.js +++ b/extensions/subscriptions/js/src/forum/addSubscriptionBadge.js @@ -4,7 +4,7 @@ import Discussion from 'flarum/common/models/Discussion'; import Badge from 'flarum/common/components/Badge'; export default function addSubscriptionBadge() { - extend(Discussion.prototype, 'badges', function(badges) { + extend(Discussion.prototype, 'badges', function (badges) { let badge; switch (this.subscription()) { @@ -12,7 +12,7 @@ export default function addSubscriptionBadge() { badge = Badge.component({ label: app.translator.trans('flarum-subscriptions.forum.badge.following_tooltip'), icon: 'fas fa-star', - type: 'following' + type: 'following', }); break; @@ -20,12 +20,12 @@ export default function addSubscriptionBadge() { badge = Badge.component({ label: app.translator.trans('flarum-subscriptions.forum.badge.ignoring_tooltip'), icon: 'far fa-eye-slash', - type: 'ignoring' + type: 'ignoring', }); break; default: - // no default + // no default } if (badge) { diff --git a/extensions/subscriptions/js/src/forum/addSubscriptionControls.js b/extensions/subscriptions/js/src/forum/addSubscriptionControls.js index 0620eb462..ee7a81f93 100644 --- a/extensions/subscriptions/js/src/forum/addSubscriptionControls.js +++ b/extensions/subscriptions/js/src/forum/addSubscriptionControls.js @@ -7,28 +7,34 @@ import DiscussionControls from 'flarum/forum/utils/DiscussionControls'; import SubscriptionMenu from './components/SubscriptionMenu'; export default function addSubscriptionControls() { - extend(DiscussionControls, 'userControls', function(items, discussion, context) { + extend(DiscussionControls, 'userControls', function (items, discussion, context) { if (app.session.user && !(context instanceof DiscussionPage)) { const states = { - none: {label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.follow_button'), icon: 'fas fa-star', save: 'follow'}, - follow: {label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.unfollow_button'), icon: 'far fa-star', save: null}, - ignore: {label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.unignore_button'), icon: 'fas fa-eye', save: null} + none: { label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.follow_button'), icon: 'fas fa-star', save: 'follow' }, + follow: { label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.unfollow_button'), icon: 'far fa-star', save: null }, + ignore: { label: app.translator.trans('flarum-subscriptions.forum.discussion_controls.unignore_button'), icon: 'fas fa-eye', save: null }, }; const subscription = discussion.subscription() || 'none'; - items.add('subscription', Button.component({ - icon: states[subscription].icon, - onclick: discussion.save.bind(discussion, {subscription: states[subscription].save}) - }, states[subscription].label)); + items.add( + 'subscription', + Button.component( + { + icon: states[subscription].icon, + onclick: discussion.save.bind(discussion, { subscription: states[subscription].save }), + }, + states[subscription].label + ) + ); } }); - extend(DiscussionPage.prototype, 'sidebarItems', function(items) { + extend(DiscussionPage.prototype, 'sidebarItems', function (items) { if (app.session.user) { const discussion = this.discussion; - items.add('subscription', SubscriptionMenu.component({discussion}), 80); + items.add('subscription', SubscriptionMenu.component({ discussion }), 80); } }); } diff --git a/extensions/subscriptions/js/src/forum/addSubscriptionFilter.js b/extensions/subscriptions/js/src/forum/addSubscriptionFilter.js index 38342b4ed..c6e567192 100644 --- a/extensions/subscriptions/js/src/forum/addSubscriptionFilter.js +++ b/extensions/subscriptions/js/src/forum/addSubscriptionFilter.js @@ -6,14 +6,21 @@ import DiscussionListState from 'flarum/forum/states/DiscussionListState'; import GlobalSearchState from 'flarum/forum/states/GlobalSearchState'; export default function addSubscriptionFilter() { - extend(IndexPage.prototype, 'navItems', function(items) { + extend(IndexPage.prototype, 'navItems', function (items) { if (app.session.user) { const params = app.search.stickyParams(); - items.add('following', LinkButton.component({ - href: app.route('following', params), - icon: 'fas fa-star' - }, app.translator.trans('flarum-subscriptions.forum.index.following_link')), 50); + items.add( + 'following', + LinkButton.component( + { + href: app.route('following', params), + icon: 'fas fa-star', + }, + app.translator.trans('flarum-subscriptions.forum.index.following_link') + ), + 50 + ); } }); diff --git a/extensions/subscriptions/js/src/forum/addSubscriptionSettings.js b/extensions/subscriptions/js/src/forum/addSubscriptionSettings.js index afedd13cb..7d0b93119 100644 --- a/extensions/subscriptions/js/src/forum/addSubscriptionSettings.js +++ b/extensions/subscriptions/js/src/forum/addSubscriptionSettings.js @@ -5,19 +5,23 @@ import Switch from 'flarum/common/components/Switch'; export default function () { extend(SettingsPage.prototype, 'notificationsItems', function (items) { - items.add('followAfterReply', - Switch.component({ - state: this.user.preferences().followAfterReply, - onchange: (value) => { - this.followAfterReplyLoading = true; + items.add( + 'followAfterReply', + Switch.component( + { + state: this.user.preferences().followAfterReply, + onchange: (value) => { + this.followAfterReplyLoading = true; - this.user.savePreferences({ followAfterReply: value }).then(() => { - this.followAfterReplyLoading = false; - m.redraw(); - }); + this.user.savePreferences({ followAfterReply: value }).then(() => { + this.followAfterReplyLoading = false; + m.redraw(); + }); + }, + loading: this.followAfterReplyLoading, }, - loading: this.followAfterReplyLoading - }, app.translator.trans('flarum-subscriptions.forum.settings.follow_after_reply_label')) + app.translator.trans('flarum-subscriptions.forum.settings.follow_after_reply_label') + ) ); }); } diff --git a/extensions/subscriptions/js/src/forum/components/NewPostNotification.js b/extensions/subscriptions/js/src/forum/components/NewPostNotification.js index d4e69991c..785a90141 100644 --- a/extensions/subscriptions/js/src/forum/components/NewPostNotification.js +++ b/extensions/subscriptions/js/src/forum/components/NewPostNotification.js @@ -15,6 +15,6 @@ export default class NewPostNotification extends Notification { } content() { - return app.translator.trans('flarum-subscriptions.forum.notifications.new_post_text', {user: this.attrs.notification.fromUser()}); + return app.translator.trans('flarum-subscriptions.forum.notifications.new_post_text', { user: this.attrs.notification.fromUser() }); } } diff --git a/extensions/subscriptions/js/src/forum/components/SubscriptionMenuItem.js b/extensions/subscriptions/js/src/forum/components/SubscriptionMenuItem.js index 5fa8db3af..80dca4bd2 100644 --- a/extensions/subscriptions/js/src/forum/components/SubscriptionMenuItem.js +++ b/extensions/subscriptions/js/src/forum/components/SubscriptionMenuItem.js @@ -5,9 +5,9 @@ export default class SubscriptionMenuItem extends Component { view() { return (