Get user widgets by default (if roomID is not specified).

pull/21833/head
Richard Lewis 2018-03-13 11:58:18 +00:00
parent f820374f9f
commit 7d13edc67a
1 changed files with 8 additions and 10 deletions

View File

@ -624,24 +624,22 @@ const onMessage = function(event) {
const roomId = event.data.room_id; const roomId = event.data.room_id;
const userId = event.data.user_id; const userId = event.data.user_id;
// These APIs don't require roomId if (!roomId) {
// Get and set user widgets (not associated with a specific room) // These APIs don't require roomId
// If roomId is specified, it must be validated, so room-based widgets agreed // Get and set user widgets (not associated with a specific room)
// handled further down. // If roomId is specified, it must be validated, so room-based widgets agreed
if (event.data.userWidget) { // handled further down.
if (event.data.action === "get_widgets") { if (event.data.action === "get_widgets") {
getWidgets(event, null); getWidgets(event, null);
return; return;
} else if (event.data.action === "set_widget") { } else if (event.data.action === "set_widget") {
setWidget(event, null); setWidget(event, null);
return; return;
} else {
sendError(event, _t('Missing room_id in request'));
return;
} }
} }
if (!roomId) {
sendError(event, _t('Missing room_id in request'));
return;
}
let promise = Promise.resolve(currentRoomId); let promise = Promise.resolve(currentRoomId);
if (!currentRoomId) { if (!currentRoomId) {
if (!currentRoomAlias) { if (!currentRoomAlias) {