diff --git a/extensions/subscriptions/js/forum/src/components/SubscriptionMenu.js b/extensions/subscriptions/js/forum/src/components/SubscriptionMenu.js index 2a3c94935..3c1299216 100644 --- a/extensions/subscriptions/js/forum/src/components/SubscriptionMenu.js +++ b/extensions/subscriptions/js/forum/src/components/SubscriptionMenu.js @@ -51,14 +51,33 @@ export default class SubscriptionMenu extends Component { // no default } + const buttonProps = { + className: 'Button SubscriptionMenu-button ' + buttonClass, + icon: buttonIcon, + children: buttonLabel, + onclick: this.saveSubscription.bind(this, discussion, ['follow', 'ignore'].indexOf(subscription) !== -1 ? false : 'follow') + }; + + const preferences = app.session.user.preferences(); + const notifyEmail = preferences['notify_newPost_email']; + const notifyAlert = preferences['notify_newPost_alert']; + + if ((notifyEmail || notifyAlert) && subscription === false) { + buttonProps.title = app.translator.trans(notifyEmail + ? 'flarum-subscriptions.forum.sub_controls.notify_email_tooltip' + : 'flarum-subscriptions.forum.sub_controls.notify_alert_tooltip'); + buttonProps.config = element => $(element).tooltip({ + container: '.SubscriptionMenu', + placement: 'bottom', + delay: 250 + }); + } else { + buttonProps.config = element => $(element).tooltip('destroy'); + } + return (
- {Button.component({ - className: 'Button SubscriptionMenu-button ' + buttonClass, - icon: buttonIcon, - children: buttonLabel, - onclick: this.saveSubscription.bind(this, discussion, ['follow', 'ignore'].indexOf(subscription) !== -1 ? false : 'follow') - })} + {Button.component(buttonProps)}