Merge pull request #1430 from matrix-org/luke/groups-fix-feature-self

Fix ability to feature self in a group summary
This commit is contained in:
Luke Barnard 2017-09-27 14:43:50 +01:00 committed by GitHub
commit 3d30cc3733
2 changed files with 9 additions and 1 deletions

View file

@ -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 = [];

View file

@ -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() {
@ -50,6 +54,7 @@ module.exports = React.createClass({
focus: true,
validAddressTypes: addressTypes,
pickerType: 'user',
includeSelf: false,
};
},
@ -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;
}