mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
Add notification frequencies from nodebb-plugin-upvote-notifications. (#6640)
* Add notification frequencies from nodebb-plugin-upvote-notifications. https://github.com/boomzillawtf/nodebb-plugin-upvote-notifications * Fix editing settings clearing upvote notification preferences.
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
11258dac9c
commit
f1a6537fc2
@@ -117,7 +117,9 @@
|
|||||||
"no-sound": "No sound",
|
"no-sound": "No sound",
|
||||||
"upvote-notif-freq": "Upvote Notification Frequency",
|
"upvote-notif-freq": "Upvote Notification Frequency",
|
||||||
"upvote-notif-freq.all": "All Upvotes",
|
"upvote-notif-freq.all": "All Upvotes",
|
||||||
|
"upvote-notif-freq.first": "First Per Post",
|
||||||
"upvote-notif-freq.everyTen": "Every Ten Upvotes",
|
"upvote-notif-freq.everyTen": "Every Ten Upvotes",
|
||||||
|
"upvote-notif-freq.threshold": "On 1, 5, 10, 25, 50, 100, 150, 200...",
|
||||||
"upvote-notif-freq.logarithmic": "On 10, 100, 1000...",
|
"upvote-notif-freq.logarithmic": "On 10, 100, 1000...",
|
||||||
"upvote-notif-freq.disabled": "Disabled",
|
"upvote-notif-freq.disabled": "Disabled",
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,9 @@ settingsController.get = function (req, res, callback) {
|
|||||||
|
|
||||||
var notifFreqOptions = [
|
var notifFreqOptions = [
|
||||||
'all',
|
'all',
|
||||||
|
'first',
|
||||||
'everyTen',
|
'everyTen',
|
||||||
|
'threshold',
|
||||||
'logarithmic',
|
'logarithmic',
|
||||||
'disabled',
|
'disabled',
|
||||||
];
|
];
|
||||||
@@ -156,7 +158,7 @@ settingsController.get = function (req, res, callback) {
|
|||||||
userData.upvoteNotifFreq = notifFreqOptions.map(function (name) {
|
userData.upvoteNotifFreq = notifFreqOptions.map(function (name) {
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
selected: name === userData.notifFreqOptions,
|
selected: name === userData.settings.upvoteNotifFreq,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -186,9 +186,15 @@ SocketHelpers.upvote = function (data, notification) {
|
|||||||
all: function () {
|
all: function () {
|
||||||
return votes > 0;
|
return votes > 0;
|
||||||
},
|
},
|
||||||
|
first: function () {
|
||||||
|
return votes === 1;
|
||||||
|
},
|
||||||
everyTen: function () {
|
everyTen: function () {
|
||||||
return votes > 0 && votes % 10 === 0;
|
return votes > 0 && votes % 10 === 0;
|
||||||
},
|
},
|
||||||
|
threshold: function () {
|
||||||
|
return [1, 5, 10, 25].indexOf(votes) !== -1 || (votes >= 50 && votes % 50 === 0);
|
||||||
|
},
|
||||||
logarithmic: function () {
|
logarithmic: function () {
|
||||||
return votes > 1 && Math.log10(votes) % 1 === 0;
|
return votes > 1 && Math.log10(votes) % 1 === 0;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user