allow filtering Group Invite Tiles with the same search filter
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4e216714b5
commit
1346f47a12
1 changed files with 9 additions and 4 deletions
|
@ -583,13 +583,18 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeGroupInviteTiles() {
|
_makeGroupInviteTiles(filter) {
|
||||||
const ret = [];
|
const ret = [];
|
||||||
|
const lcFilter = filter && filter.toLowerCase();
|
||||||
|
|
||||||
const GroupInviteTile = sdk.getComponent('groups.GroupInviteTile');
|
const GroupInviteTile = sdk.getComponent('groups.GroupInviteTile');
|
||||||
for (const group of MatrixClientPeg.get().getGroups()) {
|
for (const group of MatrixClientPeg.get().getGroups()) {
|
||||||
if (group.myMembership !== 'invite') continue;
|
const {groupId: id, name, myMembership: membership} = group;
|
||||||
ret.push(<GroupInviteTile key={group.groupId} group={group} collapsed={this.props.collapsed} />);
|
// filter to only groups in invite state and group_id starts with filter or group name includes it
|
||||||
|
if (membership !== 'invite') continue;
|
||||||
|
if (lcFilter && !id.toLowerCase().startsWith(lcFilter) &&
|
||||||
|
!(name && name.toLowerCase().includes(lcFilter))) continue;
|
||||||
|
ret.push(<GroupInviteTile key={id} group={group} collapsed={this.props.collapsed} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -609,7 +614,7 @@ module.exports = React.createClass({
|
||||||
autoshow={true} onScroll={self._whenScrolling} wrappedRef={this._collectGemini}>
|
autoshow={true} onScroll={self._whenScrolling} wrappedRef={this._collectGemini}>
|
||||||
<div className="mx_RoomList">
|
<div className="mx_RoomList">
|
||||||
<RoomSubList list={[]}
|
<RoomSubList list={[]}
|
||||||
extraTiles={this._makeGroupInviteTiles()}
|
extraTiles={this._makeGroupInviteTiles(self.props.searchFilter)}
|
||||||
label={_t('Community Invites')}
|
label={_t('Community Invites')}
|
||||||
editable={false}
|
editable={false}
|
||||||
order="recent"
|
order="recent"
|
||||||
|
|
Loading…
Reference in a new issue