Skip to content

Commit 0d6b09a

Browse files
author
Luke Barnard
committed
Merge branch 'develop' into luke/fix-ugly-integ-button
2 parents d25c3be + fbcccd8 commit 0d6b09a

9 files changed

Lines changed: 250 additions & 93 deletions

File tree

‎electron_app/src/electron-main.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ let powerSaveBlockerId;
8484
electron.ipcMain.on('app_onAction', function(ev, payload) {
8585
switch (payload.action) {
8686
case 'call_state':
87-
if (powerSaveBlockerId && powerSaveBlockerId.isStarted(powerSaveBlockerId)) {
87+
if (powerSaveBlockerId && electron.powerSaveBlocker.isStarted(powerSaveBlockerId)) {
8888
if (payload.state === 'ended') {
8989
electron.powerSaveBlocker.stop(powerSaveBlockerId);
9090
}

‎src/components/structures/RightPanel.js‎

Lines changed: 142 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3+
Copyright 2017 Vector Creations Ltd
4+
Copyright 2017 New Vector Ltd
35
46
Licensed under the Apache License, Version 2.0 (the "License");
57
you may not use this file except in compliance with the License.
@@ -14,8 +16,6 @@ See the License for the specific language governing permissions and
1416
limitations under the License.
1517
*/
1618

17-
'use strict';
18-
1919
import React from 'react';
2020
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2121
import sdk from 'matrix-react-sdk';
@@ -26,26 +26,31 @@ import Analytics from 'matrix-react-sdk/lib/Analytics';
2626
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
2727
import Modal from 'matrix-react-sdk/lib/Modal';
2828
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
29+
import { showGroupInviteDialog } from 'matrix-react-sdk/lib/GroupInvite';
2930

3031
module.exports = React.createClass({
3132
displayName: 'RightPanel',
3233

3334
propTypes: {
34-
// TODO: This should not be a prop, it should be received from the RoomViewStore
35+
// TODO: We're trying to move away from these being props, but we need to know
36+
// whether we should be displaying a room or group member list
3537
roomId: React.PropTypes.string, // if showing panels for a given room, this is set
38+
groupId: React.PropTypes.string, // if showing panels for a given group, this is set
3639
collapsed: React.PropTypes.bool, // currently unused property to request for a minimized view of the panel
3740
},
3841

3942
Phase: {
40-
MemberList: 'MemberList',
43+
RoomMemberList: 'RoomMemberList',
44+
GroupMemberList: 'GroupMemberList',
4145
FilePanel: 'FilePanel',
4246
NotificationPanel: 'NotificationPanel',
43-
MemberInfo: 'MemberInfo',
47+
RoomMemberInfo: 'RoomMemberInfo',
48+
GroupMemberInfo: 'GroupMemberInfo',
4449
},
4550

4651
componentWillMount: function() {
4752
this.dispatcherRef = dis.register(this.onAction);
48-
var cli = MatrixClientPeg.get();
53+
const cli = MatrixClientPeg.get();
4954
cli.on("RoomState.members", this.onRoomStateMember);
5055
},
5156

@@ -57,14 +62,20 @@ module.exports = React.createClass({
5762
},
5863

5964
getInitialState: function() {
60-
return {
61-
phase: this.Phase.MemberList
62-
};
65+
if (this.props.groupId) {
66+
return {
67+
phase: this.Phase.GroupMemberList,
68+
};
69+
} else {
70+
return {
71+
phase: this.Phase.RoomMemberList,
72+
};
73+
}
6374
},
6475

6576
onMemberListButtonClick: function() {
6677
Analytics.trackEvent('Right Panel', 'Member List Button', 'click');
67-
this.setState({ phase: this.Phase.MemberList });
78+
this.setState({ phase: this.Phase.RoomMemberList });
6879
},
6980

7081
onFileListButtonClick: function() {
@@ -89,19 +100,23 @@ module.exports = React.createClass({
89100
return;
90101
}
91102

92-
// call ChatInviteDialog
93-
dis.dispatch({
94-
action: 'view_invite',
95-
roomId: this.props.roomId,
96-
});
103+
if (this.state.phase === this.Phase.GroupMemberList) {
104+
showGroupInviteDialog(this.props.groupId);
105+
} else {
106+
// call UserPickerDialog
107+
dis.dispatch({
108+
action: 'view_invite',
109+
roomId: this.props.roomId,
110+
});
111+
}
97112
},
98113

99114
onRoomStateMember: function(ev, state, member) {
100115
// redraw the badge on the membership list
101-
if (this.state.phase == this.Phase.MemberList && member.roomId === this.props.roomId) {
116+
if (this.state.phase == this.Phase.RoomMemberList && member.roomId === this.props.roomId) {
102117
this._delayedUpdate();
103118
}
104-
else if (this.state.phase === this.Phase.MemberInfo && member.roomId === this.props.roomId &&
119+
else if (this.state.phase === this.Phase.RoomMemberInfo && member.roomId === this.props.roomId &&
105120
member.userId === this.state.member.userId) {
106121
// refresh the member info (e.g. new power level)
107122
this._delayedUpdate();
@@ -119,39 +134,55 @@ module.exports = React.createClass({
119134
});
120135
if (payload.member) {
121136
this.setState({
122-
phase: this.Phase.MemberInfo,
137+
phase: this.Phase.RoomMemberInfo,
123138
member: payload.member,
124139
});
140+
} else {
141+
if (this.props.roomId) {
142+
this.setState({
143+
phase: this.Phase.RoomMemberList
144+
});
145+
} else if (this.props.groupId) {
146+
this.setState({
147+
phase: this.Phase.GroupMemberList,
148+
groupId: payload.groupId,
149+
member: payload.member,
150+
});
151+
}
125152
}
126-
else {
127-
this.setState({
128-
phase: this.Phase.MemberList
129-
});
130-
}
131-
}
132-
else if (payload.action === "view_room") {
133-
if (this.state.phase === this.Phase.MemberInfo) {
134-
this.setState({
135-
phase: this.Phase.MemberList
136-
});
137-
}
153+
} else if (payload.action === "view_group") {
154+
this.setState({
155+
phase: this.Phase.GroupMemberList,
156+
groupId: payload.groupId,
157+
member: null,
158+
});
159+
} else if (payload.action === "view_group_user") {
160+
this.setState({
161+
phase: this.Phase.GroupMemberInfo,
162+
groupId: payload.groupId,
163+
member: payload.member,
164+
});
165+
} else if (payload.action === "view_room") {
166+
this.setState({
167+
phase: this.Phase.RoomMemberList
168+
});
138169
}
139170
},
140171

141172
render: function() {
142-
var MemberList = sdk.getComponent('rooms.MemberList');
143-
var NotificationPanel = sdk.getComponent('structures.NotificationPanel');
144-
var FilePanel = sdk.getComponent('structures.FilePanel');
145-
var TintableSvg = sdk.getComponent("elements.TintableSvg");
146-
var buttonGroup;
147-
var inviteGroup;
148-
var panel;
149-
150-
var filesHighlight;
151-
var membersHighlight;
152-
var notificationsHighlight;
173+
const MemberList = sdk.getComponent('rooms.MemberList');
174+
const GroupMemberList = sdk.getComponent('groups.GroupMemberList');
175+
const NotificationPanel = sdk.getComponent('structures.NotificationPanel');
176+
const FilePanel = sdk.getComponent('structures.FilePanel');
177+
const TintableSvg = sdk.getComponent("elements.TintableSvg");
178+
let inviteGroup;
179+
let panel;
180+
181+
let filesHighlight;
182+
let membersHighlight;
183+
let notificationsHighlight;
153184
if (!this.props.collapsed) {
154-
if (this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) {
185+
if (this.state.phase == this.Phase.RoomMemberList || this.state.phase === this.Phase.RoomMemberInfo) {
155186
membersHighlight = <div className="mx_RightPanel_headerButton_highlight"></div>;
156187
}
157188
else if (this.state.phase == this.Phase.FilePanel) {
@@ -162,11 +193,11 @@ module.exports = React.createClass({
162193
}
163194
}
164195

165-
var membersBadge;
166-
if ((this.state.phase == this.Phase.MemberList || this.state.phase === this.Phase.MemberInfo) && this.props.roomId) {
167-
var cli = MatrixClientPeg.get();
168-
var room = cli.getRoom(this.props.roomId);
169-
var user_is_in_room;
196+
let membersBadge;
197+
if ((this.state.phase == this.Phase.RoomMemberList || this.state.phase === this.Phase.RoomMemberInfo) && this.props.roomId) {
198+
const cli = MatrixClientPeg.get();
199+
const room = cli.getRoom(this.props.roomId);
200+
let user_is_in_room;
170201
if (room) {
171202
membersBadge = room.getJoinedMembers().length;
172203
user_is_in_room = room.hasMembershipState(
@@ -186,64 +217,90 @@ module.exports = React.createClass({
186217

187218
}
188219

220+
let headerButtons = [];
189221
if (this.props.roomId) {
190-
buttonGroup =
191-
<div className="mx_RightPanel_headerButtonGroup">
192-
<AccessibleButton className="mx_RightPanel_headerButton"
193-
title={ _t('Members') } onClick={ this.onMemberListButtonClick }>
194-
<div className="mx_RightPanel_headerButton_badge">{ membersBadge ? membersBadge : <span>&nbsp;</span>}</div>
195-
<TintableSvg src="img/icons-people.svg" width="25" height="25"/>
196-
{ membersHighlight }
197-
</AccessibleButton>
198-
<AccessibleButton
199-
className="mx_RightPanel_headerButton mx_RightPanel_filebutton"
200-
title={ _t('Files') } onClick={ this.onFileListButtonClick }>
201-
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
202-
<TintableSvg src="img/icons-files.svg" width="25" height="25"/>
203-
{ filesHighlight }
204-
</AccessibleButton>
205-
<AccessibleButton
206-
className="mx_RightPanel_headerButton mx_RightPanel_notificationbutton"
207-
title={ _t('Notifications') } onClick={ this.onNotificationListButtonClick }>
208-
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
209-
<TintableSvg src="img/icons-notifications.svg" width="25" height="25"/>
210-
{ notificationsHighlight }
211-
</AccessibleButton>
212-
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" title={ _t("Hide panel") } onClick={ this.onCollapseClick }>
213-
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
214-
</div>
215-
</div>;
222+
headerButtons.push(
223+
<AccessibleButton className="mx_RightPanel_headerButton" key="_membersButton"
224+
title={ _t('Members') } onClick={ this.onMemberListButtonClick }>
225+
<div className="mx_RightPanel_headerButton_badge">{ membersBadge ? membersBadge : <span>&nbsp;</span>}</div>
226+
<TintableSvg src="img/icons-people.svg" width="25" height="25"/>
227+
{ membersHighlight }
228+
</AccessibleButton>
229+
);
230+
headerButtons.push(
231+
<AccessibleButton
232+
className="mx_RightPanel_headerButton mx_RightPanel_filebutton" key="_filesButton"
233+
title={ _t('Files') } onClick={ this.onFileListButtonClick }>
234+
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
235+
<TintableSvg src="img/icons-files.svg" width="25" height="25"/>
236+
{ filesHighlight }
237+
</AccessibleButton>
238+
);
239+
headerButtons.push(
240+
<AccessibleButton
241+
className="mx_RightPanel_headerButton mx_RightPanel_notificationbutton" key="_notifsButton"
242+
title={ _t('Notifications') } onClick={ this.onNotificationListButtonClick }>
243+
<div className="mx_RightPanel_headerButton_badge">&nbsp;</div>
244+
<TintableSvg src="img/icons-notifications.svg" width="25" height="25"/>
245+
{ notificationsHighlight }
246+
</AccessibleButton>
247+
);
248+
}
249+
250+
if (this.props.roomId || this.props.groupId) {
251+
// Hiding the right panel hides it completely and relies on an 'expand' button
252+
// being put in the RoomHeader or GroupView header, so only show the minimise
253+
// button on these 2 screens or you won't be able to re-expand the panel.
254+
headerButtons.push(
255+
<div className="mx_RightPanel_headerButton mx_RightPanel_collapsebutton" key="_minimizeButton"
256+
title={ _t("Hide panel") } onClick={ this.onCollapseClick }
257+
>
258+
<TintableSvg src="img/minimise.svg" width="10" height="16"/>
259+
</div>
260+
);
216261
}
217262

218263
if (!this.props.collapsed) {
219-
if(this.props.roomId && this.state.phase == this.Phase.MemberList) {
264+
if (this.props.roomId && this.state.phase == this.Phase.RoomMemberList) {
220265
panel = <MemberList roomId={this.props.roomId} key={this.props.roomId} />
221-
}
222-
else if(this.state.phase == this.Phase.MemberInfo) {
223-
var MemberInfo = sdk.getComponent('rooms.MemberInfo');
266+
} else if (this.props.groupId && this.state.phase == this.Phase.GroupMemberList) {
267+
panel = <GroupMemberList groupId={this.props.groupId} key={this.props.groupId} />;
268+
inviteGroup = (
269+
<AccessibleButton className="mx_RightPanel_invite" onClick={ this.onInviteButtonClick } >
270+
<div className="mx_RightPanel_icon" >
271+
<TintableSvg src="img/icon-invite-people.svg" width="35" height="35" />
272+
</div>
273+
<div className="mx_RightPanel_message">{ _t('Invite to this group') }</div>
274+
</AccessibleButton>
275+
);
276+
} else if (this.state.phase == this.Phase.RoomMemberInfo) {
277+
const MemberInfo = sdk.getComponent('rooms.MemberInfo');
224278
panel = <MemberInfo member={this.state.member} key={this.props.roomId || this.state.member.userId} />
225-
}
226-
else if (this.state.phase == this.Phase.NotificationPanel) {
227-
panel = <NotificationPanel />
228-
}
229-
else if (this.state.phase == this.Phase.FilePanel) {
230-
panel = <FilePanel roomId={this.props.roomId} />
279+
} else if (this.state.phase == this.Phase.GroupMemberInfo) {
280+
const GroupMemberInfo = sdk.getComponent('groups.GroupMemberInfo');
281+
panel = <GroupMemberInfo groupMember={this.state.member} groupId={this.props.groupId} key={this.state.member.user_id} />;
282+
} else if (this.state.phase == this.Phase.NotificationPanel) {
283+
panel = <NotificationPanel />;
284+
} else if (this.state.phase == this.Phase.FilePanel) {
285+
panel = <FilePanel roomId={this.props.roomId} />;
231286
}
232287
}
233288

234289
if (!panel) {
235290
panel = <div className="mx_RightPanel_blank"></div>;
236291
}
237292

238-
var classes = "mx_RightPanel mx_fadable";
293+
let classes = "mx_RightPanel mx_fadable";
239294
if (this.props.collapsed) {
240295
classes += " collapsed";
241296
}
242297

243298
return (
244299
<aside className={classes} style={{ opacity: this.props.opacity }}>
245300
<div className="mx_RightPanel_header">
246-
{ buttonGroup }
301+
<div className="mx_RightPanel_headerButtonGroup">
302+
{headerButtons}
303+
</div>
247304
</div>
248305
{ panel }
249306
<div className="mx_RightPanel_footer">

‎src/components/structures/RoomSubList.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ var RoomSubList = React.createClass({
8888
searchFilter: React.PropTypes.string,
8989
emptyContent: React.PropTypes.node, // content shown if the list is empty
9090
headerItems: React.PropTypes.node, // content shown in the sublist header
91+
extraTiles: React.PropTypes.arrayOf(React.PropTypes.node), // extra elements added beneath tiles
9192
},
9293

9394
getInitialState: function() {
@@ -102,6 +103,7 @@ var RoomSubList = React.createClass({
102103
return {
103104
onHeaderClick: function() {}, // NOP
104105
onShowMoreRooms: function() {}, // NOP
106+
extraTiles: [],
105107
isInvite: false,
106108
};
107109
},
@@ -534,13 +536,14 @@ var RoomSubList = React.createClass({
534536
var label = this.props.collapsed ? null : this.props.label;
535537

536538
let content;
537-
if (this.state.sortedList.length == 0 && !this.props.searchFilter) {
539+
if (this.state.sortedList.length == 0 && !this.props.searchFilter && !this.props.extraTiles) {
538540
content = this.props.emptyContent;
539541
} else {
540542
content = this.makeRoomTiles();
543+
content.push(...this.props.extraTiles);
541544
}
542545

543-
if (this.state.sortedList.length > 0 || this.props.editable) {
546+
if (this.state.sortedList.length > 0 || this.props.extraTiles.length > 0 || this.props.editable) {
544547
var subList;
545548
var classes = "mx_RoomSubList";
546549

‎src/i18n/strings/en_EN.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,6 @@
217217
"Remember, you can always set an email address in user settings if you change your mind.": "Remember, you can always set an email address in user settings if you change your mind.",
218218
"To return to your account in future you need to <u>set a password</u>": "To return to your account in future you need to <u>set a password</u>",
219219
"Set Password": "Set Password",
220-
"Couldn't load home page": "Couldn't load home page"
220+
"Couldn't load home page": "Couldn't load home page",
221+
"Invite to this group": "Invite to this group"
221222
}

‎src/skins/vector/css/_components.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
@import "./matrix-react-sdk/views/elements/_ProgressBar.scss";
3333
@import "./matrix-react-sdk/views/elements/_RichText.scss";
3434
@import "./matrix-react-sdk/views/elements/_RoleButton.scss";
35+
@import "./matrix-react-sdk/views/groups/_GroupInviteTile.scss";
3536
@import "./matrix-react-sdk/views/login/_InteractiveAuthEntryComponents.scss";
3637
@import "./matrix-react-sdk/views/login/_ServerConfig.scss";
3738
@import "./matrix-react-sdk/views/messages/_MEmoteBody.scss";

0 commit comments

Comments
 (0)