mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Fix ?via= args in SpecPermalinkConstructor.js
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
a17df6dd38
commit
857f086501
1 changed files with 6 additions and 8 deletions
|
@ -73,18 +73,16 @@ export default class SpecPermalinkConstructor extends PermalinkConstructor {
|
||||||
// Probably a group, no further parsing needed.
|
// Probably a group, no further parsing needed.
|
||||||
return PermalinkParts.forGroup(entity);
|
return PermalinkParts.forGroup(entity);
|
||||||
} else if (entity[0] === '#' || entity[0] === '!') {
|
} else if (entity[0] === '#' || entity[0] === '!') {
|
||||||
if (parts.length === 1) {
|
if (parts.length === 1) { // room without event permalink
|
||||||
return PermalinkParts.forRoom(entity, []);
|
const [roomId, query=""] = entity.split("?");
|
||||||
|
const via = query.split(/&?via=/g).filter(p => !!p);
|
||||||
|
return PermalinkParts.forRoom(roomId, via);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rejoin the rest because v3 events can have slashes (annoyingly)
|
// rejoin the rest because v3 events can have slashes (annoyingly)
|
||||||
const eventIdAndQuery = parts.length > 1 ? parts.slice(1).join('/') : "";
|
const eventIdAndQuery = parts.length > 1 ? parts.slice(1).join('/') : "";
|
||||||
const secondaryParts = eventIdAndQuery.split("?");
|
const [eventId, query=""] = eventIdAndQuery.split("?");
|
||||||
|
const via = query.split(/&?via=/g).filter(p => !!p);
|
||||||
const eventId = secondaryParts[0];
|
|
||||||
const query = secondaryParts.length > 1 ? secondaryParts[1] : "";
|
|
||||||
|
|
||||||
const via = query.split("via=").filter(p => !!p);
|
|
||||||
|
|
||||||
return PermalinkParts.forEvent(entity, eventId, via);
|
return PermalinkParts.forEvent(entity, eventId, via);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue