Change argument order of setRoomWidget
So when deleting a widget we can just omit the ones we don't need
This commit is contained in:
parent
a88297d7a6
commit
c780cd05a8
4 changed files with 6 additions and 10 deletions
src
|
@ -458,7 +458,7 @@ function _startCallApp(roomId, type) {
|
||||||
Date.now()
|
Date.now()
|
||||||
);
|
);
|
||||||
|
|
||||||
WidgetUtils.setRoomWidget(widgetId, 'jitsi', widgetUrl, 'Jitsi', widgetData, roomId).then(() => {
|
WidgetUtils.setRoomWidget(roomId, widgetId, 'jitsi', widgetUrl, 'Jitsi', widgetData).then(() => {
|
||||||
console.log('Jitsi widget added');
|
console.log('Jitsi widget added');
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
@ -336,7 +336,7 @@ function setWidget(event, roomId) {
|
||||||
if (!roomId) {
|
if (!roomId) {
|
||||||
sendError(event, _t('Missing roomId.'), null);
|
sendError(event, _t('Missing roomId.'), null);
|
||||||
}
|
}
|
||||||
WidgetUtils.setRoomWidget(widgetId, widgetType, widgetUrl, widgetName, widgetData, roomId).then(() => {
|
WidgetUtils.setRoomWidget(roomId, widgetId, widgetType, widgetUrl, widgetName, widgetData).then(() => {
|
||||||
sendResponse(event, {
|
sendResponse(event, {
|
||||||
success: true,
|
success: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -321,12 +321,8 @@ export default class AppTile extends React.Component {
|
||||||
this.setState({deleting: true});
|
this.setState({deleting: true});
|
||||||
|
|
||||||
WidgetUtils.setRoomWidget(
|
WidgetUtils.setRoomWidget(
|
||||||
this.props.id,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
this.props.room.roomId,
|
this.props.room.roomId,
|
||||||
|
this.props.id,
|
||||||
).catch((e) => {
|
).catch((e) => {
|
||||||
console.error('Failed to delete widget', e);
|
console.error('Failed to delete widget', e);
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
|
|
@ -210,7 +210,7 @@ export default class WidgetUtils {
|
||||||
console.error(`$widgetId is non-configurable`);
|
console.error(`$widgetId is non-configurable`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const addingWidget = widgetUrl !== null;
|
const addingWidget = Boolean(widgetUrl);
|
||||||
|
|
||||||
// Add new widget / update
|
// Add new widget / update
|
||||||
if (addingWidget) {
|
if (addingWidget) {
|
||||||
|
@ -234,10 +234,10 @@ export default class WidgetUtils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static setRoomWidget(widgetId, widgetType, widgetUrl, widgetName, widgetData, roomId) {
|
static setRoomWidget(roomId, widgetId, widgetType, widgetUrl, widgetName, widgetData) {
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
const addingWidget = widgetUrl !== null;
|
const addingWidget = Boolean(widgetUrl);
|
||||||
|
|
||||||
if (addingWidget) {
|
if (addingWidget) {
|
||||||
content = {
|
content = {
|
||||||
|
|
Loading…
Reference in a new issue