message: Fix: dont show 1:1 avatar for room with only 2 members loaded
diff: @@ -19,6 +19,7 @@ import {ContentRepo} from "matrix-js-sdk";
  import MatrixClientPeg from "../../../MatrixClientPeg";
  import Modal from '../../../Modal';
  import sdk from "../../../index";
  +import DMRoomMap from '../../../utils/DMRoomMap';
  module.exports = React.createClass({
  displayName: 'RoomAvatar',
  @@ -109,56 +110,21 @@ module.exports = React.createClass({
  getOneToOneAvatar: function(props) {
  if (!props.room) return null;
  - const mlist = props.room.currentState.members;
  - const userIds = [];
  - const leftUserIds = [];
  - // for .. in optimisation to return early if there are >2 keys
  - for (const uid in mlist) {
  - if (mlist.hasOwnProperty(uid)) {
  - if (["join", "invite"].includes(mlist[uid].membership)) {
  - userIds.push(uid);
  - } else {
  - leftUserIds.push(uid);
  - }
  - }
  - if (userIds.length > 2) {
  + const otherUserId = DMRoomMap.shared().getUserIdForRoomId(props.room.roomId);
  + if (!otherUserId) {
  return null;
  }
  + const otherMember = props.room.getMember(otherUserId);
  + if (!otherMember) {
  + return null;
  }
  -
  - if (userIds.length == 2) {
  - let theOtherGuy = null;
  - if (mlist[userIds[0]].userId == MatrixClientPeg.get().credentials.userId) {
  - theOtherGuy = mlist[userIds[1]];
  - } else {
  - theOtherGuy = mlist[userIds[0]];
  - }
  - return theOtherGuy.getAvatarUrl(
  - MatrixClientPeg.get().getHomeserverUrl(),
  - Math.floor(props.width * window.devicePixelRatio),
  - Math.floor(props.height * window.devicePixelRatio),
  - props.resizeMethod,
  - false,
  - );
  - } else if (userIds.length == 1) {
  - // The other 1-1 user left, leaving just the current user, so show the left user's avatar
  - if (leftUserIds.length === 1) {
  - return mlist[leftUserIds[0]].getAvatarUrl(
  - MatrixClientPeg.get().getHomeserverUrl(),
  - props.width, props.height, props.resizeMethod,
  - false,
  - );
  - }
  - return mlist[userIds[0]].getAvatarUrl(
  + return otherMember.getAvatarUrl(
  MatrixClientPeg.get().getHomeserverUrl(),
  Math.floor(props.width * window.devicePixelRatio),
  Math.floor(props.height * window.devicePixelRatio),
  props.resizeMethod,
  false,
  );
  - } else {
  - return null;
  - }
  },
  onRoomAvatarClick: function() {
  