Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix ability to feature self in a group summary #1430

Merged
merged 2 commits into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/structures/GroupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ const RoleUserList = React.createClass({
button: _t("Add to summary"),
validAddressTypes: ['mx'],
groupId: this.props.groupId,
shouldOmitSelf: false,
onFinished: (success, addrs) => {
if (!success) return;
const errorList = [];
Expand Down
9 changes: 8 additions & 1 deletion src/components/views/dialogs/AddressPickerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ module.exports = React.createClass({
validAddressTypes: PropTypes.arrayOf(PropTypes.oneOf(addressTypes)),
onFinished: PropTypes.func.isRequired,
groupId: PropTypes.string,
// The type of entity to search for. Default: 'user'.
pickerType: PropTypes.oneOf(['user', 'room']),
// Whether the current user should be included in the addresses returned. Only
// applicable when pickerType is `user`. Default: false.
includeSelf: PropTypes.bool,
},

getDefaultProps: function() {
Expand All @@ -50,6 +54,7 @@ module.exports = React.createClass({
focus: true,
validAddressTypes: addressTypes,
pickerType: 'user',
includeSelf: false,
};
},

Expand Down Expand Up @@ -366,7 +371,9 @@ module.exports = React.createClass({
});
return;
}
if (result.user_id === MatrixClientPeg.get().credentials.userId) {
if (!this.props.includeSelf &&
result.user_id === MatrixClientPeg.get().credentials.userId
) {
return;
}

Expand Down