Skip to content

Commit c39044f

Browse files
committed
Merge branch 'develop' of github.com:vector-im/riot-web into t3chguy/fix_typecheck_warn
2 parents 71c8dca + c74e6c3 commit c39044f

9 files changed

Lines changed: 245 additions & 209 deletions

File tree

‎config.sample.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"integrations_rest_url": "https://scalar.vector.im/api",
77
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
88
"features": {
9-
"feature_groups": "labs"
10-
"feature_pinning": "labs",
9+
"feature_groups": "labs",
10+
"feature_pinning": "labs"
1111
},
1212
"default_federate": true,
1313
"roomDirectory": {

‎src/components/structures/LeftPanel.js‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
import React from 'react';
2020
import { DragDropContext } from 'react-dnd';
2121
import HTML5Backend from 'react-dnd-html5-backend';
22+
import classNames from 'classnames';
2223
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
2324
import sdk from 'matrix-react-sdk';
2425
import dis from 'matrix-react-sdk/lib/dispatcher';
@@ -55,7 +56,7 @@ var LeftPanel = React.createClass({
5556
// We just need to update if any of these things change.
5657
if (
5758
this.props.collapsed !== nextProps.collapsed ||
58-
this.props.opacity !== nextProps.opacity
59+
this.props.disabled !== nextProps.disabled
5960
) {
6061
return true;
6162
}
@@ -176,14 +177,16 @@ var LeftPanel = React.createClass({
176177
topBox = <SearchBox collapsed={ this.props.collapsed } onSearch={ this.onSearch } />;
177178
}
178179

179-
let classes = "mx_LeftPanel mx_fadable";
180-
if (this.props.collapsed) {
181-
classes += " collapsed";
182-
}
180+
let classes = classNames(
181+
"mx_LeftPanel", "mx_fadable",
182+
{
183+
"collapsed": this.props.collapsed,
184+
"mx_fadable_faded": this.props.disabled,
185+
}
186+
);
183187

184188
return (
185-
<aside className={classes} style={{ opacity: this.props.opacity }}
186-
onKeyDown={ this._onKeyDown } onFocus={ this._onFocus } onBlur={ this._onBlur }>
189+
<aside className={classes} onKeyDown={ this._onKeyDown } onFocus={ this._onFocus } onBlur={ this._onBlur }>
187190
{ topBox }
188191
<CallPreview ConferenceHandler={VectorConferenceHandler} />
189192
<RoomList

‎src/components/structures/RightPanel.js‎

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818

1919
import React from 'react';
2020
import PropTypes from 'prop-types';
21+
import classNames from 'classnames';
2122
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2223
import sdk from 'matrix-react-sdk';
2324
import dis from 'matrix-react-sdk/lib/dispatcher';
@@ -99,27 +100,50 @@ module.exports = React.createClass({
99100
this.dispatcherRef = dis.register(this.onAction);
100101
const cli = this.context.matrixClient;
101102
cli.on("RoomState.members", this.onRoomStateMember);
103+
this._initGroupStore(this.props.groupId);
102104
},
103105

104106
componentWillUnmount: function() {
105107
dis.unregister(this.dispatcherRef);
106108
if (this.context.matrixClient) {
107109
this.context.matrixClient.removeListener("RoomState.members", this.onRoomStateMember);
108110
}
111+
this._unregisterGroupStore();
109112
},
110113

111114
getInitialState: function() {
112-
if (this.props.groupId) {
113-
return {
114-
phase: this.Phase.GroupMemberList,
115-
};
116-
} else {
117-
return {
118-
phase: this.Phase.RoomMemberList,
119-
};
115+
return {
116+
phase: this.props.groupId ? this.Phase.GroupMemberList : this.Phase.RoomMemberList,
117+
isUserPrivilegedInGroup: null,
118+
}
119+
},
120+
121+
componentWillReceiveProps(newProps) {
122+
if (newProps.groupId !== this.props.groupId) {
123+
this._unregisterGroupStore();
124+
this._initGroupStore(newProps.groupId);
125+
}
126+
},
127+
128+
_initGroupStore(groupId) {
129+
this._groupStore = GroupStoreCache.getGroupStore(
130+
this.context.matrixClient, this.props.groupId,
131+
);
132+
this._groupStore.registerListener(this.onGroupStoreUpdated);
133+
},
134+
135+
_unregisterGroupStore() {
136+
if (this._groupStore) {
137+
this._groupStore.unregisterListener(this.onGroupStoreUpdated);
120138
}
121139
},
122140

141+
onGroupStoreUpdated: function(){
142+
this.setState({
143+
isUserPrivilegedInGroup: this._groupStore.isUserPrivileged(),
144+
});
145+
},
146+
123147
onCollapseClick: function() {
124148
dis.dispatch({
125149
action: 'hide_right_panel',
@@ -248,6 +272,11 @@ module.exports = React.createClass({
248272
}
249273
}
250274

275+
const isPhaseGroup = [
276+
this.Phase.GroupMemberInfo,
277+
this.Phase.GroupMemberList
278+
].includes(this.state.phase);
279+
251280
let headerButtons = [];
252281
if (this.props.roomId) {
253282
headerButtons = [
@@ -271,7 +300,7 @@ module.exports = React.createClass({
271300
} else if (this.props.groupId) {
272301
headerButtons = [
273302
<HeaderButton key="_groupMembersButton" title={_t('Members')} iconSrc="img/icons-people.svg"
274-
isHighlighted={this.state.phase === this.Phase.GroupMemberList}
303+
isHighlighted={isPhaseGroup}
275304
clickPhase={this.Phase.GroupMemberList}
276305
analytics={['Right Panel', 'Group Member List Button', 'click']}
277306
/>,
@@ -322,13 +351,8 @@ module.exports = React.createClass({
322351
panel = <div className="mx_RightPanel_blank"></div>;
323352
}
324353

325-
if (this.props.groupId &&
326-
GroupStoreCache.getGroupStore(this.context.matrixClient, this.props.groupId).isUserPrivileged()
327-
) {
328-
inviteGroup = [
329-
this.Phase.GroupMemberInfo,
330-
this.Phase.GroupMemberList,
331-
].includes(this.state.phase) ? (
354+
if (this.props.groupId && this.state.isUserPrivilegedInGroup) {
355+
inviteGroup = isPhaseGroup ? (
332356
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
333357
<div className="mx_RightPanel_icon" >
334358
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
@@ -345,13 +369,16 @@ module.exports = React.createClass({
345369
);
346370
}
347371

348-
let classes = "mx_RightPanel mx_fadable";
349-
if (this.props.collapsed) {
350-
classes += " collapsed";
351-
}
372+
let classes = classNames(
373+
"mx_RightPanel", "mx_fadable",
374+
{
375+
"collapsed": this.props.collapsed,
376+
"mx_fadable_faded": this.props.disabled,
377+
}
378+
);
352379

353380
return (
354-
<aside className={classes} style={{ opacity: this.props.opacity }}>
381+
<aside className={classes}>
355382
<div className="mx_RightPanel_header">
356383
<div className="mx_RightPanel_headerButtonGroup">
357384
{headerButtons}

‎src/components/structures/RoomDirectory.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ module.exports = React.createClass({
8989
});
9090

9191
// dis.dispatch({
92-
// action: 'ui_opacity',
93-
// sideOpacity: 0.3,
94-
// middleOpacity: 0.3,
92+
// action: 'panel_disable',
93+
// sideDisabled: true,
94+
// middleDisabled: true,
9595
// });
9696
},
9797

9898
componentWillUnmount: function() {
9999
// dis.dispatch({
100-
// action: 'ui_opacity',
101-
// sideOpacity: 1.0,
102-
// middleOpacity: 1.0,
100+
// action: 'panel_disable',
101+
// sideDisabled: false,
102+
// middleDisabled: false,
103103
// });
104104
if (this.filterTimeout) {
105105
clearTimeout(this.filterTimeout);

‎src/components/views/dialogs/DevtoolsDialog.js‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class SendCustomEvent extends React.Component {
5757
_buttons() {
5858
return <div className="mx_Dialog_buttons">
5959
<button onClick={this.onBack}>{ _t('Back') }</button>
60-
{!this.state.message && <button onClick={this._send}>{ _t('Send') }</button>}
60+
{ !this.state.message && <button onClick={this._send}>{ _t('Send') }</button> }
6161
</div>;
6262
}
6363

@@ -83,7 +83,7 @@ class SendCustomEvent extends React.Component {
8383
}
8484

8585
_additionalFields() {
86-
return <div/>;
86+
return <div />;
8787
}
8888

8989
_onChange(e) {
@@ -94,15 +94,15 @@ class SendCustomEvent extends React.Component {
9494
if (this.state.message) {
9595
return <div>
9696
<div className="mx_Dialog_content">
97-
{this.state.message}
97+
{ this.state.message }
9898
</div>
99-
{this._buttons()}
99+
{ this._buttons() }
100100
</div>;
101101
}
102102

103103
return <div>
104104
<div className="mx_Dialog_content">
105-
{this._additionalFields()}
105+
{ this._additionalFields() }
106106
<div className="mx_TextInputDialog_label">
107107
<label htmlFor="eventType"> { _t('Event Type') } </label>
108108
</div>
@@ -117,7 +117,7 @@ class SendCustomEvent extends React.Component {
117117
<textarea id="evContent" onChange={this._onChange} value={this.state.input_evContent} className="mx_TextInputDialog_input" cols="63" rows="5" />
118118
</div>
119119
</div>
120-
{this._buttons()}
120+
{ this._buttons() }
121121
</div>;
122122
}
123123
}
@@ -223,7 +223,7 @@ class RoomStateExplorer extends React.Component {
223223
if (this.state.event) {
224224
return <div className="mx_ViewSource">
225225
<div className="mx_Dialog_content">
226-
<pre>{JSON.stringify(this.state.event.event, null, 2)}</pre>
226+
<pre>{ JSON.stringify(this.state.event.event, null, 2) }</pre>
227227
</div>
228228
<div className="mx_Dialog_buttons">
229229
<button onClick={this.onBack}>{ _t('Back') }</button>
@@ -237,7 +237,7 @@ class RoomStateExplorer extends React.Component {
237237
if (this.state.eventType === null) {
238238
Object.keys(this.roomStateEvents).forEach((evType) => {
239239
// Skip this entry if does not contain search query
240-
if (this.state.query && !evType.includes(this.state.query)) return;
240+
if (this.state.query && !evType.toLowerCase().includes(this.state.query.toLowerCase())) return;
241241

242242
const stateGroup = this.roomStateEvents[evType];
243243
const stateKeys = Object.keys(stateGroup);
@@ -258,7 +258,7 @@ class RoomStateExplorer extends React.Component {
258258
const stateGroup = this.roomStateEvents[evType];
259259
Object.keys(stateGroup).forEach((stateKey) => {
260260
// Skip this entry if does not contain search query
261-
if (this.state.query && !stateKey.includes(this.state.query)) return;
261+
if (this.state.query && !stateKey.toLowerCase().includes(this.state.query.toLowerCase())) return;
262262

263263
const ev = stateGroup[stateKey];
264264
rows.push(<button className="mx_DevTools_RoomStateExplorer_button" key={stateKey}
@@ -271,7 +271,7 @@ class RoomStateExplorer extends React.Component {
271271
return <div>
272272
<div className="mx_Dialog_content">
273273
<input onChange={this.onQuery} placeholder={_t('Filter results')} size="64" className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query" value={this.state.query} />
274-
{rows}
274+
{ rows }
275275
</div>
276276
<div className="mx_Dialog_buttons">
277277
<button onClick={this.onBack}>{ _t('Back') }</button>

0 commit comments

Comments
 (0)