From 17262ad80d4a7596c698f6c13caa2842903e36bc Mon Sep 17 00:00:00 2001 From: Pablo Saavedra Date: Mon, 8 May 2017 12:18:31 +0200 Subject: [PATCH 001/535] Added TextInputWithCheckbox dialog --- src/component-index.js | 2 + src/components/structures/MatrixChat.js | 15 ++- .../dialogs/TextInputWithCheckboxDialog.js | 108 ++++++++++++++++++ 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/components/views/dialogs/TextInputWithCheckboxDialog.js diff --git a/src/component-index.js b/src/component-index.js index d6873c6dfd..ed538a6fcb 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -99,6 +99,8 @@ import views$dialogs$SetDisplayNameDialog from './components/views/dialogs/SetDi views$dialogs$SetDisplayNameDialog && (module.exports.components['views.dialogs.SetDisplayNameDialog'] = views$dialogs$SetDisplayNameDialog); import views$dialogs$TextInputDialog from './components/views/dialogs/TextInputDialog'; views$dialogs$TextInputDialog && (module.exports.components['views.dialogs.TextInputDialog'] = views$dialogs$TextInputDialog); +import views$dialogs$TextInputWithCheckboxDialog from './components/views/dialogs/TextInputWithCheckboxDialog'; +views$dialogs$TextInputWithCheckboxDialog && (module.exports.components['views.dialogs.TextInputWithCheckboxDialog'] = views$dialogs$TextInputWithCheckboxDialog); import views$dialogs$UnknownDeviceDialog from './components/views/dialogs/UnknownDeviceDialog'; views$dialogs$UnknownDeviceDialog && (module.exports.components['views.dialogs.UnknownDeviceDialog'] = views$dialogs$UnknownDeviceDialog); import views$elements$AccessibleButton from './components/views/elements/AccessibleButton'; diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index b449ff3094..d87ca203ce 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -191,6 +191,10 @@ module.exports = React.createClass({ return this.props.config.default_is_url || "https://vector.im"; }, + getDefaultFederate() { + return this.props.config.default_federate && true; + }, + componentWillMount: function() { SdkConfig.put(this.props.config); @@ -501,15 +505,20 @@ module.exports = React.createClass({ //this._setPage(PageTypes.CreateRoom); //this.notifyNewScreen('new'); - var TextInputDialog = sdk.getComponent("dialogs.TextInputDialog"); - Modal.createDialog(TextInputDialog, { + var TextInputWithCheckboxDialog = sdk.getComponent("dialogs.TextInputWithCheckboxDialog"); + Modal.createDialog(TextInputWithCheckboxDialog, { title: "Create Room", description: "Room name (optional)", button: "Create Room", - onFinished: (should_create, name) => { + check: this.getDefaultFederate(), + checkLabel: "Federate room in domain " + MatrixClientPeg.get().getDomain(), + onFinished: (should_create, name, isFederate) => { if (should_create) { const createOpts = {}; if (name) createOpts.name = name; + if (isFederate) { + createOpts.creation_content = {"m.federate": isFederate} + } createRoom({createOpts}).done(); } } diff --git a/src/components/views/dialogs/TextInputWithCheckboxDialog.js b/src/components/views/dialogs/TextInputWithCheckboxDialog.js new file mode 100644 index 0000000000..916de16af5 --- /dev/null +++ b/src/components/views/dialogs/TextInputWithCheckboxDialog.js @@ -0,0 +1,108 @@ +/* +Copyright 2015, 2016 OpenMarket 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 React from 'react'; +import sdk from '../../../index'; + +export default React.createClass({ + displayName: 'TextInputWithCheckboxDialog', + propTypes: { + title: React.PropTypes.string, + description: React.PropTypes.oneOfType([ + React.PropTypes.element, + React.PropTypes.string, + ]), + value: React.PropTypes.string, + button: React.PropTypes.string, + focus: React.PropTypes.bool, + checkLabel: React.PropTypes.string, + check: React.PropTypes.bool, + onFinished: React.PropTypes.func.isRequired, + }, + + getDefaultProps: function() { + return { + title: "", + value: "", + description: "", + button: "OK", + focus: true, + checkLabel: "", + check: true, + }; + }, + + getInitialState: function() { + return { + isChecked: this.props.check, + }; + }, + + componentDidMount: function() { + if (this.props.focus) { + // Set the cursor at the end of the text input + this.refs.textinput.value = this.props.value; + } + }, + + onOk: function() { + this.props.onFinished(true, this.refs.textinput.value, this.state.isChecked); + }, + + onCancel: function() { + this.props.onFinished(false); + }, + + _onToggle: function(keyName, checkedValue, uncheckedValue, ev) { + console.log("Checkbox toggle: %s %s", keyName, ev.target.checked); + var state = {}; + state[keyName] = ev.target.checked ? checkedValue : uncheckedValue; + this.setState(state); + }, + + render: function() { + const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + return ( + +
+
+ +
+
+ +
+ +
+
+ + +
+
+ ); + }, +}); From c2034d53359abb67123177438304f49f06072f76 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 25 Jul 2017 15:56:16 +0100 Subject: [PATCH 002/535] Add user list to groups --- src/components/structures/LoggedInView.js | 2 + src/components/views/avatars/BaseAvatar.js | 6 +- .../views/groups/GroupMemberList.js | 146 ++++++++++++++++++ .../views/groups/GroupMemberTile.js | 68 ++++++++ src/components/views/rooms/MemberList.js | 9 +- .../views/rooms/SearchableEntityList.js | 4 +- src/i18n/strings/de_DE.json | 6 +- src/i18n/strings/el.json | 6 +- src/i18n/strings/en_EN.json | 6 +- src/i18n/strings/en_US.json | 6 +- src/i18n/strings/es.json | 6 +- src/i18n/strings/fr.json | 6 +- src/i18n/strings/hu.json | 6 +- src/i18n/strings/ko.json | 6 +- src/i18n/strings/nl.json | 6 +- src/i18n/strings/pt.json | 6 +- src/i18n/strings/pt_BR.json | 6 +- src/i18n/strings/ru.json | 6 +- src/i18n/strings/sv.json | 6 +- src/i18n/strings/th.json | 6 +- src/i18n/strings/tr.json | 6 +- src/i18n/strings/zh_Hans.json | 6 +- 22 files changed, 287 insertions(+), 44 deletions(-) create mode 100644 src/components/views/groups/GroupMemberList.js create mode 100644 src/components/views/groups/GroupMemberTile.js diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index a051af5d08..edc663547b 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -227,6 +227,7 @@ export default React.createClass({ const HomePage = sdk.getComponent('structures.HomePage'); const GroupView = sdk.getComponent('structures.GroupView'); const MyGroups = sdk.getComponent('structures.MyGroups'); + const GroupMemberList = sdk.getComponent('groups.GroupMemberList'); const MatrixToolbar = sdk.getComponent('globals.MatrixToolbar'); const NewVersionBar = sdk.getComponent('globals.NewVersionBar'); const UpdateCheckBar = sdk.getComponent('globals.UpdateCheckBar'); @@ -307,6 +308,7 @@ export default React.createClass({ page_element = ; + right_panel = ; break; } diff --git a/src/components/views/avatars/BaseAvatar.js b/src/components/views/avatars/BaseAvatar.js index a4443430f4..e88fc869fa 100644 --- a/src/components/views/avatars/BaseAvatar.js +++ b/src/components/views/avatars/BaseAvatar.js @@ -14,10 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - -var React = require('react'); -var AvatarLogic = require("../../../Avatar"); +import React from 'react'; +import AvatarLogic from '../../../Avatar'; import sdk from '../../../index'; import AccessibleButton from '../elements/AccessibleButton'; diff --git a/src/components/views/groups/GroupMemberList.js b/src/components/views/groups/GroupMemberList.js new file mode 100644 index 0000000000..48d49dc04b --- /dev/null +++ b/src/components/views/groups/GroupMemberList.js @@ -0,0 +1,146 @@ +/* +Copyright 2017 Vector Creations 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 React from 'react'; +import { _t } from '../../../languageHandler'; +import Promise from 'bluebird'; +import sdk from '../../../index'; +import GeminiScrollbar from 'react-gemini-scrollbar'; +import PropTypes from 'prop-types'; +import withMatrixClient from '../../../wrappers/withMatrixClient'; + +const INITIAL_LOAD_NUM_MEMBERS = 30; + +export default withMatrixClient(React.createClass({ + displayName: 'GroupMemberList', + + propTypes: { + matrixClient: PropTypes.object.isRequired, + groupId: PropTypes.string.isRequired, + }, + + getInitialState: function() { + return { + fetching: false, + members: null, + } + }, + + componentWillMount: function() { + this._unmounted = false; + this._fetchMembers(); + }, + + _fetchMembers: function() { + this.setState({fetching: true}); + this.props.matrixClient.getGroupUsers(this.props.groupId).then((result) => { + this.setState({ + members: result.chunk, + fetching: false, + }); + }).catch((e) => { + this.setState({fetching: false}); + console.error("Failed to get group member list: " + e); + }); + }, + + _createOverflowTile: function(overflowCount, totalCount) { + // For now we'll pretend this is any entity. It should probably be a separate tile. + const EntityTile = sdk.getComponent("rooms.EntityTile"); + const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); + const text = _t("and %(count)s others...", { count: overflowCount }); + return ( + + } name={text} presenceState="online" suppressOnHover={true} + onClick={this._showFullMemberList} /> + ); + }, + + _showFullMemberList: function() { + this.setState({ + truncateAt: -1 + }); + }, + + onSearchQueryChanged: function(ev) { + this.setState({ searchQuery: ev.target.value }); + }, + + makeGroupMemberTiles: function(query) { + const GroupMemberTile = sdk.getComponent("groups.GroupMemberTile"); + query = (query || "").toLowerCase(); + + const memberList = this.state.members.filter((m) => { + if (query) { + //const matchesName = m.name.toLowerCase().indexOf(query) !== -1; + const matchesId = m.user_id.toLowerCase().indexOf(query) !== -1; + + if (/*!matchesName &&*/ !matchesId) { + return false; + } + } + + return true; + }).map(function(m) { + return ( + + ); + }); + + memberList.sort((a, b) => { + // should put admins at the top: we don't yet have that info + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } + }); + + return memberList; + }, + + render: function() { + if (this.state.fetching) { + const Spinner = sdk.getComponent("elements.Spinner"); + return ; + } else if (this.state.members === null) { + return null; + } + + const inputBox = ( +
+ +
+ ); + + const TruncatedList = sdk.getComponent("elements.TruncatedList"); + return ( +
+ { inputBox } + + + {this.makeGroupMemberTiles(this.state.searchQuery)} + + +
+ ); + } +})); diff --git a/src/components/views/groups/GroupMemberTile.js b/src/components/views/groups/GroupMemberTile.js new file mode 100644 index 0000000000..1ef59fb1a6 --- /dev/null +++ b/src/components/views/groups/GroupMemberTile.js @@ -0,0 +1,68 @@ +/* +Copyright 2017 Vector Creations 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 React from 'react'; +import PropTypes from 'prop-types'; +import sdk from '../../../index'; +import dis from '../../../dispatcher'; +import { _t } from '../../../languageHandler'; +import withMatrixClient from '../../../wrappers/withMatrixClient'; +import Matrix from "matrix-js-sdk"; + +export default withMatrixClient(React.createClass({ + displayName: 'GroupMemberTile', + + propTypes: { + matrixClient: PropTypes.object, + member: PropTypes.shape({ + user_id: PropTypes.string.isRequired, + }).isRequired, + }, + + getInitialState: function() { + return {}; + }, + + onClick: function(e) { + const member = new Matrix.RoomMember(null, this.props.member.user_id); + dis.dispatch({ + action: 'view_user', + member: member, + }); + }, + + getPowerLabel: function() { + return _t("%(userName)s (power %(powerLevelNumber)s)", {userName: this.props.member.userId, powerLevelNumber: this.props.member.powerLevel}); + }, + + render: function() { + const BaseAvatar = sdk.getComponent('avatars.BaseAvatar'); + const EntityTile = sdk.getComponent('rooms.EntityTile'); + + const name = this.props.member.user_id; + + const av = ( + + ); + + return ( + + ); + } +})); diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 37a9bcd0cd..e5f4f08572 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -200,11 +201,9 @@ module.exports = React.createClass({ _createOverflowTile: function(overflowCount, totalCount) { // For now we'll pretend this is any entity. It should probably be a separate tile. - var EntityTile = sdk.getComponent("rooms.EntityTile"); - var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); - var text = (overflowCount > 1) - ? _t("and %(overflowCount)s others...", { overflowCount: overflowCount }) - : _t("and one other..."); + const EntityTile = sdk.getComponent("rooms.EntityTile"); + const BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); + const text = _t("and %(count)s others...", { count: overflowCount }); return ( diff --git a/src/components/views/rooms/SearchableEntityList.js b/src/components/views/rooms/SearchableEntityList.js index 4412fc539f..45ad2c6b9e 100644 --- a/src/components/views/rooms/SearchableEntityList.js +++ b/src/components/views/rooms/SearchableEntityList.js @@ -117,9 +117,7 @@ var SearchableEntityList = React.createClass({ _createOverflowEntity: function(overflowCount, totalCount) { var EntityTile = sdk.getComponent("rooms.EntityTile"); var BaseAvatar = sdk.getComponent("avatars.BaseAvatar"); - var text = (overflowCount > 1) - ? _t("and %(overflowCount)s others...", { overflowCount: overflowCount }) - : _t("and one other..."); + const text = _t("and %(count)s others...", { count: overflowCount }); return ( diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 68cfec2cd9..e855abffc0 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -552,8 +552,10 @@ "Failed to forget room %(errCode)s": "Das Entfernen des Raums ist fehlgeschlagen %(errCode)s", "Failed to join the room": "Fehler beim Betreten des Raumes", "A text message has been sent to +%(msisdn)s. Please enter the verification code it contains": "Eine Textnachricht wurde an +%(msisdn)s gesendet. Bitte gebe den Verifikationscode ein, den er beinhaltet", - "and %(overflowCount)s others...": "und %(overflowCount)s weitere...", - "and one other...": "und ein(e) weitere(r)...", + "and %(count)s others...": { + "other": "und %(count)s weitere...", + "one": "und ein(e) weitere(r)..." + }, "Are you sure?": "Bist du sicher?", "Attachment": "Anhang", "Ban": "Dauerhaft aus dem Raum ausschließen", diff --git a/src/i18n/strings/el.json b/src/i18n/strings/el.json index d339508488..bf96278fbd 100644 --- a/src/i18n/strings/el.json +++ b/src/i18n/strings/el.json @@ -175,8 +175,10 @@ "an address": "μία διεύθηνση", "%(items)s and %(remaining)s others": "%(items)s και %(remaining)s ακόμα", "%(items)s and one other": "%(items)s και ένας ακόμα", - "and %(overflowCount)s others...": "και %(overflowCount)s άλλοι...", - "and one other...": "και ένας ακόμα...", + "and %(count)s others...": { + "other": "και %(count)s άλλοι...", + "one": "και ένας ακόμα..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s και %(lastPerson)s γράφουν", "%(names)s and one other are typing": "%(names)s και ένας ακόμα γράφουν", "%(names)s and %(count)s others are typing": "%(names)s και %(count)s άλλοι γράφουν", diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4841f2f0de..da3d1545ae 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -157,8 +157,10 @@ "%(items)s and %(remaining)s others": "%(items)s and %(remaining)s others", "%(items)s and one other": "%(items)s and one other", "%(items)s and %(lastItem)s": "%(items)s and %(lastItem)s", - "and %(overflowCount)s others...": "and %(overflowCount)s others...", - "and one other...": "and one other...", + "and %(count)s others...": { + "other": "and %(count)s others...", + "one": "and one other..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s and %(lastPerson)s are typing", "%(names)s and one other are typing": "%(names)s and one other are typing", "%(names)s and %(count)s others are typing": "%(names)s and %(count)s others are typing", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index 6a2a326870..47bb96ed14 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -154,8 +154,10 @@ "%(items)s and %(remaining)s others": "%(items)s and %(remaining)s others", "%(items)s and one other": "%(items)s and one other", "%(items)s and %(lastItem)s": "%(items)s and %(lastItem)s", - "and %(overflowCount)s others...": "and %(overflowCount)s others...", - "and one other...": "and one other...", + "and %(count)s others...": { + "other": "and %(count)s others...", + "one": "and one other..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s and %(lastPerson)s are typing", "%(names)s and one other are typing": "%(names)s and one other are typing", "%(names)s and %(count)s others are typing": "%(names)s and %(count)s others are typing", diff --git a/src/i18n/strings/es.json b/src/i18n/strings/es.json index f7506b946d..05b1abffd7 100644 --- a/src/i18n/strings/es.json +++ b/src/i18n/strings/es.json @@ -140,8 +140,10 @@ "%(items)s and %(remaining)s others": "%(items)s y %(remaining)s otros", "%(items)s and one other": "%(items)s y otro", "%(items)s and %(lastItem)s": "%(items)s y %(lastItem)s", - "and %(overflowCount)s others...": "y %(overflowCount)s otros...", - "and one other...": "y otro...", + "and %(count)s others...": { + "other": "y %(count)s otros...", + "one": "y otro..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s y %(lastPerson)s están escribiendo", "%(names)s and one other are typing": "%(names)s y otro están escribiendo", "%(names)s and %(count)s others are typing": "%(names)s y %(count)s otros están escribiendo", diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 9f6fdf3391..9ae015eaff 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -188,8 +188,10 @@ "%(items)s and %(remaining)s others": "%(items)s et %(remaining)s autres", "%(items)s and one other": "%(items)s et un autre", "%(items)s and %(lastItem)s": "%(items)s et %(lastItem)s", - "and %(overflowCount)s others...": "et %(overflowCount)s autres...", - "and one other...": "et un autre...", + "and %(count)s others...": { + "other": "et %(count)s autres...", + "one": "et un autre..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s et %(lastPerson)s sont en train de taper", "%(names)s and one other are typing": "%(names)s et un autre sont en train de taper", "%(names)s and %(count)s others are typing": "%(names)s et %(count)s d'autres sont en train de taper", diff --git a/src/i18n/strings/hu.json b/src/i18n/strings/hu.json index 8335976a06..2d1f07c34e 100644 --- a/src/i18n/strings/hu.json +++ b/src/i18n/strings/hu.json @@ -190,8 +190,10 @@ "%(items)s and %(remaining)s others": "%(items)s és még: %(remaining)s", "%(items)s and one other": "%(items)s és még egy", "%(items)s and %(lastItem)s": "%(items)s és %(lastItem)s", - "and %(overflowCount)s others...": "és még: %(overflowCount)s ...", - "and one other...": "és még egy...", + "and %(count)s others...": { + "other": "és még: %(count)s ...", + "one": "és még egy..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s és %(lastPerson)s írnak", "%(names)s and one other are typing": "%(names)s és még valaki ír", "%(names)s and %(count)s others are typing": "%(names)s és %(count)s ember ír", diff --git a/src/i18n/strings/ko.json b/src/i18n/strings/ko.json index 601f7d1ce0..52970db2ed 100644 --- a/src/i18n/strings/ko.json +++ b/src/i18n/strings/ko.json @@ -225,8 +225,10 @@ "%(items)s and %(remaining)s others": "%(items)s과 %(remaining)s", "%(items)s and one other": "%(items)s과 다른 하나", "%(items)s and %(lastItem)s": "%(items)s과 %(lastItem)s", - "and %(overflowCount)s others...": "그리고 %(overflowCount)s...", - "and one other...": "그리고 다른 하나...", + "and %(count)s others...": { + "other": "그리고 %(count)s...", + "one": "그리고 다른 하나..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s님과 %(lastPerson)s님이 입력중", "%(names)s and one other are typing": "%(names)s님과 다른 분이 입력중", "%(names)s and %(count)s others are typing": "%(names)s님과 %(count)s 분들이 입력중", diff --git a/src/i18n/strings/nl.json b/src/i18n/strings/nl.json index 95c5e0ee78..ae2cf977ea 100644 --- a/src/i18n/strings/nl.json +++ b/src/i18n/strings/nl.json @@ -141,8 +141,10 @@ "%(items)s and %(remaining)s others": "%(items)s en %(remaining)s andere", "%(items)s and one other": "%(items)s en één andere", "%(items)s and %(lastItem)s": "%(items)s en %(lastItem)s", - "and %(overflowCount)s others...": "en %(overflowCount)s andere...", - "and one other...": "en één andere...", + "and %(count)s others...": { + "other": "en %(count)s andere...", + "one": "en één andere..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s en %(lastPerson)s zijn aan het typen", "%(names)s and one other are typing": "%(names)s en één andere zijn aan het typen", "%(names)s and %(count)s others are typing": "%(names)s en %(count)s andere zijn aan het typen", diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index 0405d000af..16ffc1f107 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -556,8 +556,10 @@ "%(items)s and %(remaining)s others": "%(items)s e %(remaining)s outros", "%(items)s and one other": "%(items)s e um outro", "%(items)s and %(lastItem)s": "%(items)s e %(lastItem)s", - "and %(overflowCount)s others...": "e %(overflowCount)s outros...", - "and one other...": "e um outro...", + "and %(count)s others...": { + "other": "e %(count)s outros...", + "one": "e um outro..." + }, "Are you sure?": "Você tem certeza?", "Attachment": "Anexo", "Autoplay GIFs and videos": "Reproduzir automaticamente GIFs e videos", diff --git a/src/i18n/strings/pt_BR.json b/src/i18n/strings/pt_BR.json index 4820104aa1..330dc8f143 100644 --- a/src/i18n/strings/pt_BR.json +++ b/src/i18n/strings/pt_BR.json @@ -557,8 +557,10 @@ "%(items)s and %(remaining)s others": "%(items)s e %(remaining)s outros", "%(items)s and one other": "%(items)s e um outro", "%(items)s and %(lastItem)s": "%(items)s e %(lastItem)s", - "and %(overflowCount)s others...": "e %(overflowCount)s outros...", - "and one other...": "e um outro...", + "and %(count)s others...": { + "other": "e %(count)s outros...", + "one": "e um outro..." + }, "Are you sure?": "Você tem certeza?", "Attachment": "Anexo", "Autoplay GIFs and videos": "Reproduzir automaticamente GIFs e videos", diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json index 76a047d079..cad0617ae2 100644 --- a/src/i18n/strings/ru.json +++ b/src/i18n/strings/ru.json @@ -448,7 +448,10 @@ "sx": "Суту", "zh-hk": "Китайский (Гонконг)", "A text message has been sent to +%(msisdn)s. Please enter the verification code it contains": "На +%(msisdn)s было отправлено текстовое сообщение. Пожалуйста, введите проверочный код из него", - "and %(overflowCount)s others...": "и %(overflowCount)s других...", + "and %(count)s others...": { + "other": "и %(count)s других...", + "one": "и ещё один..." + }, "Are you sure?": "Вы уверены?", "Autoplay GIFs and videos": "Проигрывать GIF и видео автоматически", "Can't connect to homeserver - please check your connectivity and ensure your homeserver's SSL certificate is trusted.": "Невозможно соединиться с домашним сервером - проверьте своё соединение и убедитесь, что SSL-сертификат вашего домашнего сервера включён в доверяемые.", @@ -479,7 +482,6 @@ "%(items)s and %(remaining)s others": "%(items)s и другие %(remaining)s", "%(items)s and one other": "%(items)s и ещё один", "%(items)s and %(lastItem)s": "%(items)s и %(lastItem)s", - "and one other...": "и ещё один...", "An error has occurred.": "Произошла ошибка.", "Attachment": "Вложение", "Ban": "Запретить", diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index 21bda3b741..549e06c991 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -150,8 +150,10 @@ "%(items)s and %(remaining)s others": "%(items)s och %(remaining)s andra", "%(items)s and one other": "%(items)s och en annan", "%(items)s and %(lastItem)s": "%(items)s och %(lastItem)s", - "and %(overflowCount)s others...": "och %(overflowCount)s andra...", - "and one other...": "och en annan...", + "and %(count)s others...": { + "other": "och %(count)s andra...", + "one": "och en annan..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s och %(lastPerson)s skriver", "%(names)s and one other are typing": "%(names)s och en annan skriver", "%(names)s and %(count)s others are typing": "%(names)s och %(count)s andra skriver", diff --git a/src/i18n/strings/th.json b/src/i18n/strings/th.json index 5dff4816ee..265c3e1b58 100644 --- a/src/i18n/strings/th.json +++ b/src/i18n/strings/th.json @@ -98,8 +98,10 @@ "%(items)s and %(remaining)s others": "%(items)s และอีก %(remaining)s ผู้ใช้", "%(items)s and one other": "%(items)s และอีกหนึ่งผู้ใช้", "%(items)s and %(lastItem)s": "%(items)s และ %(lastItem)s", - "and %(overflowCount)s others...": "และอีก %(overflowCount)s ผู้ใช้...", - "and one other...": "และอีกหนึ่งผู้ใช้...", + "and %(count)s others...": { + "other": "และอีก %(count)s ผู้ใช้...", + "one": "และอีกหนึ่งผู้ใช้..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s และ %(lastPerson)s กำลังพิมพ์", "%(names)s and one other are typing": "%(names)s และอีกหนึ่งคนกำลังพิมพ์", "%(names)s and %(count)s others are typing": "%(names)s และอีก %(count)s คนกำลังพิมพ์", diff --git a/src/i18n/strings/tr.json b/src/i18n/strings/tr.json index 3d0d774926..effc426464 100644 --- a/src/i18n/strings/tr.json +++ b/src/i18n/strings/tr.json @@ -156,8 +156,10 @@ "%(items)s and %(remaining)s others": "%(items)s ve %(remaining)s diğerleri", "%(items)s and one other": "%(items)s ve bir başkası", "%(items)s and %(lastItem)s": "%(items)s ve %(lastItem)s", - "and %(overflowCount)s others...": "ve %(overflowCount)s diğerleri...", - "and one other...": "ve bir diğeri...", + "and %(count)s others...": { + "other": "ve %(count)s diğerleri...", + "one": "ve bir diğeri..." + }, "%(names)s and %(lastPerson)s are typing": "%(names)s ve %(lastPerson)s yazıyorlar", "%(names)s and one other are typing": "%(names)s ve birisi yazıyor", "%(names)s and %(count)s others are typing": "%(names)s ve %(count)s diğeri yazıyor", diff --git a/src/i18n/strings/zh_Hans.json b/src/i18n/strings/zh_Hans.json index 9fdc7a0b42..ad56ab45b8 100644 --- a/src/i18n/strings/zh_Hans.json +++ b/src/i18n/strings/zh_Hans.json @@ -239,8 +239,10 @@ "%(items)s and %(remaining)s others": "%(items)s 和其它 %(remaining)s 个", "%(items)s and one other": "%(items)s 和其它一个", "%(items)s and %(lastItem)s": "%(items)s 和 %(lastItem)s", - "and %(overflowCount)s others...": "和其它 %(overflowCount)s 个...", - "and one other...": "和其它一个...", + "and %(count)s others...": { + "other": "和其它 %(count)s 个...", + "one": "和其它一个..." + }, "%(names)s and one other are typing": "%(names)s 和另一个人正在打字", "anyone": "任何人", "Anyone": "任何人", From 598411dd03892189a04fcf35937541abe80173d5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 25 Jul 2017 17:22:05 +0100 Subject: [PATCH 003/535] Add translation --- src/i18n/strings/en_EN.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 86cf8727bb..a12d277a92 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -961,5 +961,7 @@ "Edit Group": "Edit Group", "Automatically replace plain text Emoji": "Automatically replace plain text Emoji", "Failed to upload image": "Failed to upload image", - "Failed to update group": "Failed to update group" + "Failed to update group": "Failed to update group", + "Description": "Description", + "Filter group members": "Filter group members" } From 79b83e60ab4032b64e0df218cc14f6f81fbddca3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 31 Jul 2017 12:08:28 +0100 Subject: [PATCH 004/535] add /devtools command --- src/SlashCommands.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index dea3d27751..81fd52f9c9 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -292,6 +292,13 @@ const commands = { return reject(this.getUsage()); }), + // Open developer tools + devtools: new Command("devtools", "", function(roomId) { + const DevtoolsDialog = sdk.getComponent("dialogs.DevtoolsDialog"); + Modal.createDialog(DevtoolsDialog, { roomId }); + return success(); + }), + // Verify a user, device, and pubkey tuple verify: new Command("verify", " ", function(roomId, args) { if (args) { From 4b4b7302331b195e199e44bd2abddbf1a2c68b29 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 2 Aug 2017 13:41:26 +0100 Subject: [PATCH 005/535] fix and i18n the impl Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/MatrixChat.js | 24 ++++++++------ .../dialogs/TextInputWithCheckboxDialog.js | 33 +++++++------------ src/i18n/strings/en_EN.json | 2 ++ 3 files changed, 27 insertions(+), 32 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 50ee9963a6..22119585d9 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -214,10 +214,6 @@ module.exports = React.createClass({ return this.props.config.default_is_url || "https://vector.im"; }, - getDefaultFederate() { - return this.props.config.default_federate && true; - }, - componentWillMount: function() { SdkConfig.put(this.props.config); @@ -790,19 +786,27 @@ module.exports = React.createClass({ dis.dispatch({action: 'view_set_mxid'}); return; } + // Dialog shows inverse of m.federate (noFederate) strict false check to skip undefined check (default = true) + const defaultNoFederate = this.props.config.default_federate === false; const TextInputWithCheckboxDialog = sdk.getComponent("dialogs.TextInputWithCheckboxDialog"); Modal.createDialog(TextInputWithCheckboxDialog, { title: _t('Create Room'), description: _t('Room name (optional)'), button: _t('Create Room'), - // TODO i18n below. - check: this.getDefaultFederate(), - checkLabel: 'Federate room in domain ' + MatrixClientPeg.get().getDomain(), - onFinished: (shouldCreate, name, federate) => { + check: defaultNoFederate, + checkLabel: + {_t('Block users on other matrix homeservers from joining this room')} +
+ ({_t('This setting cannot be changed later!')}) +
, + onFinished: (shouldCreate, name, noFederate) => { if (shouldCreate) { - const createOpts = {}; + const createOpts = { + creation_content: { + "m.federate": !noFederate, + }, + }; if (name) createOpts.name = name; - if (federate) createOpts.creation_content = {"m.federate": federate}; createRoom({createOpts}).done(); } }, diff --git a/src/components/views/dialogs/TextInputWithCheckboxDialog.js b/src/components/views/dialogs/TextInputWithCheckboxDialog.js index 916de16af5..613fab4cdb 100644 --- a/src/components/views/dialogs/TextInputWithCheckboxDialog.js +++ b/src/components/views/dialogs/TextInputWithCheckboxDialog.js @@ -16,6 +16,7 @@ limitations under the License. import React from 'react'; import sdk from '../../../index'; +import { _t } from '../../../languageHandler'; export default React.createClass({ displayName: 'TextInputWithCheckboxDialog', @@ -28,7 +29,10 @@ export default React.createClass({ value: React.PropTypes.string, button: React.PropTypes.string, focus: React.PropTypes.bool, - checkLabel: React.PropTypes.string, + checkLabel: React.PropTypes.oneOfType([ + React.PropTypes.element, + React.PropTypes.string, + ]), check: React.PropTypes.bool, onFinished: React.PropTypes.func.isRequired, }, @@ -38,16 +42,9 @@ export default React.createClass({ title: "", value: "", description: "", - button: "OK", focus: true, checkLabel: "", - check: true, - }; - }, - - getInitialState: function() { - return { - isChecked: this.props.check, + check: false, }; }, @@ -59,20 +56,13 @@ export default React.createClass({ }, onOk: function() { - this.props.onFinished(true, this.refs.textinput.value, this.state.isChecked); + this.props.onFinished(true, this.refs.textinput.value, this.refs.checkbox.value); }, onCancel: function() { this.props.onFinished(false); }, - _onToggle: function(keyName, checkedValue, uncheckedValue, ev) { - console.log("Checkbox toggle: %s %s", keyName, ev.target.checked); - var state = {}; - state[keyName] = ev.target.checked ? checkedValue : uncheckedValue; - this.setState(state); - }, - render: function() { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); return ( @@ -87,16 +77,15 @@ export default React.createClass({
+