message: Fix logic around MemberList invites section, specifically regarding 3pid
diff: @@ -392,33 +392,20 @@ module.exports = React.createClass({
  }
  },
  - _makeMemberTiles: function(members, membership) {
  + _makeMemberTiles: function(members) {
  const MemberTile = sdk.getComponent("rooms.MemberTile");
  -
  - const memberList = members.map((m) => {
  - return (
  - <MemberTile key={m.userId} member={m} ref={m.userId} showPresence={this._showPresence} />
  - );
  - });
  -
  - // XXX: surely this is not the right home for this logic.
  - // Double XXX: Now it's really, really not the right home for this logic:
  - // we shouldn't even be passing in the 'membership' param to this function.
  - // Ew, ew, and ew.
  - // Triple XXX: This violates the size constraint, the output is expected/desired
  - // to be the same length as the members input array.
  - if (membership === "invite") {
  const EntityTile = sdk.getComponent("rooms.EntityTile");
  - memberList.push(...this._getPending3PidInvites().map((e) => {
  - return <EntityTile key={e.getStateKey()}
  - name={e.getContent().display_name}
  - suppressOnHover={true}
  - onClick={() => this._onPending3pidInviteClick(e)}
  - />;
  - }));
  - }
  - return memberList;
  + return members.map((m) => {
  + if (m.userId) {
  + // Is a Matrix invite
  + return <MemberTile key={m.userId} member={m} ref={m.userId} showPresence={this._showPresence} />;
  + } else {
  + // Is a 3pid invite
  + return <EntityTile key={m.getStateKey()} name={m.getContent().display_name} suppressOnHover={true}
  + onClick={() => this._onPending3pidInviteClick(m)} />;
  + }
  + });
  },
  _getChildrenJoined: function(start, end) {
  @@ -430,7 +417,12 @@ module.exports = React.createClass({
  },
  _getChildrenInvited: function(start, end) {
  - return this._makeMemberTiles(this.state.filteredInvitedMembers.slice(start, end), 'invite');
  + let targets = this.state.filteredInvitedMembers;
  + if (end > this.state.filteredInvitedMembers.length) {
  + targets = targets.concat(this._getPending3PidInvites());
  + }
  +
  + return this._makeMemberTiles(targets.slice(start, end));
  },
  _getChildCountInvited: function() {
  