Skip to content

Commit

Permalink
feat: #4456
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Nov 18, 2020
1 parent 5f6137f commit fb567a7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions install/data/defaults.json
Expand Up @@ -116,6 +116,7 @@
"hideEmail": 0,
"allowGuestHandles": 0,
"guestsIncrementTopicViews": 1,
"allowGuestReplyNotifications": 1,
"incrementTopicViewsInterval": 60,
"recentMaxTopics": 200,
"disableRecentCategoryFilter": 0,
Expand Down
6 changes: 3 additions & 3 deletions 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"
}
14 changes: 8 additions & 6 deletions src/topics/create.js
Expand Up @@ -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 });
Expand Down
13 changes: 9 additions & 4 deletions 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">
Expand All @@ -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">
Expand All @@ -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>

Expand Down

0 comments on commit fb567a7

Please sign in to comment.