From b482cf0a0f490a9653422858625732b9713234b8 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 27 Jul 2017 12:03:25 +1000 Subject: [PATCH 1/2] updated styles --- docs/_sass/minimal-mistakes/_masthead.scss | 8 +++---- docs/_sass/minimal-mistakes/_navigation.scss | 8 +++---- docs/_sass/minimal-mistakes/_page.scss | 24 ++++++++++---------- docs/_sass/minimal-mistakes/_sidebar.scss | 4 ++-- docs/_sass/minimal-mistakes/_variables.scss | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/_sass/minimal-mistakes/_masthead.scss b/docs/_sass/minimal-mistakes/_masthead.scss index 39ebd2c7d..2b24a2950 100755 --- a/docs/_sass/minimal-mistakes/_masthead.scss +++ b/docs/_sass/minimal-mistakes/_masthead.scss @@ -5,10 +5,10 @@ .masthead { position: relative; border-bottom: 1px solid $border-color; - -webkit-animation: intro 0.3s both; - animation: intro 0.3s both; - -webkit-animation-delay: 0.15s; - animation-delay: 0.15s; + // -webkit-animation: intro 0.3s both; + // animation: intro 0.3s both; + // -webkit-animation-delay: 0.15s; + // animation-delay: 0.15s; z-index: 20; &__inner-wrap { diff --git a/docs/_sass/minimal-mistakes/_navigation.scss b/docs/_sass/minimal-mistakes/_navigation.scss index 4c1748f97..c1b081891 100755 --- a/docs/_sass/minimal-mistakes/_navigation.scss +++ b/docs/_sass/minimal-mistakes/_navigation.scss @@ -14,10 +14,10 @@ padding-left: 2em; padding-right: 2em; font-family: $sans-serif; - -webkit-animation: intro 0.3s both; - animation: intro 0.3s both; - -webkit-animation-delay: 0.30s; - animation-delay: 0.30s; + // -webkit-animation: intro 0.3s both; + // animation: intro 0.3s both; + // -webkit-animation-delay: 0.30s; + // animation-delay: 0.30s; @include breakpoint($large) { padding-left: 1em; diff --git a/docs/_sass/minimal-mistakes/_page.scss b/docs/_sass/minimal-mistakes/_page.scss index 6b77b3262..bb185f02d 100755 --- a/docs/_sass/minimal-mistakes/_page.scss +++ b/docs/_sass/minimal-mistakes/_page.scss @@ -8,10 +8,10 @@ margin-top: 2em; padding-left: 1em; padding-right: 1em; - -webkit-animation: intro 0.3s both; - animation: intro 0.3s both; - -webkit-animation-delay: 0.35s; - animation-delay: 0.35s; + // -webkit-animation: intro 0.3s both; + // animation: intro 0.3s both; + // -webkit-animation-delay: 0.35s; + // animation-delay: 0.35s; @include breakpoint($x-large) { max-width: $x-large; @@ -113,10 +113,10 @@ position: relative; margin-bottom: 2em; @include clearfix; - -webkit-animation: intro 0.3s both; - animation: intro 0.3s both; - -webkit-animation-delay: 0.25s; - animation-delay: 0.25s; + // -webkit-animation: intro 0.3s both; + // animation: intro 0.3s both; + // -webkit-animation-delay: 0.25s; + // animation-delay: 0.25s; &--overlay { position: relative; @@ -126,10 +126,10 @@ background-size: cover; background-repeat: no-repeat; background-position: center; - -webkit-animation: intro 0.3s both; - animation: intro 0.3s both; - -webkit-animation-delay: 0.25s; - animation-delay: 0.25s; + // -webkit-animation: intro 0.3s both; + // animation: intro 0.3s both; + // -webkit-animation-delay: 0.25s; + // animation-delay: 0.25s; a { color: #fff; diff --git a/docs/_sass/minimal-mistakes/_sidebar.scss b/docs/_sass/minimal-mistakes/_sidebar.scss index 1470aa80f..2100e13e5 100755 --- a/docs/_sass/minimal-mistakes/_sidebar.scss +++ b/docs/_sass/minimal-mistakes/_sidebar.scss @@ -16,8 +16,8 @@ @include breakpoint($large) { @include span(2 of 12); opacity: 0.75; - -webkit-transition: opacity 0.2s ease-in-out; - transition: opacity 0.2s ease-in-out; + // -webkit-transition: opacity 0.2s ease-in-out; + // transition: opacity 0.2s ease-in-out; &:hover { opacity: 1; diff --git a/docs/_sass/minimal-mistakes/_variables.scss b/docs/_sass/minimal-mistakes/_variables.scss index 2b59066c2..a485b5579 100755 --- a/docs/_sass/minimal-mistakes/_variables.scss +++ b/docs/_sass/minimal-mistakes/_variables.scss @@ -91,7 +91,7 @@ $xing-color : #006567 !default; /* links */ -$link-color : $info-color !default; +$link-color : #f67150 !default; $link-color-hover : mix(#000, $link-color, 25%) !default; $link-color-visited : mix(#fff, $link-color, 25%) !default; $masthead-link-color : $primary-color !default; @@ -126,4 +126,4 @@ $border-radius : 4px !default; $box-shadow : 0 1px 1px rgba(0, 0, 0, 0.125) !default; $navicon-width : 1.5rem !default; $navicon-height : 0.25rem !default; -$global-transition : all 0.2s ease-in-out !default; +$global-transition : none !default; From 30b3e91fdb8d7cb88e35649a9f17f7f35a4aa276 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 27 Jul 2017 15:34:04 +1000 Subject: [PATCH 2/2] documented more env vars --- config.js | 5 ++++- docs/_docs/02-01-configuration.md | 32 +++++++++++++++++++++++++++++++ services/karma.js | 25 +++++++++++++----------- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/config.js b/config.js index 83cb5089f..3769998ae 100644 --- a/config.js +++ b/config.js @@ -102,7 +102,10 @@ const CONFIG = { // DISABLE_AUTOFLAG_SUSPECT_WORDS is true when the suspect words that are // matched should not be flagged. - DISABLE_AUTOFLAG_SUSPECT_WORDS: process.env.TALK_DISABLE_AUTOFLAG_SUSPECT_WORDS === 'TRUE' + DISABLE_AUTOFLAG_SUSPECT_WORDS: process.env.TALK_DISABLE_AUTOFLAG_SUSPECT_WORDS === 'TRUE', + + // TRUST_THRESHOLDS defines the thresholds used for automoderation. + TRUST_THRESHOLDS: process.env.TRUST_THRESHOLDS || 'comment:-1,-1;flag:-1,-1' }; //============================================================================== diff --git a/docs/_docs/02-01-configuration.md b/docs/_docs/02-01-configuration.md index f8bb762fc..cb9a51d23 100644 --- a/docs/_docs/02-01-configuration.md +++ b/docs/_docs/02-01-configuration.md @@ -37,6 +37,15 @@ environment variables. Refer to the [config.js](https://github.com/coralproject/talk/blob/master/config.js) file to see how the configuration is parsed. +### Webpack + +These are only used during the webpack build. + +- `TALK_THREADING_LEVEL` (_optional_) - specify the maximum depth of the comment + thread. (Default `3`) +- `TALK_DEFAULT_STREAM_TAB` (_optional_) - specify the default stream tab in the + admin. (Default `all`) + ### Database - `TALK_MONGO_URL` (*required*) - the database connection string for the MongoDB database. @@ -91,6 +100,29 @@ on the contents of those variables.** - `TALK_RECAPTCHA_SECRET` (*required for reCAPTCHA support*) - server secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout. - `TALK_RECAPTCHA_PUBLIC` (*required for reCAPTCHA support*) - client secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout. +### Trust + +Trust can automoderate comments based on user history. By specifying this +option, the beheviour can be changed to offer different results. + +- `TRUST_THRESHOLDS` (_optional_) - configure the reliability thresholds for + flagging and commenting. (Default `comment:-1,-1;flag:-1,-1`) + +The form of the environment variable: + +``` +:,;:,;... +``` + +The default could be read as: + +- When a commenter has one comment rejected, their next comment must be + premoderated once in order to post freely again. If they instead get rejected + again, then they must have two of their comments approved in order to get + added back to the queue. +- At the moment of writing, beheviour is not attached to the flagging + reliability, but it is recorded. + ### Plugins - `TALK_PLUGINS_JSON` (_optional_) - used to specify the plugin config via the diff --git a/services/karma.js b/services/karma.js index c76bcebb3..a2c087eaa 100644 --- a/services/karma.js +++ b/services/karma.js @@ -1,22 +1,25 @@ const debug = require('debug')('talk:services:karma'); const UserModel = require('../models/user'); +const { + TRUST_THRESHOLDS +} = require('../config'); /** * This will create an object with the property name of the action type as the * key and an object as it's value. This will contain a RELIABLE, and UNRELIABLE * property with the number of karma points associated with their particular * state. - * + * * If only the RELIABLE variable is provided, then it will also be used as the * UNRELIABLE variable. - * + * * The form of the environment variable is: - * + * * :,;:,;... - * + * * The default used is: - * - * comment:1,1;flag:-1,-1 + * + * comment:-1,-1;flag:-1,-1 */ const parseThresholds = (thresholds) => thresholds .split(';') @@ -50,16 +53,16 @@ const parseThresholds = (thresholds) => thresholds return acc; }, { comment: { - RELIABLE: -1, - UNRELIABLE: -1 + RELIABLE: 0, + UNRELIABLE: 0 }, flag: { - RELIABLE: -1, - UNRELIABLE: -1 + RELIABLE: 0, + UNRELIABLE: 0 } }); -const THRESHOLDS = parseThresholds(process.env.TRUST_THRESHOLDS || ''); +const THRESHOLDS = parseThresholds(TRUST_THRESHOLDS); debug('using thresholds: ', THRESHOLDS);