mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-07-19 17:31:58 +00:00
Don't replace sticker picker unless we have to
This commit is contained in:
parent
77d652d6c0
commit
a3952a880c
|
@ -90,11 +90,18 @@ export class StickerpickerComponent implements OnInit {
|
||||||
const stickerPicker = widgets.response.find(w => w.content && w.content.type === "m.stickerpicker");
|
const stickerPicker = widgets.response.find(w => w.content && w.content.type === "m.stickerpicker");
|
||||||
const widgetId = stickerPicker ? ((<any>stickerPicker).id || stickerPicker.state_key) : "dimension-stickerpicker-" + (new Date().getTime());
|
const widgetId = stickerPicker ? ((<any>stickerPicker).id || stickerPicker.state_key) : "dimension-stickerpicker-" + (new Date().getTime());
|
||||||
|
|
||||||
|
const targetUrl = this.window.location.origin + "/widgets/stickerpicker";
|
||||||
|
|
||||||
|
if (widgets.response[0].content.url === targetUrl) {
|
||||||
|
console.warn("Not replacing Dimension sticker picker");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Force-setting new widget of ID " + widgetId);
|
console.log("Force-setting new widget of ID " + widgetId);
|
||||||
await this.scalarClient.setUserWidget({
|
await this.scalarClient.setUserWidget({
|
||||||
id: widgetId,
|
id: widgetId,
|
||||||
type: WIDGET_STICKER_PICKER[0],
|
type: WIDGET_STICKER_PICKER[0],
|
||||||
url: this.window.location.origin + "/widgets/stickerpicker",
|
url: targetUrl,
|
||||||
data: {
|
data: {
|
||||||
dimension: {
|
dimension: {
|
||||||
wrapperId: "stickerpicker",
|
wrapperId: "stickerpicker",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user