v1.18.x
Barış Soner Uşaklı 7 years ago
parent da3ce2e1d5
commit 723f31a362

@ -38,5 +38,11 @@
"bookmarkThreshold": 5,
"topicsPerList": 20,
"autoDetectLang": 1,
"min:rep:flag": 0
"min:rep:flag": 0,
"notificationType_upvote": "notification",
"notificationType_new-topic": "notification",
"notificationType_new-reply": "notification",
"notificationType_follow": "notification",
"notificationType_new-chat": "notification",
"notificationType_group-invite": "notification"
}

@ -62,5 +62,6 @@
"email-chat-notifs": "Send an email if a new chat message arrives and I am not online",
"email-post-notif": "Send an email when replies are made to topics I am subscribed to",
"follow-created-topics": "Follow topics you create",
"follow-replied-topics": "Follow topics that you reply to"
"follow-replied-topics": "Follow topics that you reply to",
"default-notification-settings": "Default notification settings"
}

@ -213,7 +213,7 @@ function getNotificationSettings(userData, callback) {
},
function (results, next) {
function modifyType(type) {
var setting = userData.settings[type] || 'notification';
var setting = userData.settings[type];
return {
name: type,

@ -0,0 +1,26 @@
'use strict';
var async = require('async');
var db = require('../../database');
module.exports = {
name: 'Add default settings for notification delivery types',
timestamp: Date.UTC(2018, 1, 14),
method: function (callback) {
async.waterfall([
function (next) {
db.getObject('config', next);
},
function (config, next) {
db.setObject('config', {
notificationType_upvote: config.notificationType_upvote || 'notification',
'notificationType_new-topic': config.notificationType_upvote || 'notification',
'notificationType_new-reply': config.notificationType_upvote || 'notification',
notificationType_follow: config.notificationType_upvote || 'notification',
'notificationType_new-chat': config.notificationType_upvote || 'notification',
'notificationType_group-invite': config.notificationType_upvote || 'notification',
}, next);
},
], callback);
},
};

@ -81,6 +81,12 @@ module.exports = function (User) {
settings.delayImageLoading = parseInt(getSetting(settings, 'delayImageLoading', 1), 10) === 1;
settings.bootswatchSkin = settings.bootswatchSkin || meta.config.bootswatchSkin || 'default';
settings.scrollToMyPost = parseInt(getSetting(settings, 'scrollToMyPost', 1), 10) === 1;
settings.notificationType_upvote = getSetting(settings, 'notificationType_upvote', 'notification');
settings['notificationType_new-topic'] = getSetting(settings, 'notificationType_new-topic', 'notification');
settings['notificationType_new-reply'] = getSetting(settings, 'notificationType_new-reply', 'notification');
settings.notificationType_follow = getSetting(settings, 'notificationType_follow', 'notification');
settings['notificationType_new-chat'] = getSetting(settings, 'notificationType_new-chat', 'notification');
settings['notificationType_group-invite'] = getSetting(settings, 'notificationType_group-invite', 'notification');
next(null, settings);
},
], callback);

@ -232,7 +232,6 @@
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/user:default-user-settings]]</div>
<div class="col-sm-10 col-xs-12">
<form>
<div class="checkbox">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input class="mdl-switch__input" type="checkbox" data-field="showemail">
@ -292,6 +291,85 @@
</label>
</div>
<label>[[admin/settings/user:default-notification-settings]]</label>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_upvote]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_upvote">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_new-topic]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_new-topic">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_new-reply]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_new-reply">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_follow]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_follow">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_new-chat]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_new-chat">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col-xs-7">
<label>[[notifications:notificationType_group-invite]]</label>
</div>
<div class="form-group col-xs-5">
<select class="form-control" data-field="notificationType_group-invite">
<option value="none">[[notifications:none]]</option>
<option value="notification">[[notifications:notification_only]]</option>
<option value="email">[[notifications:email_only]]</option>
<option value="notificationemail">[[notifications:notification_and_email]]</option>
</select>
</div>
</div>
</form>
</div>
</div>

@ -357,7 +357,7 @@ describe('Notifications', function () {
setTimeout(function () {
user.notifications.getAll(uid, 'post', function (err, nids) {
assert.ifError(err);
assert.notEqual(nids.indexOf(nid), -1);
assert(nids.includes(nid));
done();
});
}, 1500);

Loading…
Cancel
Save