mirror of https://github.com/vector-im/riot-web
Add users to group summary using new API
parent
44c38652ab
commit
1c1bf82c2a
|
@ -133,13 +133,6 @@ const RoleUserList = React.createClass({
|
||||||
groupId: PropTypes.string.isRequired,
|
groupId: PropTypes.string.isRequired,
|
||||||
},
|
},
|
||||||
|
|
||||||
onUsersSelected: function(addrs) {
|
|
||||||
addrs.forEach((addr) => {
|
|
||||||
// const userId = addr.address;
|
|
||||||
// TODO: Add user to the group via API hit
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onAddUsersClicked: function(ev) {
|
onAddUsersClicked: function(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const UserPickerDialog = sdk.getComponent("dialogs.UserPickerDialog");
|
const UserPickerDialog = sdk.getComponent("dialogs.UserPickerDialog");
|
||||||
|
@ -152,8 +145,10 @@ const RoleUserList = React.createClass({
|
||||||
groupId: this.props.groupId,
|
groupId: this.props.groupId,
|
||||||
onFinished: (success, addrs) => {
|
onFinished: (success, addrs) => {
|
||||||
if (!success) return;
|
if (!success) return;
|
||||||
|
addrs.map((addr) => {
|
||||||
this.onUsersSelected(addrs);
|
return MatrixClientPeg.get()
|
||||||
|
.addUserToGroupSummary(this.props.groupId, addr.address);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -195,7 +195,14 @@ module.exports = React.createClass({
|
||||||
searchError: null,
|
searchError: null,
|
||||||
});
|
});
|
||||||
MatrixClientPeg.get().getGroupUsers(this.props.groupId).then((resp) => {
|
MatrixClientPeg.get().getGroupUsers(this.props.groupId).then((resp) => {
|
||||||
this._processResults(resp.chunk, query);
|
const results = resp.chunk.map((u) => {
|
||||||
|
return {
|
||||||
|
user_id: u.user_id,
|
||||||
|
avatar_url: u.avatar_url,
|
||||||
|
display_name: u.displayname,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
this._processResults(results, query);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('Error whilst searching user directory: ', err);
|
console.error('Error whilst searching user directory: ', err);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
Loading…
Reference in New Issue