Rename globalSwitchoff to disableCommenting.

This commit is contained in:
Fabian Neumann
2018-05-11 12:21:13 +02:00
parent d731357001
commit bae20c38ec
10 changed files with 36 additions and 36 deletions
@@ -82,17 +82,17 @@ class StreamSettings extends React.Component {
this.props.updatePending({ updater });
};
updateGlobalSwitchoffEnable = () => {
updateDisableCommenting = () => {
const updater = {
globalSwitchoffEnable: {
$set: !this.props.settings.globalSwitchoffEnable,
disableCommenting: {
$set: !this.props.settings.disableCommenting,
},
};
this.props.updatePending({ updater });
};
updateGlobalSwitchoffMessage = value => {
const updater = { globalSwitchoffMessage: { $set: value } };
updateDisableCommentingMessage = value => {
const updater = { disableCommentingMessage: { $set: value } };
this.props.updatePending({ updater });
};
@@ -207,21 +207,21 @@ class StreamSettings extends React.Component {
{t('configure.edit_comment_timeframe_text_post')}
</ConfigureCard>
<ConfigureCard
checked={settings.globalSwitchoffEnable}
onCheckbox={this.updateGlobalSwitchoffEnable}
title={t('configure.global_switchoff_title')}
checked={settings.disableCommenting}
onCheckbox={this.updateDisableCommenting}
title={t('configure.disable_commenting_title')}
>
<p>{t('configure.global_switchoff_desc')}</p>
<p>{t('configure.disable_commenting_desc')}</p>
<div
className={cn(
styles.configSettingGlobalSwitchoff,
settings.globalSwitchoffEnable ? null : styles.hidden
styles.configSettingDisableCommenting,
settings.disableCommenting ? null : styles.hidden
)}
>
<MarkdownEditor
className={styles.descriptionBox}
onChange={this.updateGlobalSwitchoffMessage}
value={settings.globalSwitchoffMessage}
onChange={this.updateDisableCommentingMessage}
value={settings.disableCommentingMessage}
/>
</div>
</ConfigureCard>
@@ -39,8 +39,8 @@ export default compose(
autoCloseStream
closedTimeout
closedMessage
globalSwitchoffEnable
globalSwitchoffMessage
disableCommenting
disableCommentingMessage
${getSlotFragmentSpreads(slots, 'settings')}
}
`,
@@ -216,7 +216,7 @@ class Stream extends React.Component {
currentUser,
} = this.props;
const { keepCommentBox } = this.state;
const open = !(asset.isClosed || asset.settings.globalSwitchoffEnable);
const open = !(asset.isClosed || asset.settings.disableCommenting);
const banned = get(currentUser, 'status.banned.status');
const suspensionUntil = get(currentUser, 'status.suspension.until');
@@ -298,7 +298,7 @@ class Stream extends React.Component {
{asset.isClosed ? (
<p>{asset.settings.closedMessage}</p>
) : (
<Markdown content={asset.settings.globalSwitchoffMessage} />
<Markdown content={asset.settings.disableCommentingMessage} />
)}
</div>
)}
@@ -434,8 +434,8 @@ const fragments = {
questionBoxIcon
closedTimeout
closedMessage
globalSwitchoffEnable
globalSwitchoffMessage
disableCommenting
disableCommentingMessage
charCountEnable
charCount
requireEmailConfirmation
+8 -8
View File
@@ -837,12 +837,12 @@ type Settings {
# closed.
closedMessage: String
# globalSwitchoffEnable will disable commenting site-wide.
globalSwitchoffEnable: Boolean
# disableCommenting will disable commenting site-wide.
disableCommenting: Boolean
# globalSwitchoffMessage will be shown above the comment stream while
# disableCommentingMessage will be shown above the comment stream while
# commenting is disabled site-wide.
globalSwitchoffMessage: String
disableCommentingMessage: String
# editCommentWindowLength is the length of time (in milliseconds) after a
# comment is posted that it can still be edited by the author.
@@ -1307,12 +1307,12 @@ input UpdateSettingsInput {
# closed.
closedMessage: String
# globalSwitchoffEnable will disable commenting site-wide.
globalSwitchoffEnable: Boolean
# disableCommenting will disable commenting site-wide.
disableCommenting: Boolean
# globalSwitchoffMessage will be shown above the comment stream while
# disableCommentingMessage will be shown above the comment stream while
# commenting is disabled site-wide.
globalSwitchoffMessage: String
disableCommentingMessage: String
# charCountEnable is true when the character count restriction is enabled.
charCountEnable: Boolean
+2 -2
View File
@@ -121,6 +121,8 @@ de:
custom_css_url_desc: "URL eines CSS-Stylesheets zum Überschreiben des Standard-Designs"
days: Tage
description: "Als Administrator können Sie die Einstellungen für den Kommentarbereich dieses Artikels anpassen:"
disable_commenting_title: "Kommentieren global deaktivieren"
disable_commenting_desc: "Verfassen Sie eine Nachricht, die angezeigt wird, solange das Kommentieren deaktiviert ist."
domain_list_text: "Geben Sie Domains an, für die diese Talk-Instanz freigegeben werden soll, z.B. für lokale Test- oder Produktionsumgebungen (Bsp.: localhost:3000 staging.domain.com domain.com)."
domain_list_title: "Zugelassene Domains"
edit_comment_timeframe_heading: "Zeitlimit zur Bearbeitung von Kommentaren"
@@ -136,8 +138,6 @@ 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."
+2 -2
View File
@@ -124,6 +124,8 @@ en:
custom_css_url_desc: "URL of a CSS stylesheet that will override default Embed Stream styles. Can be internal or external."
days: Days
description: "Change the comment settings on this story."
disable_commenting_title: "Deactivate commenting site-wide"
disable_commenting_desc: "Write a message that will be displayed while commenting is deactivated."
domain_list_text: "Enter the domains you would like to permit for Talk e.g. your local staging and production environments (ex. localhost:3000 staging.domain.com domain.com)."
domain_list_title: "Permitted Domains"
edit_info: "Edit Info"
@@ -140,8 +142,6 @@ 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."
+2 -2
View File
@@ -66,11 +66,11 @@ const Setting = new Schema(
type: String,
default: 'Expired',
},
globalSwitchoffEnable: {
disableCommenting: {
type: Boolean,
default: false,
},
globalSwitchoffMessage: {
disableCommentingMessage: {
type: String,
default: '',
},
@@ -3,7 +3,7 @@ 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);
if (asset.settings.disableCommenting) {
throw new ErrCommentingDisabled(asset.settings.disableCommentingMessage);
}
};
+1 -1
View File
@@ -194,7 +194,7 @@ describe('graph.mutations.createComment', () => {
beforeEach(() =>
AssetModel.create({
id: '123',
settings: { globalSwitchoffEnable: disabled },
settings: { disableCommenting: disabled },
})
);