Move "global switchoff" code from plugin to core

This commit is contained in:
Fabian Neumann
2018-05-11 11:28:58 +02:00
parent fab15daacd
commit 48fc3ab5db
24 changed files with 105 additions and 150 deletions
+2
View File
@@ -6,6 +6,7 @@ const {
wordlist,
commentLength,
assetClosed,
commentingDisabled,
karma,
staff,
links,
@@ -36,6 +37,7 @@ const applyStatus = status => () => ({ status });
const phases = [
commentLength,
assetClosed,
commentingDisabled,
wordlist,
staff,
links,
@@ -0,0 +1,9 @@
const { ErrCommentingDisabled } = require('../../../errors');
// This phase checks to see if commenting is site-wide disabled.
module.exports = (ctx, comment, { asset }) => {
// Check to see if the asset has closed commenting...
if (asset.settings.globalSwitchoffEnable) {
throw new ErrCommentingDisabled(asset.settings.globalSwitchoffMessage);
}
};
+1
View File
@@ -1,6 +1,7 @@
module.exports.wordlist = require('./wordlist');
module.exports.commentLength = require('./commentLength');
module.exports.assetClosed = require('./assetClosed');
module.exports.commentingDisabled = require('./commentingDisabled');
module.exports.karma = require('./karma');
module.exports.staff = require('./staff');
module.exports.links = require('./links');