mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
706981688a
2 changed files with 20 additions and 2 deletions
|
@ -303,6 +303,15 @@ module.exports = React.createClass({
|
||||||
_shouldShowApps: function(room) {
|
_shouldShowApps: function(room) {
|
||||||
if (!BROWSER_SUPPORTS_SANDBOX) return false;
|
if (!BROWSER_SUPPORTS_SANDBOX) return false;
|
||||||
|
|
||||||
|
// Check if user has previously chosen to hide the app drawer for this
|
||||||
|
// room. If so, do not show apps
|
||||||
|
let hideWidgetDrawer = localStorage.getItem(
|
||||||
|
room.roomId + "_hide_widget_drawer");
|
||||||
|
|
||||||
|
if (hideWidgetDrawer === "true") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
|
||||||
// any valid widget = show apps
|
// any valid widget = show apps
|
||||||
for (let i = 0; i < appsStateEvents.length; i++) {
|
for (let i = 0; i < appsStateEvents.length; i++) {
|
||||||
|
|
|
@ -81,16 +81,25 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onAction: function(action) {
|
onAction: function(action) {
|
||||||
|
const hideWidgetKey = this.props.room.roomId + "_hide_widget_drawer";
|
||||||
switch (action.action) {
|
switch (action.action) {
|
||||||
case 'appsDrawer':
|
case 'appsDrawer':
|
||||||
// When opening the app draw when there aren't any apps, auto-launch the
|
// When opening the app drawer when there aren't any apps,
|
||||||
// integrations manager to skip the awkward click on "Add widget"
|
// auto-launch the integrations manager to skip the awkward
|
||||||
|
// click on "Add widget"
|
||||||
if (action.show) {
|
if (action.show) {
|
||||||
const apps = this._getApps();
|
const apps = this._getApps();
|
||||||
if (apps.length === 0) {
|
if (apps.length === 0) {
|
||||||
this._launchManageIntegrations();
|
this._launchManageIntegrations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
localStorage.removeItem(hideWidgetKey);
|
||||||
|
} else {
|
||||||
|
// Store hidden state of widget
|
||||||
|
// Don't show if previously hidden
|
||||||
|
localStorage.setItem(hideWidgetKey, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue