From fdc82b527358087686825943a3d6c01ce4686a69 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 19 May 2015 11:00:49 +0930 Subject: [PATCH] Add notification preferences --- extensions/mentions/js/bootstrap.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/extensions/mentions/js/bootstrap.js b/extensions/mentions/js/bootstrap.js index bdbf6957f..844e8dbb8 100644 --- a/extensions/mentions/js/bootstrap.js +++ b/extensions/mentions/js/bootstrap.js @@ -1,4 +1,7 @@ import app from 'flarum/app'; +import SettingsPage from 'flarum/components/settings-page'; +import { extend } from 'flarum/extension-utils'; +import icon from 'flarum/helpers/icon'; import postMentionPreviews from 'mentions/post-mention-previews'; import mentionedByList from 'mentions/mentioned-by-list'; @@ -26,4 +29,16 @@ app.initializers.add('mentions', function() { app.notificationComponentRegistry['postMentioned'] = PostMentionedNotification; app.notificationComponentRegistry['userMentioned'] = UserMentionedNotification; + + // Add notification preferences. + extend(SettingsPage.prototype, 'notificationTypes', function(items) { + items.add('postMentioned', { + name: 'postMentioned', + label: [icon('reply'), ' Someone replies to my post'] + }); + items.add('userMentioned', { + name: 'userMentioned', + label: [icon('at'), ' Someone mentions me in a post'] + }); + }); });