Add RoomTile online indicator to DMs

This commit is contained in:
Michael Telatynski 2019-12-19 14:29:46 +00:00
parent 513ec30ef1
commit 6c1944359e
3 changed files with 68 additions and 6 deletions

View file

@ -32,6 +32,7 @@ import ActiveRoomObserver from '../../../ActiveRoomObserver';
import RoomViewStore from '../../../stores/RoomViewStore';
import SettingsStore from "../../../settings/SettingsStore";
import {_t} from "../../../languageHandler";
import RoomTileOnlineDot from "./RoomTileOnlineDot";
module.exports = createReactClass({
displayName: 'RoomTile',
@ -68,11 +69,6 @@ module.exports = createReactClass({
});
},
_isDirectMessageRoom: function(roomId) {
const dmRooms = DMRoomMap.shared().getUserIdForRoomId(roomId);
return Boolean(dmRooms);
},
_shouldShowStatusMessage() {
if (!SettingsStore.isFeatureEnabled("feature_custom_status")) {
return false;
@ -371,8 +367,11 @@ module.exports = createReactClass({
let ariaLabel = name;
const dmUserId = DMRoomMap.shared().getUserIdForRoomId(this.props.room.roomId);
let dmIndicator;
if (this._isDirectMessageRoom(this.props.room.roomId)) {
let dmOnline;
if (dmUserId) {
dmIndicator = <img
src={require("../../../../res/img/icon_person.svg")}
className="mx_RoomTile_dm"
@ -380,6 +379,11 @@ module.exports = createReactClass({
height="13"
alt="dm"
/>;
if (this.props.room.getMember(dmUserId).membership === "join") {
const RoomTileOnlineDot = sdk.getComponent('rooms.RoomTileOnlineDot');
dmOnline = <RoomTileOnlineDot userId={dmUserId} />;
}
}
// The following labels are written in such a fashion to increase screen reader efficiency (speed).
@ -428,6 +432,7 @@ module.exports = createReactClass({
{ label }
{ subtextLabel }
</div>
{ dmOnline }
{ contextMenuButton }
{ badge }
</div>