Node.js based forum software built for the modern web
feat: #4456
Barış Soner Uşaklıfb567a7a33d2
diff --git a/install/data/defaults.json b/install/data/defaults.jsonindex 811ffa243b..d8ae3a488f 100644--- a/install/data/defaults.json+++ b/install/data/defaults.json@@ -116,6 +116,7 @@"hideEmail": 0,"allowGuestHandles": 0,"guestsIncrementTopicViews": 1,+ "allowGuestReplyNotifications": 1,"incrementTopicViewsInterval": 60,"recentMaxTopics": 200,"disableRecentCategoryFilter": 0,diff --git a/public/language/en-GB/admin/settings/guest.json b/public/language/en-GB/admin/settings/guest.jsonindex 3ba81aa778..75d44f37e4 100644--- a/public/language/en-GB/admin/settings/guest.json+++ b/public/language/en-GB/admin/settings/guest.json@@ -1,7 +1,7 @@{- "handles": "Guest Handles",+ "settings": "Settings","handles.enabled": "Allow guest handles","handles.enabled-help": "This option exposes a new field that allows guests to pick a name to associate with each post they make. If disabled, they will simply be called \"Guest\"",- "topic-views": "Topic views",- "topic-views.enabled": "Allow guests to increase topic view counts"+ "topic-views.enabled": "Allow guests to increase topic view counts",+ "reply-notifications.enabled": "Allow guests to generate reply notifications"}\ No newline at end of filediff --git a/src/topics/create.js b/src/topics/create.jsindex afa8498b72..ca55a8066e 100644--- a/src/topics/create.js+++ b/src/topics/create.js@@ -187,12 +187,14 @@ module.exports = function (Topics) {user.setUserField(uid, 'lastonline', Date.now());}- Topics.notifyFollowers(postData, uid, {- type: 'new-reply',- bodyShort: translator.compile('notifications:user_posted_to', postData.user.username, postData.topic.title),- nid: 'new_post:tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + uid,- mergeId: 'notifications:user_posted_to|' + postData.topic.tid,- });+ if (parseInt(uid, 10) || meta.config.allowGuestReplyNotifications) {+ Topics.notifyFollowers(postData, uid, {+ type: 'new-reply',+ bodyShort: translator.compile('notifications:user_posted_to', postData.user.username, postData.topic.title),+ nid: 'new_post:tid:' + postData.topic.tid + ':pid:' + postData.pid + ':uid:' + uid,+ mergeId: 'notifications:user_posted_to|' + postData.topic.tid,+ });+ }analytics.increment(['posts', 'posts:byCid:' + data.cid]);plugins.fireHook('action:topic.reply', { post: _.clone(postData), data: data });diff --git a/src/views/admin/settings/guest.tpl b/src/views/admin/settings/guest.tplindex 368f384b79..3adaf9917c 100644--- a/src/views/admin/settings/guest.tpl+++ b/src/views/admin/settings/guest.tpl@@ -1,7 +1,7 @@<!-- IMPORT admin/partials/settings/header.tpl --><div class="row">- <div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/guest:handles]]</div>+ <div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/guest:settings]]</div><div class="col-sm-10 col-xs-12"><form role="form"><div class="checkbox">@@ -14,9 +14,6 @@[[admin/settings/guest:handles.enabled-help]]</p></form>- </div>- <div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/guest:topic-views]]</div>- <div class="col-sm-10 col-xs-12"><form role="form"><div class="checkbox"><label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">@@ -25,6 +22,14 @@</label></div></form>+ <form role="form">+ <div class="checkbox">+ <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">+ <input class="mdl-switch__input" type="checkbox" data-field="allowGuestReplyNotifications">+ <span class="mdl-switch__label"><strong>[[admin/settings/guest:reply-notifications.enabled]]</strong></span>+ </label>+ </div>+ </form></div></div>