From d15051a635633f95a6e058e1c8c565448ae4fa32 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 16 May 2018 15:49:23 +0100 Subject: [PATCH] Add policyLink configuration to piwik Also: - Make CookieBar ES6 class - Alter phrasing on CookieBar - Conditionaly display longer "...(See our ++cookie and privacy policies++)." if policy link is configured. --- src/components/structures/LoggedInView.js | 3 +- src/components/views/globals/CookieBar.js | 55 ++++++++++++----------- src/i18n/strings/en_EN.json | 5 ++- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index abb2eb92aa..c1d30391ab 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -355,7 +355,8 @@ const LoggedInView = React.createClass({ let topBar; const isGuest = this.props.matrixClient.isGuest(); if (this.props.showCookieBar) { - topBar = ; + const policyUrl = this.props.config.piwik ? (this.props.config.piwik.policyUrl || null) : null; + topBar = ; } else if (this.props.hasNewVersion) { topBar = (sub) => - - { sub } - ; +export default class CookieBar extends React.Component { + static propTypes = { + policyUrl: PropTypes.string, + } -export default React.createClass({ - onAccept: function() { + constructor() { + super(); + } + + onAccept() { dis.dispatch({ action: 'accept_cookies', }); - }, + } - onReject: function() { + onReject() { dis.dispatch({ action: 'reject_cookies', }); - }, + } - render: function() { + render() { const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); const toolbarClasses = "mx_MatrixToolbar"; return (
Warning
- { _t( - "Help us improve Riot by sending usage data. " + - "This will use a cookie " + - "(see our cookie and " + - "privacy policies)", + { this.props.policyUrl ? _t( + "Help improve Riot by sending usage data? " + + "This will use a cookie. " + + "(See our cookie and privacy policies).", {}, { // XXX: We need to link to the page that explains our cookies - 'CookieLink': makeLink("https://riot.im/privacy"), - 'PrivacyLink': makeLink("https://riot.im/privacy"), + 'PolicyLink': (sub) => + { sub } + + , }, - ) } + ) : _t("Help improve Riot by sending usage data? This will use a cookie.") }
- { _t("Send usage data") } + { _t("Yes please") }
); - }, -}); + } +} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 70eccca6f1..239b45c32e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -634,8 +634,9 @@ "Something went wrong when trying to get your communities.": "Something went wrong when trying to get your communities.", "Display your community flair in rooms configured to show it.": "Display your community flair in rooms configured to show it.", "You're not currently a member of any communities.": "You're not currently a member of any communities.", - "Help us improve Riot by sending usage data. This will use a cookie (see our cookie and privacy policies)": "Help us improve Riot by sending usage data. This will use a cookie (see our cookie and privacy policies)", - "Send usage data": "Send usage data", + "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).", + "Help improve Riot by sending usage data? This will use a cookie.": "Help improve Riot by sending usage data? This will use a cookie.", + "Yes please": "Yes please", "You are not receiving desktop notifications": "You are not receiving desktop notifications", "Enable them now": "Enable them now", "What's New": "What's New",