Skip to content

Commit b978b53

Browse files
committed
Misc cleanup
1 parent 06a06af commit b978b53

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/ClientWidgetApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class ClientWidgetApi extends EventEmitter {
170170
}).then(allowedCaps => {
171171
console.log(`Widget ${this.widget.id} is allowed capabilities:`, Array.from(allowedCaps));
172172
this.allowedCapabilities = allowedCaps;
173-
this.allowedEvents = Array.from(new Set(WidgetEventCapability.findEventCapabilities(allowedCaps)));
173+
this.allowedEvents = WidgetEventCapability.findEventCapabilities(allowedCaps);
174174
this.capabilitiesFinished = true;
175175
this.emit("ready");
176176
});

src/models/WidgetEventCapability.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ export class WidgetEventCapability {
9292

9393
if (direction === null) continue;
9494

95+
// The capability uses `#` as a separator between event type and state key/msgtype,
96+
// so we split on that. However, a # is also valid in either one of those so we
97+
// join accordingly.
98+
// Eg: `m.room.message##m.text` is "m.room.message" event with msgtype "#m.text".
9599
let keyStr: string = null;
96100
if (eventSegment.includes('#')) {
97-
const p = eventSegment.split('#');
98-
eventSegment = p[0];
99-
keyStr = p.slice(1).join('#');
101+
const parts = eventSegment.split('#');
102+
eventSegment = parts[0];
103+
keyStr = parts.slice(1).join('#');
100104
}
101105

102106
parsed.push(new WidgetEventCapability(direction, eventSegment, isState, keyStr, cap));

0 commit comments

Comments
 (0)