diff --git a/client/coral-admin/src/containers/Configure/StreamSettings.js b/client/coral-admin/src/containers/Configure/StreamSettings.js index 568e0a075..950c5a2aa 100644 --- a/client/coral-admin/src/containers/Configure/StreamSettings.js +++ b/client/coral-admin/src/containers/Configure/StreamSettings.js @@ -32,6 +32,11 @@ const updateInfoBoxEnable = (updateSettings, infoBox) => () => { updateSettings({infoBoxEnable}); }; +const updatePremodLinksEnable = (updateSettings, premodLinks) => () => { + const premodLinksEnable = !premodLinks; + updateSettings({premodLinksEnable}); +}; + const updateInfoBoxContent = (updateSettings) => (event) => { const infoBoxContent = event.target.value; updateSettings({infoBoxContent}); @@ -92,6 +97,19 @@ const StreamSettings = ({updateSettings, settingsError, settings, errors}) => {

+ +
+ +
+
+ {lang.t('configure.enable-premod-links')} +

+ {lang.t('configure.enable-premod-links-text')} +

+
+
{ const links = linkify.getMatches(props.comment.body); + console.log('Links', links); const actionSummaries = props.comment.action_summaries; return (
  • { } // If the comment contains a link. - if (settings.premodLinksEnable && /\S+\.\S+/.exec(comment.body)) { + if (settings.premodLinksEnable && linkify.test(comment.body)) { return ActionsService.insertUserAction({ item_id: comment.id, item_type: 'COMMENTS', diff --git a/package.json b/package.json index 740063dd1..6f0fd24c1 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "inquirer": "^3.0.1", "jsonwebtoken": "^7.1.9", "kue": "^0.11.5", + "linkify-it": "^2.0.3", "lodash": "^4.16.6", "metascraper": "^1.0.6", "minimist": "^1.2.0",