Merge remote-tracking branch 'origin/develop' into develop
						commit
						662a05e86f
					
				|  | @ -49,20 +49,26 @@ export function showGroupInviteDialog(groupId) { | |||
| 
 | ||||
| export function showGroupAddRoomDialog(groupId) { | ||||
|     return new Promise((resolve, reject) => { | ||||
|         let addRoomsPublicly = false; | ||||
|         const onCheckboxClicked = (e) => { | ||||
|             addRoomsPublicly = e.target.checked; | ||||
|         }; | ||||
|         const description = <div> | ||||
|             <div>{ _t("Which rooms would you like to add to this community?") }</div> | ||||
|             <div className="warning"> | ||||
|                 { _t( | ||||
|                     "Warning: any room you add to a community will be publicly "+ | ||||
|                     "visible to anyone who knows the community ID", | ||||
|                 ) } | ||||
|             </div> | ||||
|         </div>; | ||||
| 
 | ||||
|         const checkboxContainer = <label className="mx_GroupAddressPicker_checkboxContainer"> | ||||
|             <input type="checkbox" onClick={onCheckboxClicked} /> | ||||
|             <div> | ||||
|                 { _t("Show these rooms to non-members on the community page and room list?") } | ||||
|             </div> | ||||
|         </label>; | ||||
| 
 | ||||
|         const AddressPickerDialog = sdk.getComponent("dialogs.AddressPickerDialog"); | ||||
|         Modal.createTrackedDialog('Add Rooms to Group', '', AddressPickerDialog, { | ||||
|             title: _t("Add rooms to the community"), | ||||
|             description: description, | ||||
|             extraNode: checkboxContainer, | ||||
|             placeholder: _t("Room name or alias"), | ||||
|             button: _t("Add to community"), | ||||
|             pickerType: 'room', | ||||
|  | @ -70,7 +76,7 @@ export function showGroupAddRoomDialog(groupId) { | |||
|             onFinished: (success, addrs) => { | ||||
|                 if (!success) return; | ||||
| 
 | ||||
|                 _onGroupAddRoomFinished(groupId, addrs).then(resolve, reject); | ||||
|                 _onGroupAddRoomFinished(groupId, addrs, addRoomsPublicly).then(resolve, reject); | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | @ -106,13 +112,13 @@ function _onGroupInviteFinished(groupId, addrs) { | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| function _onGroupAddRoomFinished(groupId, addrs) { | ||||
| function _onGroupAddRoomFinished(groupId, addrs, addRoomsPublicly) { | ||||
|     const matrixClient = MatrixClientPeg.get(); | ||||
|     const groupStore = GroupStoreCache.getGroupStore(matrixClient, groupId); | ||||
|     const errorList = []; | ||||
|     return Promise.all(addrs.map((addr) => { | ||||
|         return groupStore | ||||
|             .addRoomToGroup(addr.address) | ||||
|             .addRoomToGroup(addr.address, addRoomsPublicly) | ||||
|             .catch(() => { errorList.push(addr.address); }) | ||||
|             .then(() => { | ||||
|                 const roomId = addr.address; | ||||
|  |  | |||
|  | @ -591,7 +591,7 @@ export default React.createClass({ | |||
| 
 | ||||
|     _onAcceptInviteClick: function() { | ||||
|         this.setState({membershipBusy: true}); | ||||
|         MatrixClientPeg.get().acceptGroupInvite(this.props.groupId).then(() => { | ||||
|         this._groupStore.acceptGroupInvite().then(() => { | ||||
|             // don't reset membershipBusy here: wait for the membership change to come down the sync
 | ||||
|         }).catch((e) => { | ||||
|             this.setState({membershipBusy: false}); | ||||
|  |  | |||
|  | @ -34,6 +34,8 @@ module.exports = React.createClass({ | |||
|     propTypes: { | ||||
|         title: PropTypes.string.isRequired, | ||||
|         description: PropTypes.node, | ||||
|         // Extra node inserted after picker input, dropdown and errors
 | ||||
|         extraNode: PropTypes.node, | ||||
|         value: PropTypes.string, | ||||
|         placeholder: PropTypes.string, | ||||
|         roomId: PropTypes.string, | ||||
|  | @ -574,6 +576,7 @@ module.exports = React.createClass({ | |||
|                     <div className="mx_ChatInviteDialog_inputContainer">{ query }</div> | ||||
|                     { error } | ||||
|                     { addressSelector } | ||||
|                     { this.props.extraNode } | ||||
|                 </div> | ||||
|                 <div className="mx_Dialog_buttons"> | ||||
|                     <button className="mx_Dialog_primary" onClick={this.onButtonClick}> | ||||
|  |  | |||
|  | @ -49,7 +49,7 @@ | |||
|     "Name or matrix ID": "Name or matrix ID", | ||||
|     "Invite to Community": "Invite to Community", | ||||
|     "Which rooms would you like to add to this community?": "Which rooms would you like to add to this community?", | ||||
|     "Warning: any room you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any room you add to a community will be publicly visible to anyone who knows the community ID", | ||||
|     "Show these rooms to non-members on the community page and room list?": "Show these rooms to non-members on the community page and room list?", | ||||
|     "Add rooms to the community": "Add rooms to the community", | ||||
|     "Room name or alias": "Room name or alias", | ||||
|     "Add to community": "Add to community", | ||||
|  |  | |||
|  | @ -169,6 +169,12 @@ export default class GroupStore extends EventEmitter { | |||
|             .then(this._fetchMembers.bind(this)); | ||||
|     } | ||||
| 
 | ||||
|     acceptGroupInvite() { | ||||
|         return this._matrixClient.acceptGroupInvite(this.groupId) | ||||
|             // The user might be able to see more rooms now
 | ||||
|             .then(this._fetchRooms.bind(this)); | ||||
|     } | ||||
| 
 | ||||
|     addRoomToGroupSummary(roomId, categoryId) { | ||||
|         return this._matrixClient | ||||
|             .addRoomToGroupSummary(this.groupId, roomId, categoryId) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Weblate
						Weblate