Revert "Turn previews on for DMs and ensure they get rendered"
This reverts commit b19ae3ac93
.
pull/21833/head
parent
9d094a793c
commit
945dab6b1f
|
@ -54,7 +54,6 @@ import defaultDispatcher from "../../../dispatcher/dispatcher";
|
||||||
import {ActionPayload} from "../../../dispatcher/payloads";
|
import {ActionPayload} from "../../../dispatcher/payloads";
|
||||||
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
|
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
|
||||||
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
import { NotificationState } from "../../../stores/notifications/NotificationState";
|
||||||
import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
|
||||||
|
|
||||||
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
|
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
|
||||||
|
|
||||||
|
@ -129,7 +128,6 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveRoomObserver.addListener(this.props.room.roomId, this.onActiveRoomUpdate);
|
ActiveRoomObserver.addListener(this.props.room.roomId, this.onActiveRoomUpdate);
|
||||||
MessagePreviewStore.instance.on(UPDATE_EVENT, this.onPreviewUpdated);
|
|
||||||
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,14 +150,9 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
||||||
if (this.props.room) {
|
if (this.props.room) {
|
||||||
ActiveRoomObserver.removeListener(this.props.room.roomId, this.onActiveRoomUpdate);
|
ActiveRoomObserver.removeListener(this.props.room.roomId, this.onActiveRoomUpdate);
|
||||||
}
|
}
|
||||||
MessagePreviewStore.instance.off(UPDATE_EVENT, this.onPreviewUpdated);
|
|
||||||
defaultDispatcher.unregister(this.dispatcherRef);
|
defaultDispatcher.unregister(this.dispatcherRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onPreviewUpdated = () => {
|
|
||||||
this.forceUpdate(); // we don't track the preview in state, so just re-render
|
|
||||||
};
|
|
||||||
|
|
||||||
private onAction = (payload: ActionPayload) => {
|
private onAction = (payload: ActionPayload) => {
|
||||||
if (payload.action === "view_room" && payload.room_id === this.props.room.roomId && payload.show_room_tile) {
|
if (payload.action === "view_room" && payload.room_id === this.props.room.roomId && payload.show_room_tile) {
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
|
|
|
@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DefaultTagID, TagID } from "./models";
|
import { TagID } from "./models";
|
||||||
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
|
|
||||||
|
|
||||||
const TILE_HEIGHT_PX = 44;
|
const TILE_HEIGHT_PX = 44;
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ interface ISerializedListLayout {
|
||||||
|
|
||||||
export class ListLayout {
|
export class ListLayout {
|
||||||
private _n = 0;
|
private _n = 0;
|
||||||
private _previews: boolean | null = null;
|
private _previews = false;
|
||||||
private _collapsed = false;
|
private _collapsed = false;
|
||||||
|
|
||||||
constructor(public readonly tagId: TagID) {
|
constructor(public readonly tagId: TagID) {
|
||||||
|
@ -51,12 +50,7 @@ export class ListLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get showPreviews(): boolean {
|
public get showPreviews(): boolean {
|
||||||
if (!isNullOrUndefined(this._previews)) {
|
return this._previews;
|
||||||
return this._previews;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn it on for DMs by default, but not for other rooms
|
|
||||||
return this.tagId === DefaultTagID.DM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public set showPreviews(v: boolean) {
|
public set showPreviews(v: boolean) {
|
||||||
|
|
Loading…
Reference in New Issue