From 95675461c874dcda57f786d5180df3bbed4adb8c Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 28 Feb 2019 14:37:43 +0000 Subject: [PATCH 01/25] js-sdk rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84d5632023..451e4529ea 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.13.1", "lolex": "2.3.2", - "matrix-js-sdk": "1.0.0", + "matrix-js-sdk": "1.0.1-rc.1", "optimist": "^0.6.1", "pako": "^1.0.5", "prop-types": "^15.5.8", From 89ad006d2dd129f7b250548c2d43c6a0ddd1d7c5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 28 Feb 2019 14:43:35 +0000 Subject: [PATCH 02/25] Prepare changelog for v1.0.2-rc.1 --- CHANGELOG.md | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e2d021254..ac8327f9c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,139 @@ +Changes in [1.0.2-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.1) (2019-02-28) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.1...v1.0.2-rc.1) + + * Remove unnecessary ref from Stickerpicker + [\#2718](https://github.com/matrix-org/matrix-react-sdk/pull/2718) + * Update from Weblate + [\#2720](https://github.com/matrix-org/matrix-react-sdk/pull/2720) + * Update from Weblate. + [\#2715](https://github.com/matrix-org/matrix-react-sdk/pull/2715) + * Show nearest lower badge, e.g show Mod for 51... etc + [\#2709](https://github.com/matrix-org/matrix-react-sdk/pull/2709) + * Send Field label pointer events to input + [\#2714](https://github.com/matrix-org/matrix-react-sdk/pull/2714) + * move canSendMessages into state so that it will re-render the composer + [\#2710](https://github.com/matrix-org/matrix-react-sdk/pull/2710) + * Use a global WatchManager for settings + [\#2705](https://github.com/matrix-org/matrix-react-sdk/pull/2705) + * Move non-feather icons out of feather dir + [\#2706](https://github.com/matrix-org/matrix-react-sdk/pull/2706) + * Fix backup button in logout dialog + [\#2713](https://github.com/matrix-org/matrix-react-sdk/pull/2713) + * Keep registration spinner inside the auth modal + [\#2712](https://github.com/matrix-org/matrix-react-sdk/pull/2712) + * Try to clarify that "Show read receipts" is just for visibility + [\#2707](https://github.com/matrix-org/matrix-react-sdk/pull/2707) + * Make sure direct chat invites are treated as invites + [\#2711](https://github.com/matrix-org/matrix-react-sdk/pull/2711) + * Report validity state of all registration fields on any change + [\#2672](https://github.com/matrix-org/matrix-react-sdk/pull/2672) + * Export the defaults for SdkConfig + [\#2687](https://github.com/matrix-org/matrix-react-sdk/pull/2687) + * Change the room list algo to eagerly delete and carefully insert + [\#2701](https://github.com/matrix-org/matrix-react-sdk/pull/2701) + * Improve permalink performance + [\#2671](https://github.com/matrix-org/matrix-react-sdk/pull/2671) + * Normalise room list font weight, bold unreads + [\#2702](https://github.com/matrix-org/matrix-react-sdk/pull/2702) + * Settings button in Room Context Menu + [\#2692](https://github.com/matrix-org/matrix-react-sdk/pull/2692) + * add roomnick SlashCommand + [\#2689](https://github.com/matrix-org/matrix-react-sdk/pull/2689) + * replace text Inputs in Devtools with Field bcuz prettier + [\#2697](https://github.com/matrix-org/matrix-react-sdk/pull/2697) + * Maintenance: Clean up some stuff around settings + [\#2685](https://github.com/matrix-org/matrix-react-sdk/pull/2685) + * Support the old room sorting algorithm and SettingsStore watchers + [\#2686](https://github.com/matrix-org/matrix-react-sdk/pull/2686) + * pin highlight.js as they seem to have broken something in 9.15.2 + [\#2703](https://github.com/matrix-org/matrix-react-sdk/pull/2703) + * Fix NPE relating to toggling notifications + [\#2699](https://github.com/matrix-org/matrix-react-sdk/pull/2699) + * Only set e2e info callback if the event is encrypted + [\#2684](https://github.com/matrix-org/matrix-react-sdk/pull/2684) + * Revert "Add some logging for riot-web#7838" + [\#2700](https://github.com/matrix-org/matrix-react-sdk/pull/2700) + * Add abilities to clear Filter room members input + [\#2698](https://github.com/matrix-org/matrix-react-sdk/pull/2698) + * make ViewSource less awkward + [\#2696](https://github.com/matrix-org/matrix-react-sdk/pull/2696) + * Fix share community for guests + [\#2695](https://github.com/matrix-org/matrix-react-sdk/pull/2695) + * Fix z ordering of the overflow tile + [\#2694](https://github.com/matrix-org/matrix-react-sdk/pull/2694) + * Toggle Search using Room Header button + [\#2693](https://github.com/matrix-org/matrix-react-sdk/pull/2693) + * view user on click typing tile + [\#2691](https://github.com/matrix-org/matrix-react-sdk/pull/2691) + * Change Share Message to Share Permalink if !m.room.message||redacted + [\#2690](https://github.com/matrix-org/matrix-react-sdk/pull/2690) + * Allow configuration of whether closing window closes or minimizes to tray + [\#2688](https://github.com/matrix-org/matrix-react-sdk/pull/2688) + * Remove duplicated conversion from `enableRichText` + [\#2682](https://github.com/matrix-org/matrix-react-sdk/pull/2682) + * Use correct initial phase for server type + [\#2683](https://github.com/matrix-org/matrix-react-sdk/pull/2683) + * Fix AliasSettings and RelatedGroups UX + [\#2679](https://github.com/matrix-org/matrix-react-sdk/pull/2679) + * Add `onClick` to Markdown buttons + [\#2677](https://github.com/matrix-org/matrix-react-sdk/pull/2677) + * Fix toggle for email notifications + [\#2678](https://github.com/matrix-org/matrix-react-sdk/pull/2678) + * Fix categorization of favourites and new rooms + [\#2681](https://github.com/matrix-org/matrix-react-sdk/pull/2681) + * Skip server details on registration with a default HS + [\#2675](https://github.com/matrix-org/matrix-react-sdk/pull/2675) + * Clarify what the username error refers to + [\#2673](https://github.com/matrix-org/matrix-react-sdk/pull/2673) + * RoomDirectory Dropdown should use roomDirectory.servers + [\#2680](https://github.com/matrix-org/matrix-react-sdk/pull/2680) + * Fix favourites losing rooms and sorting weirdly + [\#2674](https://github.com/matrix-org/matrix-react-sdk/pull/2674) + * "Breadcrumb" room sorting algorithm + [\#2634](https://github.com/matrix-org/matrix-react-sdk/pull/2634) + * Bring back user view + [\#2666](https://github.com/matrix-org/matrix-react-sdk/pull/2666) + * Restores support for `default_server_name` which discovers URLs via `.well- + known` + [\#2669](https://github.com/matrix-org/matrix-react-sdk/pull/2669) + * Remove unreferenced images + [\#2670](https://github.com/matrix-org/matrix-react-sdk/pull/2670) + * Only show the first line of each commit in changelog dialog + [\#2667](https://github.com/matrix-org/matrix-react-sdk/pull/2667) + * Cache-bust languages.json with file-loader + [\#2658](https://github.com/matrix-org/matrix-react-sdk/pull/2658) + * Fix off by one error for username colors + [\#2664](https://github.com/matrix-org/matrix-react-sdk/pull/2664) + * Set event-sending-color in dark theme + [\#2665](https://github.com/matrix-org/matrix-react-sdk/pull/2665) + * Allow captchas on Riot desktop builds + [\#2663](https://github.com/matrix-org/matrix-react-sdk/pull/2663) + * Show link to login even during UI auth + [\#2661](https://github.com/matrix-org/matrix-react-sdk/pull/2661) + * Dark theme follow ups round 2 + [\#2659](https://github.com/matrix-org/matrix-react-sdk/pull/2659) + * Rename default theme to light theme + [\#2662](https://github.com/matrix-org/matrix-react-sdk/pull/2662) + * make mx_SenderProfile inline-block, reduces clickable area around usernames + [\#2653](https://github.com/matrix-org/matrix-react-sdk/pull/2653) + * Add a bit of safety around reading events for room settings + [\#2648](https://github.com/matrix-org/matrix-react-sdk/pull/2648) + * Update dark theme bg-color to show hover effect on messages + [\#2654](https://github.com/matrix-org/matrix-react-sdk/pull/2654) + * Make pre use the same text color as code + [\#2655](https://github.com/matrix-org/matrix-react-sdk/pull/2655) + * Bring back the lowered opacity for offline/unavailable avatars. + [\#2649](https://github.com/matrix-org/matrix-react-sdk/pull/2649) + * Set h3-color in dark theme + [\#2656](https://github.com/matrix-org/matrix-react-sdk/pull/2656) + * Fix typo "Scisors" -> "Scissors" + [\#2652](https://github.com/matrix-org/matrix-react-sdk/pull/2652) + * highlight e2e icon on event when hovering whole event + [\#2647](https://github.com/matrix-org/matrix-react-sdk/pull/2647) + * Skinnified more icons + [\#2633](https://github.com/matrix-org/matrix-react-sdk/pull/2633) + Changes in [1.0.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.1) (2019-02-15) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.0...v1.0.1) From 52a2fe1c9c17f78d82e7385d05af89f2e4953e78 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 28 Feb 2019 14:43:36 +0000 Subject: [PATCH 03/25] v1.0.2-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 451e4529ea..1917060005 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.1", + "version": "1.0.2-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 63c6f600bf4f46c2aaa867d5fd47e99dd70fbd24 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 11:30:50 +0000 Subject: [PATCH 04/25] Use webpack alias to resolve the languages file Hopefully this will end up simpler than having to figure out in riot-web what the relative path is from react-sdk's src/languageHandler.js to riot-web's webapp directory. --- scripts/travis/build.sh | 2 +- src/languageHandler.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index df192d70b2..a353e38a06 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -23,5 +23,5 @@ ln -s "$REACT_SDK_DIR/node_modules/matrix-js-sdk" node_modules/matrix-js-sdk rm -r node_modules/matrix-react-sdk ln -s "$REACT_SDK_DIR" node_modules/matrix-react-sdk -RIOT_LANGUAGES_FILE="../riot-web/webapp/i18n/languages.json" npm run build +npm run build popd diff --git a/src/languageHandler.js b/src/languageHandler.js index 7c1a47fed9..bc2bd429b5 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -338,8 +338,8 @@ export function getCurrentLanguage() { function getLangsJson() { return new Promise((resolve, reject) => { - // LANGUAGES_FILE is a webpack compile-time define, see webpack config - const url = (typeof LANGUAGES_FILE === "string") ? require(LANGUAGES_FILE) : (i18nFolder + 'languages.json'); + // Webapp is a webpack resolve alias pointing to the output directory, see webpack config + const url = require('Webapp/i18n/languages.json'); request( { method: "GET", url }, (err, response, body) => { From 53aceaa41292defb9e61760b8e59f1aa865b0448 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 11:44:44 +0000 Subject: [PATCH 05/25] Add fallback for languages file So we're not completely dependent on the alias being set --- src/languageHandler.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index bc2bd429b5..9f08acdd32 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -338,8 +338,13 @@ export function getCurrentLanguage() { function getLangsJson() { return new Promise((resolve, reject) => { - // Webapp is a webpack resolve alias pointing to the output directory, see webpack config - const url = require('Webapp/i18n/languages.json'); + let url; + try { + // Webapp is a webpack resolve alias pointing to the output directory, see webpack config + url; = require('Webapp/i18n/languages.json'); + } catch (e) { + url = i18nFolder + 'languages.json'; + } request( { method: "GET", url }, (err, response, body) => { From f2328904cdafb99d1d5039f0dcb3b87823137a7e Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 11:48:48 +0000 Subject: [PATCH 06/25] stray semicolon --- src/languageHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index 9f08acdd32..cee3822a50 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -341,7 +341,7 @@ function getLangsJson() { let url; try { // Webapp is a webpack resolve alias pointing to the output directory, see webpack config - url; = require('Webapp/i18n/languages.json'); + url = require('Webapp/i18n/languages.json'); } catch (e) { url = i18nFolder + 'languages.json'; } From 4f84311bde1c6a4a250c37a995d452107475c64b Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 12:03:04 +0000 Subject: [PATCH 07/25] Use $webapp rather than Webapp --- src/languageHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languageHandler.js b/src/languageHandler.js index cee3822a50..854ac079bc 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -340,8 +340,8 @@ function getLangsJson() { return new Promise((resolve, reject) => { let url; try { - // Webapp is a webpack resolve alias pointing to the output directory, see webpack config - url = require('Webapp/i18n/languages.json'); + // $webapp is a webpack resolve alias pointing to the output directory, see webpack config + url = require('$webapp/i18n/languages.json'); } catch (e) { url = i18nFolder + 'languages.json'; } From e8213bc5c3658399fd12d0f67ba1fd9a4cec0881 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 12:17:25 +0000 Subject: [PATCH 08/25] Prepare changelog for v1.0.2-rc.2 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac8327f9c6..38682e3efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +Changes in [1.0.2-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.2) (2019-03-01) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.1...v1.0.2-rc.2) + + * Use webpack alias to resolve the languages file + [\#2730](https://github.com/matrix-org/matrix-react-sdk/pull/2730) + Changes in [1.0.2-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.1) (2019-02-28) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.1...v1.0.2-rc.1) From 9d2ef8a3cdabc567f9b6fffcbd70ce7cadb7c8f5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 12:17:26 +0000 Subject: [PATCH 09/25] v1.0.2-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1917060005..282bcc73c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.2-rc.1", + "version": "1.0.2-rc.2", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 738bc4d2d5449283b4ad3c8029c58aba66496ddc Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 17:36:10 +0000 Subject: [PATCH 10/25] Prepare changelog for v1.0.2-rc.3 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38682e3efb..9e0316a1ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [1.0.2-rc.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.3) (2019-03-01) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.2...v1.0.2-rc.3) + + * Misc room list improvements & invite fix + [\#2722](https://github.com/matrix-org/matrix-react-sdk/pull/2722) + * Move complex part of room sorting to a dedicated function + [\#2716](https://github.com/matrix-org/matrix-react-sdk/pull/2716) + Changes in [1.0.2-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.2) (2019-03-01) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.1...v1.0.2-rc.2) From 133dfe0807e13625554c2608c5f14aef8a21c283 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 1 Mar 2019 17:36:10 +0000 Subject: [PATCH 11/25] v1.0.2-rc.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 282bcc73c1..672db8d439 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.2-rc.2", + "version": "1.0.2-rc.3", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From d888445ec72c858178f42a81068864e3b863e8c5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 16:12:02 +0000 Subject: [PATCH 12/25] Support linking to hosting providers From link in app config --- res/css/structures/_GroupView.scss | 4 +++ res/css/views/context_menus/_TopLeftMenu.scss | 28 +++++++++++++-- res/css/views/settings/_ProfileSettings.scss | 8 +++++ src/components/structures/GroupView.js | 19 ++++++++++ .../structures/TopLeftMenuButton.js | 23 ++++++------ .../views/context_menus/TopLeftMenu.js | 36 ++++++++++++++++--- .../views/settings/ProfileSettings.js | 23 +++++++++++- src/i18n/strings/en_EN.json | 2 ++ 8 files changed, 125 insertions(+), 18 deletions(-) diff --git a/res/css/structures/_GroupView.scss b/res/css/structures/_GroupView.scss index bfbc92ca05..4f33617344 100644 --- a/res/css/structures/_GroupView.scss +++ b/res/css/structures/_GroupView.scss @@ -62,6 +62,10 @@ limitations under the License. mask-image: url('$(res)/img/icons-share.svg'); } +.mx_GroupView_hostingSignup img { + margin-left: 5px; +} + .mx_GroupView_editable { border-bottom: 1px solid $strong-input-border-color ! important; min-width: 150px; diff --git a/res/css/views/context_menus/_TopLeftMenu.scss b/res/css/views/context_menus/_TopLeftMenu.scss index c15d12eb6a..113da004b8 100644 --- a/res/css/views/context_menus/_TopLeftMenu.scss +++ b/res/css/views/context_menus/_TopLeftMenu.scss @@ -15,17 +15,39 @@ limitations under the License. */ .mx_TopLeftMenu { - min-width: 180px; + min-width: 210px; border-radius: 4px; + .mx_TopLeftMenu_greyedText { + font-size: 12px; + opacity: 0.5; + } + + .mx_TopLeftMenu_upgradeLink { + font-size: 12px; + + img { + margin-left: 5px; + } + } + .mx_TopLeftMenu_section:not(:last-child) { border-bottom: 1px solid $menu-border-color; } - .mx_TopLeftMenu_section { - list-style: none; + .mx_TopLeftMenu_section_noIcon { + margin: 5px 0; + padding: 5px 20px 5px 15px; + + div:not(:first-child) { + margin-top: 5px; + } + } + + .mx_TopLeftMenu_section_withIcon { margin: 5px 0; padding: 0; + list-style: none; li.mx_TopLeftMenu_icon_home::after { mask-image: url('$(res)/img/feather-customised/home.svg'); diff --git a/res/css/views/settings/_ProfileSettings.scss b/res/css/views/settings/_ProfileSettings.scss index 5d85f80bfe..b2e449ac34 100644 --- a/res/css/views/settings/_ProfileSettings.scss +++ b/res/css/views/settings/_ProfileSettings.scss @@ -35,6 +35,14 @@ limitations under the License. margin-top: 0; } +.mx_ProfileSettings_hostingSignup { + margin-left: 20px; + + img { + margin-left: 5px; + } +} + .mx_ProfileSettings_avatar { width: 88px; height: 88px; diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index b80f49d051..dbca0fe5d1 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -21,6 +21,7 @@ import Promise from 'bluebird'; import MatrixClientPeg from '../../MatrixClientPeg'; import sdk from '../../index'; import dis from '../../dispatcher'; +import SdkConfig from '../../SdkConfig'; import { sanitizedHtmlNode } from '../../HtmlUtils'; import { _t, _td } from '../../languageHandler'; import AccessibleButton from '../views/elements/AccessibleButton'; @@ -816,6 +817,23 @@ export default React.createClass({ }); const header = this.state.editing ?

{ _t('Community Settings') }

:
; + + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup =
+ {_t( + "Want more than a community? Get your own server", {}, + { + a: sub => {sub}, + }, + )} + + + +
+ } + const changeDelayWarning = this.state.editing && this.state.isUserPrivileged ?
{ _t( @@ -830,6 +848,7 @@ export default React.createClass({
:
; return
{ header } + { hostingSignup } { changeDelayWarning } { this._getJoinableNode() } { this._getLongDescriptionNode() } diff --git a/src/components/structures/TopLeftMenuButton.js b/src/components/structures/TopLeftMenuButton.js index 4e3f609c07..b68d3a95a0 100644 --- a/src/components/structures/TopLeftMenuButton.js +++ b/src/components/structures/TopLeftMenuButton.js @@ -68,17 +68,18 @@ export default class TopLeftMenuButton extends React.Component { } } - render() { - const fallbackUserId = MatrixClientPeg.get().getUserId(); - const profileInfo = this.state.profileInfo; - let name; + _getDisplayName() { if (MatrixClientPeg.get().isGuest()) { - name = _t("Guest"); - } else if (profileInfo) { - name = profileInfo.name; + return _t("Guest"); + } else if (this.state.profileInfo) { + return this.state.profileInfo.name; } else { - name = fallbackUserId; + return MatrixClientPeg.get().getUserId(); } + } + + render() { + const name = this._getDisplayName(); let nameElement; if (!this.props.collapsed) { nameElement =
@@ -89,9 +90,9 @@ export default class TopLeftMenuButton extends React.Component { return ( { this.setState({ menuDisplayed: false }); }, diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index e3d8ef8d91..a10c577f13 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -15,6 +15,7 @@ limitations under the License. */ import React from 'react'; +import PropTypes from 'prop-types'; import dis from '../../../dispatcher'; import { _t } from '../../../languageHandler'; import LogoutDialog from "../dialogs/LogoutDialog"; @@ -23,6 +24,12 @@ import SdkConfig from '../../../SdkConfig'; import MatrixClientPeg from '../../../MatrixClientPeg'; export class TopLeftMenu extends React.Component { + static propTypes = { + displayName: PropTypes.string.isRequired, + userId: PropTypes.string.isRequired, + onFinished: PropTypes.func, + }; + constructor() { super(); this.viewHomePage = this.viewHomePage.bind(this); @@ -46,27 +53,48 @@ export class TopLeftMenu extends React.Component { render() { const isGuest = MatrixClientPeg.get().isGuest(); + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup =
+ {_t( + "Upgrade to your own domain", {}, + { + a: sub => {sub}, + }, + )} + + + +
+ } + let homePageSection = null; if (this.hasHomePage()) { - homePageSection =
    + homePageSection =
    • {_t("Home")}
    ; } let signInOutSection; if (isGuest) { - signInOutSection =
      + signInOutSection =
      • {_t("Sign in")}
      ; } else { - signInOutSection =
        + signInOutSection =
        • {_t("Sign out")}
        ; } return
        +
        +
        {this.props.displayName}
        +
        {this.props.userId}
        + {hostingSignup} +
        {homePageSection} -
          +
          • {_t("Settings")}
          {signInOutSection} diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 649128e4f3..0764fc0d50 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -20,6 +20,8 @@ import MatrixClientPeg from "../../../MatrixClientPeg"; import Field from "../elements/Field"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from 'classnames'; +import {User} from "matrix-js-sdk"; +import SdkConfig from '../../../SdkConfig'; export default class ProfileSettings extends React.Component { constructor() { @@ -129,13 +131,32 @@ export default class ProfileSettings extends React.Component {
        ); + const hostingSignupLink = SdkConfig.get().hosting_signup_link; + let hostingSignup = null; + if (hostingSignupLink) { + hostingSignup = + {_t( + "Upgrade to your own domain", {}, + { + a: sub => {sub}, + }, + )} + + + + + } + return (
        -

        {this.state.userId}

        +

        + {this.state.userId} + {hostingSignup} +

        diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 696bd8152c..99ffd71c84 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -500,6 +500,7 @@ "Phone Number": "Phone Number", "Profile picture": "Profile picture", "Upload profile picture": "Upload profile picture", + "Upgrade to your own domain": "Upgrade to your own domain", "Display Name": "Display Name", "Save": "Save", "Flair": "Flair", @@ -1314,6 +1315,7 @@ "Leave %(groupName)s?": "Leave %(groupName)s?", "Unable to leave community": "Unable to leave community", "Community Settings": "Community Settings", + "Want more than a community? Get your own server": "Want more than a community? Get your own server", "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.": "Changes made to your community name and avatar might not be seen by other users for up to 30 minutes.", "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.": "These rooms are displayed to community members on the community page. Community members can join the rooms by clicking on them.", "Featured Rooms:": "Featured Rooms:", From dc0eff38fdf8e42df3b0c67fd70d54e2a49c2f63 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 16:20:18 +0000 Subject: [PATCH 13/25] Lint --- src/components/structures/GroupView.js | 2 +- src/components/views/context_menus/TopLeftMenu.js | 2 +- src/components/views/settings/ProfileSettings.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index dbca0fe5d1..b5870e793d 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -831,7 +831,7 @@ export default React.createClass({ -
        +
        ; } const changeDelayWarning = this.state.editing && this.state.isUserPrivileged ? diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index a10c577f13..2a5481ff1c 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -66,7 +66,7 @@ export class TopLeftMenu extends React.Component { -
+
; } let homePageSection = null; diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 0764fc0d50..9f4b663bcb 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -144,7 +144,7 @@ export default class ProfileSettings extends React.Component { - + ; } return ( From 7aa451067e703050f18b54ea8429b0d519b98b32 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 16:42:22 +0000 Subject: [PATCH 14/25] Add utm_campaign to the hosting links According to where in the app the link was clicked --- src/components/structures/GroupView.js | 4 +- .../views/context_menus/TopLeftMenu.js | 3 +- .../views/settings/ProfileSettings.js | 4 +- src/utils/HostingLink.js | 37 +++++++++++++++++++ 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/utils/HostingLink.js diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index b5870e793d..6f1aeaf624 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -21,7 +21,7 @@ import Promise from 'bluebird'; import MatrixClientPeg from '../../MatrixClientPeg'; import sdk from '../../index'; import dis from '../../dispatcher'; -import SdkConfig from '../../SdkConfig'; +import { getHostingLink } from '../../utils/HostingLink'; import { sanitizedHtmlNode } from '../../HtmlUtils'; import { _t, _td } from '../../languageHandler'; import AccessibleButton from '../views/elements/AccessibleButton'; @@ -818,7 +818,7 @@ export default React.createClass({ const header = this.state.editing ?

{ _t('Community Settings') }

:
; - const hostingSignupLink = SdkConfig.get().hosting_signup_link; + const hostingSignupLink = getHostingLink('community-settings'); let hostingSignup = null; if (hostingSignupLink) { hostingSignup =
diff --git a/src/components/views/context_menus/TopLeftMenu.js b/src/components/views/context_menus/TopLeftMenu.js index 2a5481ff1c..278c879404 100644 --- a/src/components/views/context_menus/TopLeftMenu.js +++ b/src/components/views/context_menus/TopLeftMenu.js @@ -21,6 +21,7 @@ import { _t } from '../../../languageHandler'; import LogoutDialog from "../dialogs/LogoutDialog"; import Modal from "../../../Modal"; import SdkConfig from '../../../SdkConfig'; +import { getHostingLink } from '../../../utils/HostingLink'; import MatrixClientPeg from '../../../MatrixClientPeg'; export class TopLeftMenu extends React.Component { @@ -53,7 +54,7 @@ export class TopLeftMenu extends React.Component { render() { const isGuest = MatrixClientPeg.get().isGuest(); - const hostingSignupLink = SdkConfig.get().hosting_signup_link; + const hostingSignupLink = getHostingLink('user-context-menu'); let hostingSignup = null; if (hostingSignupLink) { hostingSignup =
diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 9f4b663bcb..7765978931 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -21,7 +21,7 @@ import Field from "../elements/Field"; import AccessibleButton from "../elements/AccessibleButton"; import classNames from 'classnames'; import {User} from "matrix-js-sdk"; -import SdkConfig from '../../../SdkConfig'; +import { getHostingLink } from '../../../utils/HostingLink'; export default class ProfileSettings extends React.Component { constructor() { @@ -131,7 +131,7 @@ export default class ProfileSettings extends React.Component {
); - const hostingSignupLink = SdkConfig.get().hosting_signup_link; + const hostingSignupLink = getHostingLink('user-settings'); let hostingSignup = null; if (hostingSignupLink) { hostingSignup = diff --git a/src/utils/HostingLink.js b/src/utils/HostingLink.js new file mode 100644 index 0000000000..7efd8b6f96 --- /dev/null +++ b/src/utils/HostingLink.js @@ -0,0 +1,37 @@ +/* +Copyright 2019 New Vector Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import url from 'url'; +import qs from 'qs'; + +import SdkConfig from '../SdkConfig'; + +export function getHostingLink(campaign) { + const hostingLink = SdkConfig.get().hosting_signup_link; + if (!hostingLink) return null; + if (!campaign) return hostingLink; + + try { + const hostingUrl = url.parse(hostingLink); + const params = qs.parse(hostingUrl.query); + params.utm_campaign = campaign; + hostingUrl.search = undefined; + hostingUrl.query = params; + return hostingUrl.format(); + } catch (e) { + return hostingLink; + } +} From b6579131b856de9d8ba1b17b28ec993cb4416449 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 16:49:12 +0000 Subject: [PATCH 15/25] Add the image --- res/img/external-link.svg | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 res/img/external-link.svg diff --git a/res/img/external-link.svg b/res/img/external-link.svg new file mode 100644 index 0000000000..459e790fe3 --- /dev/null +++ b/res/img/external-link.svg @@ -0,0 +1,5 @@ + + + + + From cd4e22b3fd9580b972315583338da1eae7b9626f Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 4 Mar 2019 14:35:41 +0000 Subject: [PATCH 16/25] Fix media device selectors not updating Missed a setState Fixes https://github.com/vector-im/riot-web/issues/9036 --- .../views/settings/tabs/user/VoiceUserSettingsTab.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js index 31791708e0..84d70a48d4 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.js @@ -76,14 +76,23 @@ export default class VoiceUserSettingsTab extends React.Component { _setAudioOutput = (e) => { CallMediaHandler.setAudioOutput(e.target.value); + this.setState({ + activeAudioOutput: e.target.value, + }); }; _setAudioInput = (e) => { CallMediaHandler.setAudioInput(e.target.value); + this.setState({ + activeAudioInput: e.target.value, + }); }; _setVideoInput = (e) => { CallMediaHandler.setVideoInput(e.target.value); + this.setState({ + activeVideoInput: e.target.value, + }); }; _changeWebRtcMethod = (p2p) => { From b9bd8206c1ae87191a1c3c47af15914c9e9b67f1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 2 Mar 2019 10:59:25 -0700 Subject: [PATCH 17/25] Patch users not existing when opening settings Fixes https://github.com/vector-im/riot-web/issues/9022 --- src/components/views/settings/ProfileSettings.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/views/settings/ProfileSettings.js b/src/components/views/settings/ProfileSettings.js index 7765978931..77ffef535b 100644 --- a/src/components/views/settings/ProfileSettings.js +++ b/src/components/views/settings/ProfileSettings.js @@ -28,7 +28,15 @@ export default class ProfileSettings extends React.Component { super(); const client = MatrixClientPeg.get(); - const user = client.getUser(client.getUserId()); + let user = client.getUser(client.getUserId()); + if (!user) { + // XXX: We shouldn't have to do this. + // There seems to be a condition where the User object won't exist until a room + // exists on the account. To work around this, we'll just create a temporary User + // and use that. + console.warn("User object not found - creating one for ProfileSettings"); + user = new User(client.getUserId()); + } let avatarUrl = user.avatarUrl; if (avatarUrl) avatarUrl = client.mxcUrlToHttp(avatarUrl, 96, 96, 'crop', false); this.state = { From 647260b1ab6787022fc7308501a032da4f7c837b Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 19:07:22 +0000 Subject: [PATCH 18/25] js-sdk rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 672db8d439..7bdabd0f6f 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.13.1", "lolex": "2.3.2", - "matrix-js-sdk": "1.0.1-rc.1", + "matrix-js-sdk": "1.0.1-rc.2", "optimist": "^0.6.1", "pako": "^1.0.5", "prop-types": "^15.5.8", From 2b2cb1504e3b08058fec9f1b0b94343193d8a801 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 19:17:51 +0000 Subject: [PATCH 19/25] Prepare changelog for v1.0.2-rc.4 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0316a1ad..7570cb3253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +Changes in [1.0.2-rc.4](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.4) (2019-03-05) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.3...v1.0.2-rc.4) + + * Patch users not existing when opening settings + [\#2752](https://github.com/matrix-org/matrix-react-sdk/pull/2752) + * Fix media device selectors not updating + [\#2751](https://github.com/matrix-org/matrix-react-sdk/pull/2751) + * Support linking to hosting providers + [\#2750](https://github.com/matrix-org/matrix-react-sdk/pull/2750) + Changes in [1.0.2-rc.3](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.3) (2019-03-01) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.2...v1.0.2-rc.3) From a9402beb8f0c978578d8ed590e73ab87a7b23a3d Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 5 Mar 2019 19:17:52 +0000 Subject: [PATCH 20/25] v1.0.2-rc.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7bdabd0f6f..a5e116b8ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.2-rc.3", + "version": "1.0.2-rc.4", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From 610a6d935a6c92cded5a42cb29f57d541ea98b85 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 10:22:19 +0000 Subject: [PATCH 21/25] Only show hosting link if domain == matrix.org Fixes https://github.com/vector-im/riot-web/issues/9059 --- src/utils/HostingLink.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/HostingLink.js b/src/utils/HostingLink.js index 7efd8b6f96..ff1ac3d063 100644 --- a/src/utils/HostingLink.js +++ b/src/utils/HostingLink.js @@ -18,12 +18,15 @@ import url from 'url'; import qs from 'qs'; import SdkConfig from '../SdkConfig'; +import MatrixClientPeg from '../MatrixClientPeg'; export function getHostingLink(campaign) { const hostingLink = SdkConfig.get().hosting_signup_link; if (!hostingLink) return null; if (!campaign) return hostingLink; + if (MatrixClientPeg.get().getDomain() !== 'matrix.org') return null; + try { const hostingUrl = url.parse(hostingLink); const params = qs.parse(hostingUrl.query); From 23f22617ed73e6097a8c236566184bc45ff628a6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 10:32:30 +0000 Subject: [PATCH 22/25] Only show hosting link if group admin --- src/components/structures/GroupView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index 6f1aeaf624..dcbe212267 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -820,7 +820,7 @@ export default React.createClass({ const hostingSignupLink = getHostingLink('community-settings'); let hostingSignup = null; - if (hostingSignupLink) { + if (hostingSignupLink && this.state.isUserPrivileged) { hostingSignup =
{_t( "Want more than a community? Get your own server", {}, From d83bce15a6189ea04401ac524579940d3474c502 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 11:19:06 +0000 Subject: [PATCH 23/25] releaseed js-sdk --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5e116b8ee..a1d2a99d13 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "linkifyjs": "^2.1.6", "lodash": "^4.13.1", "lolex": "2.3.2", - "matrix-js-sdk": "1.0.1-rc.2", + "matrix-js-sdk": "1.0.1", "optimist": "^0.6.1", "pako": "^1.0.5", "prop-types": "^15.5.8", From 4a785263e29771b8a0c672014e3e7c533bd27626 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 11:26:41 +0000 Subject: [PATCH 24/25] Prepare changelog for v1.0.2 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7570cb3253..de71e5578e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +Changes in [1.0.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2) (2019-03-06) +=================================================================================================== +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.4...v1.0.2) + + * Only show hosting link if group admin + [\#2755](https://github.com/matrix-org/matrix-react-sdk/pull/2755) + * Only show hosting link if domain == matrix.org + [\#2754](https://github.com/matrix-org/matrix-react-sdk/pull/2754) + Changes in [1.0.2-rc.4](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v1.0.2-rc.4) (2019-03-05) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v1.0.2-rc.3...v1.0.2-rc.4) From ce1a9852333f846f422d881e6b99731f2f935422 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 6 Mar 2019 11:26:42 +0000 Subject: [PATCH 25/25] v1.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1d2a99d13..d911e41354 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "1.0.2-rc.4", + "version": "1.0.2", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {