Merge pull request #4378 from matrix-org/travis/expanding-widgets
Minimize widgets by defaultpull/21833/head
commit
36fea4d487
|
@ -49,7 +49,6 @@ import RoomViewStore from '../../stores/RoomViewStore';
|
||||||
import RoomScrollStateStore from '../../stores/RoomScrollStateStore';
|
import RoomScrollStateStore from '../../stores/RoomScrollStateStore';
|
||||||
import WidgetEchoStore from '../../stores/WidgetEchoStore';
|
import WidgetEchoStore from '../../stores/WidgetEchoStore';
|
||||||
import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "../../settings/SettingsStore";
|
||||||
import WidgetUtils from '../../utils/WidgetUtils';
|
|
||||||
import AccessibleButton from "../views/elements/AccessibleButton";
|
import AccessibleButton from "../views/elements/AccessibleButton";
|
||||||
import RightPanelStore from "../../stores/RightPanelStore";
|
import RightPanelStore from "../../stores/RightPanelStore";
|
||||||
import {haveTileForEvent} from "../views/rooms/EventTile";
|
import {haveTileForEvent} from "../views/rooms/EventTile";
|
||||||
|
@ -406,13 +405,9 @@ export default createReactClass({
|
||||||
const hideWidgetDrawer = localStorage.getItem(
|
const hideWidgetDrawer = localStorage.getItem(
|
||||||
room.roomId + "_hide_widget_drawer");
|
room.roomId + "_hide_widget_drawer");
|
||||||
|
|
||||||
if (hideWidgetDrawer === "true") {
|
// This is confusing, but it means to say that we default to the tray being
|
||||||
return false;
|
// hidden unless the user clicked to open it.
|
||||||
}
|
return hideWidgetDrawer === "false";
|
||||||
|
|
||||||
const widgets = WidgetEchoStore.getEchoedRoomWidgets(room.roomId, WidgetUtils.getRoomWidgets(room));
|
|
||||||
|
|
||||||
return widgets.length > 0 || WidgetEchoStore.roomHasPendingWidgets(room.roomId, WidgetUtils.getRoomWidgets(room));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
|
|
@ -81,12 +81,14 @@ export default createReactClass({
|
||||||
const hideWidgetKey = this.props.room.roomId + '_hide_widget_drawer';
|
const hideWidgetKey = this.props.room.roomId + '_hide_widget_drawer';
|
||||||
switch (action.action) {
|
switch (action.action) {
|
||||||
case 'appsDrawer':
|
case 'appsDrawer':
|
||||||
|
// Note: these booleans are awkward because localstorage is fundamentally
|
||||||
|
// string-based. We also do exact equality on the strings later on.
|
||||||
if (action.show) {
|
if (action.show) {
|
||||||
localStorage.removeItem(hideWidgetKey);
|
localStorage.setItem(hideWidgetKey, "false");
|
||||||
} else {
|
} else {
|
||||||
// Store hidden state of widget
|
// Store hidden state of widget
|
||||||
// Don't show if previously hidden
|
// Don't show if previously hidden
|
||||||
localStorage.setItem(hideWidgetKey, true);
|
localStorage.setItem(hideWidgetKey, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue