aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-09-10 15:19:58 +0300
committerTulir Asokan <tulir@maunium.net>2020-09-10 15:19:58 +0300
commitdf75622fdacbae6a412e6ca384c0db5da069ae55 (patch)
treeea6a582e43db93e499d608c36acf8a003b456a7f
parent89861f8a2cae4ae9489cfc3fe2826c1e21d9b4db (diff)
Send empty response to visibility action
-rw-r--r--web/widget-api.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/web/widget-api.js b/web/widget-api.js
index 8787262..3efca0e 100644
--- a/web/widget-api.js
+++ b/web/widget-api.js
@@ -23,19 +23,22 @@ window.onmessage = event => {
widgetId = request.widgetId
}
- window.parent.postMessage({
- ...request,
- response: request.action === "capabilities" ? {
- capabilities: ["m.sticker"],
- } : {
- error: { message: "Action not supported" },
- },
- }, event.origin)
+ let response
+
+ if (request.action === "visibility") {
+ response = {}
+ } else if (request.action === "capabilities") {
+ response = { capabilities: ["m.sticker"] }
+ } else {
+ response = { error: { message: "Action not supported" } }
+ }
+
+ window.parent.postMessage({ ...request, response }, event.origin)
}
export function sendSticker(content) {
const data = {
- content: {...content},
+ content: { ...content },
// `name` is for Element Web (and also the spec)
// Element Android uses content -> body as the name
name: content.body,
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage