diff --git a/bin/cli-settings b/bin/cli-settings index 47acebbf9..b4acfae61 100755 --- a/bin/cli-settings +++ b/bin/cli-settings @@ -22,7 +22,7 @@ program .command('init') .description('initilizes the talk settings') .action(() => { - const defaults = {id: '1', moderation: 'pre'}; + const defaults = {id: '1', moderation: 'PRE'}; SettingsService .init(defaults) diff --git a/client/coral-admin/src/containers/Configure/CommentSettings.js b/client/coral-admin/src/containers/Configure/CommentSettings.js index 9fb3d75da..0ccb5f820 100644 --- a/client/coral-admin/src/containers/Configure/CommentSettings.js +++ b/client/coral-admin/src/containers/Configure/CommentSettings.js @@ -28,7 +28,7 @@ const updateCharCount = (updateSettings, settingsError) => (event) => { }; const updateModeration = (updateSettings, mod) => () => { - const moderation = mod === 'pre' ? 'post' : 'pre'; + const moderation = mod === 'PRE' ? 'POST' : 'PRE'; updateSettings({moderation}); }; @@ -70,15 +70,15 @@ const CommentSettings = ({fetchingSettings, title, updateSettings, settingsError return (

{title}

- +
+ checked={settings.moderation === 'PRE'} />
{lang.t('configure.enable-pre-moderation')}
-

+

{lang.t('configure.enable-pre-moderation-text')}

diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js index b114d93ae..25db9b38b 100644 --- a/client/coral-configure/containers/ConfigureStreamContainer.js +++ b/client/coral-configure/containers/ConfigureStreamContainer.js @@ -14,7 +14,7 @@ class ConfigureStreamContainer extends Component { super(props); this.state = { - premod: props.config.moderation === 'pre', + premod: props.config.moderation === 'PRE', premodLinks: false }; @@ -26,7 +26,7 @@ class ConfigureStreamContainer extends Component { handleApply () { const {premod, changed} = this.state; const newConfig = { - moderation: premod ? 'pre' : 'post' + moderation: premod ? 'PRE' : 'POST' }; if (changed) { this.props.updateConfiguration(newConfig); diff --git a/client/coral-framework/helpers/response.js b/client/coral-framework/helpers/response.js index e4e6e7c37..d6931b92c 100644 --- a/client/coral-framework/helpers/response.js +++ b/client/coral-framework/helpers/response.js @@ -18,7 +18,7 @@ const buildOptions = (inputOptions = {}) => { if (options._csrf) { switch (options.method.toLowerCase()) { - case 'post': + case 'POST': case 'put': case 'delete': options.headers['x-csrf-token'] = options._csrf; diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 953afbecb..54fee8319 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -120,7 +120,7 @@ class CommentBox extends Component { cStyle={!length || (charCount && length > charCount) ? 'lightGrey' : 'darkGrey'} className={`${name}-button`} onClick={this.postComment}> - {lang.t('post')} + {lang.t('POST')} ) } diff --git a/init.js b/init.js index 71f05623f..7c56d71cc 100644 --- a/init.js +++ b/init.js @@ -5,7 +5,7 @@ module.exports = () => Promise.all([ // Upsert the settings object. SettingsService.init({ id: '1', - moderation: 'pre', + moderation: 'PRE', wordlist: { banned: [], suspect: [] diff --git a/models/setting.js b/models/setting.js index 9d2a7028f..3d478b2d9 100644 --- a/models/setting.js +++ b/models/setting.js @@ -20,10 +20,10 @@ const SettingSchema = new Schema({ moderation: { type: String, enum: [ - 'pre', - 'post' + 'PRE', + 'POST' ], - default: 'pre' + default: 'PRE' }, infoBoxEnable: { type: Boolean, diff --git a/test/e2e/tests/EmbedStreamTests.js b/test/e2e/tests/EmbedStreamTests.js index d572c2695..70b4c6ad0 100644 --- a/test/e2e/tests/EmbedStreamTests.js +++ b/test/e2e/tests/EmbedStreamTests.js @@ -20,7 +20,7 @@ module.exports = { }, 'User registers and posts a comment with premod off': client => { client.perform((client, done) => { - mocks.settings({moderation: 'post'}) + mocks.settings({moderation: 'POST'}) .then(() => { // Load Page @@ -61,7 +61,7 @@ module.exports = { }, 'User posts a comment with premod on': client => { client.perform((client, done) => { - mocks.settings({moderation: 'pre'}) + mocks.settings({moderation: 'PRE'}) .then(() => { // Load Page @@ -86,7 +86,7 @@ module.exports = { }, 'User replies to a comment with premod off': client => { client.perform((client, done) => { - mocks.settings({moderation: 'post'}) + mocks.settings({moderation: 'POST'}) .then(() => { // Load Page @@ -119,7 +119,7 @@ module.exports = { }, 'User replies to a comment with premod on': client => { client.perform((client, done) => { - mocks.settings({moderation: 'pre'}) + mocks.settings({moderation: 'PRE'}) // Add a mock user .then(() => { diff --git a/test/routes/api/comments/index.js b/test/routes/api/comments/index.js index d91e58402..c305f9f6b 100644 --- a/test/routes/api/comments/index.js +++ b/test/routes/api/comments/index.js @@ -15,7 +15,7 @@ const CommentsService = require('../../../../services/comments'); const UsersService = require('../../../../services/users'); const SettingsService = require('../../../../services/settings'); -const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; +const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; describe('/api/v1/comments', () => { diff --git a/test/routes/api/queue/index.js b/test/routes/api/queue/index.js index bf300a001..848cf10e6 100644 --- a/test/routes/api/queue/index.js +++ b/test/routes/api/queue/index.js @@ -13,7 +13,7 @@ const Action = require('../../../../models/action'); const UsersService = require('../../../../services/users'); const SettingsService = require('../../../../services/settings'); -const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['banned'], suspect: ['suspect']}}; +const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['banned'], suspect: ['suspect']}}; describe('/api/v1/queue', () => { const comments = [{ diff --git a/test/routes/api/settings/index.js b/test/routes/api/settings/index.js index c6a1fd1a7..dfe846edf 100644 --- a/test/routes/api/settings/index.js +++ b/test/routes/api/settings/index.js @@ -8,7 +8,7 @@ chai.should(); chai.use(require('chai-http')); const SettingsService = require('../../../../services/settings'); -const defaults = {id: '1', moderation: 'pre'}; +const defaults = {id: '1', moderation: 'PRE'}; describe('/api/v1/settings', () => { @@ -25,7 +25,7 @@ describe('/api/v1/settings', () => { .then((res) => { expect(res).to.have.status(200); expect(res).to.be.json; - expect(res.body).to.have.property('moderation', 'pre'); + expect(res.body).to.have.property('moderation', 'PRE'); }); }); }); @@ -36,14 +36,14 @@ describe('/api/v1/settings', () => { return chai.request(app) .put('/api/v1/settings') .set(passport.inject({roles: ['ADMIN']})) - .send({moderation: 'post'}) + .send({moderation: 'POST'}) .then((res) => { expect(res).to.have.status(204); return SettingsService.retrieve(); }) .then((settings) => { - expect(settings).to.have.property('moderation', 'post'); + expect(settings).to.have.property('moderation', 'POST'); }); }); }); diff --git a/test/routes/api/user/index.js b/test/routes/api/user/index.js index f9ceac3b4..1bb36ea2c 100644 --- a/test/routes/api/user/index.js +++ b/test/routes/api/user/index.js @@ -6,7 +6,7 @@ const chai = require('chai'); const expect = chai.expect; const SettingsService = require('../../../../services/settings'); -const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; +const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; // Setup chai. chai.should(); diff --git a/test/services/assets.js b/test/services/assets.js index c748a9797..ff8d9e175 100644 --- a/test/services/assets.js +++ b/test/services/assets.js @@ -72,7 +72,7 @@ describe('services.AssetsService', () => { expect(asset).to.have.property('settings'); expect(asset.settings).to.be.null; - return AssetsService.overrideSettings(asset.id, {moderation: 'pre'}); + return AssetsService.overrideSettings(asset.id, {moderation: 'PRE'}); }) .then(() => { return AssetsService.findOrCreateByUrl('https://override.test.com/asset'); @@ -80,7 +80,7 @@ describe('services.AssetsService', () => { .then((asset) => { expect(asset).to.have.property('settings'); expect(asset.settings).is.an('object'); - expect(asset.settings).to.have.property('moderation', 'pre'); + expect(asset.settings).to.have.property('moderation', 'PRE'); }); }); }); diff --git a/test/services/comments.js b/test/services/comments.js index a2e7d3bcc..fc2105cb1 100644 --- a/test/services/comments.js +++ b/test/services/comments.js @@ -6,7 +6,7 @@ const UsersService = require('../../services/users'); const SettingsService = require('../../services/settings'); const CommentsService = require('../../services/comments'); -const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; +const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; const expect = require('chai').expect; diff --git a/test/services/settings.js b/test/services/settings.js index c99bd07a6..3620ae633 100644 --- a/test/services/settings.js +++ b/test/services/settings.js @@ -3,12 +3,12 @@ const expect = require('chai').expect; describe('services.SettingsService', () => { - beforeEach(() => SettingsService.init({moderation: 'pre', wordlist: ['donut']})); + beforeEach(() => SettingsService.init({moderation: 'PRE', wordlist: ['donut']})); describe('#retrieve()', () => { it('should have a moderation field defined', () => { return SettingsService.retrieve().then(settings => { - expect(settings).to.have.property('moderation').and.to.equal('pre'); + expect(settings).to.have.property('moderation').and.to.equal('PRE'); }); }); @@ -22,10 +22,10 @@ describe('services.SettingsService', () => { describe('#update()', () => { it('should update the settings with a passed object', () => { - const mockSettings = {moderation: 'post', infoBoxEnable: true, infoBoxContent: 'yeah'}; + const mockSettings = {moderation: 'POST', infoBoxEnable: true, infoBoxContent: 'yeah'}; return SettingsService.update(mockSettings).then(updatedSettings => { expect(updatedSettings).to.be.an('object'); - expect(updatedSettings).to.have.property('moderation').and.to.equal('post'); + expect(updatedSettings).to.have.property('moderation').and.to.equal('POST'); expect(updatedSettings).to.have.property('infoBoxEnable', true); expect(updatedSettings).to.have.property('infoBoxContent', 'yeah'); }); @@ -45,11 +45,11 @@ describe('services.SettingsService', () => { return SettingsService .retrieve() .then((settings) => { - let ovrSett = {moderation: 'post'}; + let ovrSett = {moderation: 'POST'}; settings.merge(ovrSett); - expect(settings).to.have.property('moderation', 'post'); + expect(settings).to.have.property('moderation', 'POST'); }); }); }); diff --git a/test/services/users.js b/test/services/users.js index 44f065531..e2e5655e4 100644 --- a/test/services/users.js +++ b/test/services/users.js @@ -7,7 +7,7 @@ describe('services.UsersService', () => { let mockUsers; beforeEach(() => { - const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; + const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; return SettingsService.init(settings).then(() => { return UsersService.createLocalUsers([{ diff --git a/test/services/wordlist.js b/test/services/wordlist.js index 183564495..6bd05e640 100644 --- a/test/services/wordlist.js +++ b/test/services/wordlist.js @@ -17,7 +17,7 @@ describe('services.Wordlist', () => { }; let wordlist = new Wordlist(); - const settings = {id: '1', moderation: 'pre', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; + const settings = {id: '1', moderation: 'PRE', wordlist: {banned: ['bad words'], suspect: ['suspect words']}}; beforeEach(() => SettingsService.init(settings));