Added option to mark a list as not being allowed to be subscribed by public users using the form.
The settings is a checkbox in list create/edit.
This commit is contained in:
parent
80cf2c8888
commit
c74232e9c5
7 changed files with 60 additions and 12 deletions
|
@ -6,7 +6,7 @@ let shortid = require('shortid');
|
|||
let segments = require('./segments');
|
||||
let _ = require('../translate')._;
|
||||
|
||||
let allowedKeys = ['description', 'default_form'];
|
||||
let allowedKeys = ['description', 'default_form', 'public_subscribe'];
|
||||
|
||||
module.exports.list = (start, limit, callback) => {
|
||||
db.getConnection((err, connection) => {
|
||||
|
@ -111,6 +111,8 @@ module.exports.get = (id, callback) => {
|
|||
module.exports.create = (list, callback) => {
|
||||
|
||||
let data = tools.convertKeys(list);
|
||||
data.publicSubscribe = data.publicSubscribe ? 1 : 0;
|
||||
|
||||
let name = (data.name || '').toString().trim();
|
||||
|
||||
if (!data) {
|
||||
|
@ -120,8 +122,8 @@ module.exports.create = (list, callback) => {
|
|||
let keys = ['name'];
|
||||
let values = [name];
|
||||
|
||||
Object.keys(list).forEach(key => {
|
||||
let value = list[key].trim();
|
||||
Object.keys(data).forEach(key => {
|
||||
let value = data[key].toString().trim();
|
||||
key = tools.toDbKey(key);
|
||||
if (key === 'description') {
|
||||
value = tools.purifyHTML(value);
|
||||
|
@ -169,6 +171,7 @@ module.exports.update = (id, updates, callback) => {
|
|||
id = Number(id) || 0;
|
||||
|
||||
let data = tools.convertKeys(updates);
|
||||
data.publicSubscribe = data.publicSubscribe ? 1 : 0;
|
||||
|
||||
let name = (data.name || '').toString().trim();
|
||||
let keys = ['name'];
|
||||
|
@ -182,8 +185,8 @@ module.exports.update = (id, updates, callback) => {
|
|||
return callback(new Error(_('List Name must be set')));
|
||||
}
|
||||
|
||||
Object.keys(updates).forEach(key => {
|
||||
let value = updates[key].trim();
|
||||
Object.keys(data).forEach(key => {
|
||||
let value = data[key].toString().trim();
|
||||
key = tools.toDbKey(key);
|
||||
if (key === 'description') {
|
||||
value = tools.purifyHTML(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue