commit
11fd9e1c0f
6 changed files with 14 additions and 7 deletions
|
@ -36,23 +36,25 @@ const Element: LinkedClient = {
|
|||
experimental: false,
|
||||
clientId: ClientId.Element,
|
||||
toUrl: (link) => {
|
||||
const params = link.arguments.originalParams.toString();
|
||||
const prefixedParams = params ? `?${params}` : '';
|
||||
switch (link.kind) {
|
||||
case LinkKind.Alias:
|
||||
case LinkKind.RoomId:
|
||||
return new URL(
|
||||
`https://app.element.io/#/room/${link.identifier}`
|
||||
`https://app.element.io/#/room/${link.identifier}${prefixedParams}`
|
||||
);
|
||||
case LinkKind.UserId:
|
||||
return new URL(
|
||||
`https://app.element.io/#/user/${link.identifier}`
|
||||
`https://app.element.io/#/user/${link.identifier}${prefixedParams}`
|
||||
);
|
||||
case LinkKind.Permalink:
|
||||
return new URL(
|
||||
`https://app.element.io/#/room/${link.identifier}`
|
||||
`https://app.element.io/#/room/${link.identifier}${prefixedParams}`
|
||||
);
|
||||
case LinkKind.GroupId:
|
||||
return new URL(
|
||||
`https://app.element.io/#/group/${link.identifier}`
|
||||
`https://app.element.io/#/group/${link.identifier}${prefixedParams}`
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ export const Default: React.FC = () => (
|
|||
<HomeserverOptions
|
||||
link={{
|
||||
identifier: '#banter:matrix.org',
|
||||
arguments: { vias: [] },
|
||||
arguments: { vias: [], originalParams: new URLSearchParams() },
|
||||
kind: LinkKind.Alias,
|
||||
originalLink: 'This is all made up',
|
||||
}}
|
||||
|
|
|
@ -42,6 +42,7 @@ const userLink: SafeLink = {
|
|||
identifier: '@jorik:matrix.org',
|
||||
arguments: {
|
||||
vias: [],
|
||||
originalParams: new URLSearchParams(),
|
||||
},
|
||||
originalLink: 'asdfsadf',
|
||||
};
|
||||
|
@ -51,6 +52,7 @@ const roomLink: SafeLink = {
|
|||
identifier: '#element-dev:matrix.org',
|
||||
arguments: {
|
||||
vias: [],
|
||||
originalParams: new URLSearchParams(),
|
||||
},
|
||||
originalLink: 'asdfsadf',
|
||||
};
|
||||
|
|
|
@ -169,7 +169,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
|
|||
link={{
|
||||
kind: LinkKind.UserId,
|
||||
identifier: link.arguments.sharer,
|
||||
arguments: { vias: [] },
|
||||
arguments: { vias: [], originalParams: new URLSearchParams() },
|
||||
originalLink: '',
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -92,6 +92,7 @@ export function parseArgs(args: string): Arguments {
|
|||
vias: params.getAll('via'),
|
||||
client: bottomExchange(params.get('client')),
|
||||
sharer: bottomExchange(params.get('sharer')),
|
||||
originalParams: params,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ export interface Arguments {
|
|||
client?: string;
|
||||
// MXID
|
||||
sharer?: string;
|
||||
// Original params
|
||||
originalParams: URLSearchParams;
|
||||
}
|
||||
|
||||
export interface LinkContent {
|
||||
|
|
Loading…
Reference in a new issue