)}
diff --git a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js
index f1a973f03..99878a9b9 100644
--- a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js
+++ b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js
@@ -434,6 +434,8 @@ const fragments = {
questionBoxIcon
closedTimeout
closedMessage
+ globalSwitchoffEnable
+ globalSwitchoffMessage
charCountEnable
charCount
requireEmailConfirmation
diff --git a/errors.js b/errors.js
index da1287dd3..39cb6b8ff 100644
--- a/errors.js
+++ b/errors.js
@@ -161,6 +161,24 @@ class ErrAssetCommentingClosed extends TalkError {
}
}
+// ErrCommentingDisabled is returned when a comment or action is attempted while
+// commenting has been disabled site-wide.
+class ErrCommentingDisabled extends TalkError {
+ constructor(message = null) {
+ super(
+ 'asset commenting is closed',
+ {
+ status: 400,
+ translation_key: 'COMMENTING_DISABLED',
+ },
+ {
+ // Include the closedMessage in the metadata piece of the error.
+ message,
+ }
+ );
+ }
+}
+
/**
* ErrAuthentication is returned when there is an error authenticating and the
* message is provided.
@@ -387,6 +405,7 @@ module.exports = {
ErrAuthentication,
ErrCannotIgnoreStaff,
ErrCommentTooShort,
+ ErrCommentingDisabled,
ErrContainsProfanity,
ErrEditWindowHasEnded,
ErrEmailAlreadyVerified,
diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql
index 03c97ce58..dda86291f 100644
--- a/graph/typeDefs.graphql
+++ b/graph/typeDefs.graphql
@@ -837,6 +837,13 @@ type Settings {
# closed.
closedMessage: String
+ # globalSwitchoffEnable will disable commenting site-wide.
+ globalSwitchoffEnable: Boolean
+
+ # globalSwitchoffMessage will be shown above the comment stream while
+ # commenting is disabled site-wide.
+ globalSwitchoffMessage: String
+
# editCommentWindowLength is the length of time (in milliseconds) after a
# comment is posted that it can still be edited by the author.
editCommentWindowLength: Int
@@ -1300,6 +1307,13 @@ input UpdateSettingsInput {
# closed.
closedMessage: String
+ # globalSwitchoffEnable will disable commenting site-wide.
+ globalSwitchoffEnable: Boolean
+
+ # globalSwitchoffMessage will be shown above the comment stream while
+ # commenting is disabled site-wide.
+ globalSwitchoffMessage: String
+
# charCountEnable is true when the character count restriction is enabled.
charCountEnable: Boolean
diff --git a/locales/de.yml b/locales/de.yml
index d2b247fbc..00cbb007c 100644
--- a/locales/de.yml
+++ b/locales/de.yml
@@ -136,6 +136,8 @@ de:
enable_premod_links_description: "Moderatoren müssen jeden Kommentar, der einen Link enthält, freigeben, bevor er veröffentlicht wird."
enable_questionbox: "Stellen Sie den Lesern eine Frage"
enable_questionbox_description: "Diese Frage erscheint am Anfang des Kommentarbereichs. Regen Sie eine Diskussion an."
+ global_switchoff_title: "Kommentieren global deaktivieren"
+ global_switchoff_desc: "Verfassen Sie eine Nachricht, die angezeigt wird, solange das Kommentieren deaktiviert ist."
hours: Stunden
include_comment_stream: "Einleitung zum Kommentarbereich"
include_comment_stream_desc: "Verfassen Sie eine Einleitung, die über jedem Kommentarbereich erscheint. Nützlich z.B. für Community-Richtlinien."
@@ -223,6 +225,7 @@ de:
LOGIN_MAXIMUM_EXCEEDED: "Sie haben zu häufig erfolglos versucht, sich anzumelden. Bitte warten Sie."
PASSWORD_REQUIRED: "Passwort ist erforderlich"
COMMENTING_CLOSED: "Kommentarbereich ist bereits geschlossen"
+ COMMENTING_DISABLED: "Die Kommentarfunktion ist derzeit abgeschaltet"
NOT_FOUND: "Ressource nicht gefunden"
ALREADY_EXISTS: "Ressource existiert bereits"
INVALID_ASSET_URL: "Asset-URL ist ungültig"
diff --git a/locales/en.yml b/locales/en.yml
index e293fb40b..eae0e43c9 100644
--- a/locales/en.yml
+++ b/locales/en.yml
@@ -140,6 +140,8 @@ en:
enable_premod_links_description: "Moderators must approve any comment containing a link before it is published."
enable_questionbox: "Ask Readers a Question"
enable_questionbox_description: "This question will appear at the top of this comment stream. Ask readers about a certain issue in the article or pose discussion questions etc."
+ global_switchoff_title: "Deactivate commenting site-wide"
+ global_switchoff_desc: "Write a message that will be displayed while commenting is deactivated."
hours: Hours
include_comment_stream: "Include Comment Stream Description for Readers"
include_comment_stream_desc: "Write a message to be added to the top of your comment stream. Pose a topic include community guidelines etc."
@@ -247,6 +249,7 @@ en:
LOGIN_MAXIMUM_EXCEEDED: "You have made too many unsuccessful password attempts. Please wait."
PASSWORD_REQUIRED: "Must input a password"
COMMENTING_CLOSED: "Commenting is already closed"
+ COMMENTING_DISABLED: "Commenting is currently disabled on this site"
NOT_FOUND: "Resource not found"
ALREADY_EXISTS: "Resource already exists"
INVALID_ASSET_URL: "Assert URL is invalid"
diff --git a/models/schema/setting.js b/models/schema/setting.js
index eb9dc76d1..a896c797e 100644
--- a/models/schema/setting.js
+++ b/models/schema/setting.js
@@ -66,6 +66,14 @@ const Setting = new Schema(
type: String,
default: 'Expired',
},
+ globalSwitchoffEnable: {
+ type: Boolean,
+ default: false,
+ },
+ globalSwitchoffMessage: {
+ type: String,
+ default: '',
+ },
wordlist: {
banned: {
type: Array,
diff --git a/plugins/talk-plugin-global-switchoff/.eslintrc.json b/plugins/talk-plugin-global-switchoff/.eslintrc.json
deleted file mode 100644
index 9fe56bd14..000000000
--- a/plugins/talk-plugin-global-switchoff/.eslintrc.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "env": {
- "browser": true,
- "es6": true,
- "mocha": true
- },
- "parserOptions": {
- "sourceType": "module",
- "ecmaFeatures": {
- "experimentalObjectRestSpread": true,
- "jsx": true
- }
- },
- "parser": "babel-eslint",
- "plugins": [
- "react"
- ],
- "rules": {
- "react/jsx-uses-react": "error",
- "react/jsx-uses-vars": "error",
- "no-console": ["warn", { "allow": ["warn", "error"] }]
- }
-}
diff --git a/plugins/talk-plugin-global-switchoff/client/components/GlobalSwitchoff.js b/plugins/talk-plugin-global-switchoff/client/components/GlobalSwitchoff.js
deleted file mode 100644
index d676e7531..000000000
--- a/plugins/talk-plugin-global-switchoff/client/components/GlobalSwitchoff.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import React from 'react';
-import ConfigureCard from 'coral-framework/components/ConfigureCard';
-import MarkdownEditor from 'coral-framework/components/MarkdownEditor';
-import t from 'coral-framework/services/i18n';
-import cn from 'classnames';
-import styles from './styles.css';
-
-const plugin = 'talk-plugin-global-switchoff';
-
-class GlobalSwitchoff extends React.Component {
- updateGlobalSwitchoffEnable = () => {
- const updater = {
- globalSwitchoffEnable: {
- $set: !this.props.settings.globalSwitchoffEnable,
- },
- };
- this.props.updatePending({ updater });
- };
-
- updateGlobalSwitchoffMessage = () => {};
-
- render() {
- const { settings } = this.props;
- return (
-
-