Don't try show saved thread panel state if threads is disabled (#8203)

This commit is contained in:
Michael Telatynski 2022-03-31 13:23:03 +01:00 committed by GitHub
parent 4922e19b5a
commit 90527316cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,6 +249,9 @@ export default class RightPanelStore extends ReadyWatchingStore {
private filterValidCards(rightPanelForRoom?: IRightPanelForRoom) {
if (!rightPanelForRoom?.history) return;
rightPanelForRoom.history = rightPanelForRoom.history.filter((card) => this.isCardStateValid(card));
if (!rightPanelForRoom.history.length) {
rightPanelForRoom.isOpen = false;
}
}
private isCardStateValid(card: IRightPanelCard) {
@ -259,7 +262,11 @@ export default class RightPanelStore extends ReadyWatchingStore {
// or potentially other errors.
// (A nicer fix could be to indicate, that the right panel is loading if there is missing state data and re-emit if the data is available)
switch (card.phase) {
case RightPanelPhases.ThreadPanel:
if (!SettingsStore.getValue("feature_thread")) return false;
break;
case RightPanelPhases.ThreadView:
if (!SettingsStore.getValue("feature_thread")) return false;
if (!card.state.threadHeadEvent) {
console.warn("removed card from right panel because of missing threadHeadEvent in card state");
}