mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
Move "global switchoff" code from plugin to core
This commit is contained in:
@@ -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,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');
|
||||
|
||||
Reference in New Issue
Block a user