You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Ensure widgets always have a sender associated with them
Fixes https://github.com/vector-im/riot-web/issues/11419
This commit is contained in:
@@ -400,7 +400,7 @@ export default class WidgetUtils {
|
||||
return client.setAccountData('m.widgets', userWidgets);
|
||||
}
|
||||
|
||||
static makeAppConfig(appId, app, sender, roomId) {
|
||||
static makeAppConfig(appId, app, senderUserId, roomId) {
|
||||
const myUserId = MatrixClientPeg.get().credentials.userId;
|
||||
const user = MatrixClientPeg.get().getUser(myUserId);
|
||||
const params = {
|
||||
@@ -413,6 +413,11 @@ export default class WidgetUtils {
|
||||
'$theme': SettingsStore.getValue("theme"),
|
||||
};
|
||||
|
||||
if (!senderUserId) {
|
||||
throw new Error("Widgets must be created by someone - provide a senderUserId");
|
||||
}
|
||||
app.creatorUserId = senderUserId;
|
||||
|
||||
app.id = appId;
|
||||
app.name = app.name || app.type;
|
||||
|
||||
@@ -425,7 +430,6 @@ export default class WidgetUtils {
|
||||
}
|
||||
|
||||
app.url = encodeUri(app.url, params);
|
||||
app.creatorUserId = (sender && sender.userId) ? sender.userId : null;
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user