mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-04 19:41:16 +01:00
moved rewards/conditions/conditoinals out of core into rewards-essentials
This commit is contained in:
@@ -5,30 +5,6 @@ var rewards = {},
|
||||
plugins = require('../plugins'),
|
||||
db = require('../database');
|
||||
|
||||
var defaults = {
|
||||
conditionals: [
|
||||
{
|
||||
"name": ">",
|
||||
"conditional": "greaterthan"
|
||||
},
|
||||
{
|
||||
"name": ">=",
|
||||
"conditional": "greaterorequalthan"
|
||||
},
|
||||
{
|
||||
"name": "<",
|
||||
"conditional": "lesserthan"
|
||||
},
|
||||
{
|
||||
"name": "<=",
|
||||
"conditional": "lesserorequalthan"
|
||||
},
|
||||
{
|
||||
"name": "string:",
|
||||
"conditional": "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
rewards.save = function(data, callback) {
|
||||
function save(data, next) {
|
||||
@@ -75,68 +51,13 @@ rewards.get = function(callback) {
|
||||
async.parallel({
|
||||
active: getActiveRewards,
|
||||
conditions: function(next) {
|
||||
plugins.fireHook('filter:rewards.conditions', [
|
||||
{
|
||||
"name": "Reputation",
|
||||
"condition": "core:user.reputation"
|
||||
},
|
||||
{
|
||||
"name": "Post Count",
|
||||
"condition": "core:user.postcount"
|
||||
},
|
||||
{
|
||||
"name": "Last Logged in Time",
|
||||
"condition": "core:user.lastonline"
|
||||
}
|
||||
], next);
|
||||
plugins.fireHook('filter:rewards.conditions', [], next);
|
||||
},
|
||||
conditionals: function(next) {
|
||||
plugins.fireHook('filter:rewards.conditionals', defaults.conditionals, next);
|
||||
plugins.fireHook('filter:rewards.conditionals', [], next);
|
||||
},
|
||||
rewards: function(next) {
|
||||
plugins.fireHook('filter:rewards.rewards', [
|
||||
{
|
||||
"rid": "core:add-to-group",
|
||||
"name": "Add to Group",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "select",
|
||||
"name": "groupname",
|
||||
"label": "Group Name:",
|
||||
"values": [
|
||||
{
|
||||
"name": "Group 1",
|
||||
"value": "group1"
|
||||
},
|
||||
{
|
||||
"name": "Group 2",
|
||||
"value": "group2"
|
||||
},
|
||||
{
|
||||
"name": "Group 3",
|
||||
"value": "group3"
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"rid": "core:alert-user",
|
||||
"name": "Send alert message",
|
||||
"inputs": [
|
||||
{
|
||||
"type": "text",
|
||||
"name": "title",
|
||||
"label": "Title:"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"name": "message",
|
||||
"label": "Message:"
|
||||
}
|
||||
]
|
||||
}
|
||||
], next);
|
||||
plugins.fireHook('filter:rewards.rewards', [], next);
|
||||
}
|
||||
}, callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user