parent
557a45e890
commit
11915b0cdf
|
@ -350,7 +350,7 @@ function setWidget(event, roomId) {
|
||||||
content: content,
|
content: content,
|
||||||
sender: client.getUserId(),
|
sender: client.getUserId(),
|
||||||
stateKey: widgetId,
|
stateKey: widgetId,
|
||||||
type: 'im.vector.modular.widgets',
|
type: 'm.widget',
|
||||||
id: widgetId,
|
id: widgetId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -370,6 +370,8 @@ function setWidget(event, roomId) {
|
||||||
if (widgetUrl === null) { // widget is being deleted
|
if (widgetUrl === null) { // widget is being deleted
|
||||||
content = {};
|
content = {};
|
||||||
}
|
}
|
||||||
|
// TODO - Room widgets need to be moved to 'm.widget' state events
|
||||||
|
// https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing
|
||||||
client.sendStateEvent(roomId, "im.vector.modular.widgets", content, widgetId).done(() => {
|
client.sendStateEvent(roomId, "im.vector.modular.widgets", content, widgetId).done(() => {
|
||||||
sendResponse(event, {
|
sendResponse(event, {
|
||||||
success: true,
|
success: true,
|
||||||
|
@ -394,6 +396,8 @@ function getWidgets(event, roomId) {
|
||||||
sendError(event, _t('This room is not recognised.'));
|
sendError(event, _t('This room is not recognised.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO - Room widgets need to be moved to 'm.widget' state events
|
||||||
|
// https://docs.google.com/document/d/1uPF7XWY_dXTKVKV7jZQ2KmsI19wn9-kFRgQ1tFQP7wQ/edit?usp=sharing
|
||||||
const stateEvents = room.currentState.getStateEvents("im.vector.modular.widgets");
|
const stateEvents = room.currentState.getStateEvents("im.vector.modular.widgets");
|
||||||
// Only return widgets which have required fields
|
// Only return widgets which have required fields
|
||||||
if (room) {
|
if (room) {
|
||||||
|
|
|
@ -17,8 +17,8 @@ limitations under the License.
|
||||||
import MatrixClientPeg from './MatrixClientPeg';
|
import MatrixClientPeg from './MatrixClientPeg';
|
||||||
|
|
||||||
export default class WidgetUtils {
|
export default class WidgetUtils {
|
||||||
|
|
||||||
/* Returns true if user is able to send state events to modify widgets in this room
|
/* Returns true if user is able to send state events to modify widgets in this room
|
||||||
|
* (Does not apply to non-room-based / user widgets)
|
||||||
* @param roomId -- The ID of the room to check
|
* @param roomId -- The ID of the room to check
|
||||||
* @return Boolean -- true if the user can modify widgets in this room
|
* @return Boolean -- true if the user can modify widgets in this room
|
||||||
* @throws Error -- specifies the error reason
|
* @throws Error -- specifies the error reason
|
||||||
|
|
|
@ -64,6 +64,7 @@ function getStickerpickerWidgets() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all stickerpicker widgets (stickerpickers are user widgets by nature)
|
* Remove all stickerpicker widgets (stickerpickers are user widgets by nature)
|
||||||
|
* @return {Promise} Resolves on account data updated
|
||||||
*/
|
*/
|
||||||
function removeStickerpickerWidgets() {
|
function removeStickerpickerWidgets() {
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
|
|
Loading…
Reference in New Issue