-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mentions shouldn't follow permalink_prefix
#26002
Closed
Labels
A-Pills
O-Uncommon
Most users are unlikely to come across this or unexpected workflow
S-Minor
Impairs non-critical functionality or suitable workarounds exist
T-Defect
Comments
Trying to give it a shot at fixing. First attempt, no effect:diff --git a/src/autocomplete/UserProvider.tsx b/src/autocomplete/UserProvider.tsx
index a934e9309a..a41b6ccbae 100644
--- a/src/autocomplete/UserProvider.tsx
+++ b/src/autocomplete/UserProvider.tsx
@@ -132,7 +132,7 @@ export default class UserProvider extends AutocompleteProvider {
completionId: user.userId,
type: "user",
suffix: selection.beginning && range!.start === 0 ? ": " : " ",
- href: makeUserPermalink(user.userId),
+ href: makeUserPermalink(user.userId, true),
component: (
<PillCompletion title={displayName} description={description}>
<MemberAvatar member={user} width={24} height={24} />
diff --git a/src/utils/permalinks/Permalinks.ts b/src/utils/permalinks/Permalinks.ts
index 1a55b8408e..2629996d0c 100644
--- a/src/utils/permalinks/Permalinks.ts
+++ b/src/utils/permalinks/Permalinks.ts
@@ -273,8 +273,8 @@ export function makeGenericPermalink(entityId: string): string {
return getPermalinkConstructor().forEntity(entityId);
}
-export function makeUserPermalink(userId: string): string {
- return getPermalinkConstructor().forUser(userId);
+export function makeUserPermalink(userId: string, isMention: boolean = false): string {
+ return getPermalinkConstructor(isMention).forUser(userId);
}
export function makeRoomPermalink(matrixClient: MatrixClient, roomId: string): string {
@@ -409,9 +409,9 @@ export function getPrimaryPermalinkEntity(permalink: string): string | null {
return null;
}
-function getPermalinkConstructor(): PermalinkConstructor {
+function getPermalinkConstructor(forceMatrixTo: boolean = false): PermalinkConstructor {
const elementPrefix = SdkConfig.get("permalink_prefix");
- if (elementPrefix && elementPrefix !== matrixtoBaseUrl) {
+ if (!forceMatrixTo && elementPrefix && elementPrefix !== matrixtoBaseUrl) {
return new ElementPermalinkConstructor(elementPrefix);
} |
weeman1337
added
S-Minor
Impairs non-critical functionality or suitable workarounds exist
O-Uncommon
Most users are unlikely to come across this or unexpected workflow
A-Pills
labels
Aug 22, 2023
herkulessi
pushed a commit
to herkulessi/matrix-react-sdk
that referenced
this issue
Oct 3, 2023
fixes element-hq/element-web/issues/26002 During serialization of messages, pills were wrongfully serialized to a URL starting with `permalink_prefix`. This is against the Spec (which mandates https://matrix.to/#/ links) and the resulting pills were not recognized as pills in other clients. [Spec-Appendendix concerning matrix.to link](https://spec.matrix.org/v1.8/appendices/#matrixto-navigation)
herkulessi
pushed a commit
to herkulessi/matrix-react-sdk
that referenced
this issue
Oct 3, 2023
fixes element-hq/element-web/issues/26002 During serialization of messages, pills were wrongfully serialized to a URL starting with `permalink_prefix`. This is against the Spec (which mandates https://matrix.to/#/ links) and the resulting pills were not recognized as pills in other clients. Spec-Appendix concerning matrix.to links: https://spec.matrix.org/v1.8/appendices/#matrixto-navigation
herkulessi
pushed a commit
to herkulessi/matrix-react-sdk
that referenced
this issue
Oct 9, 2023
fixes element-hq/element-web/issues/26002 During serialization of messages, pills were wrongfully serialized to a URL starting with `permalink_prefix`. This is against the Spec (which mandates https://matrix.to/#/ links) and the resulting pills were not recognized as pills in other clients. Spec-Appendix concerning matrix.to links: https://spec.matrix.org/v1.8/appendices/#matrixto-navigation Signed-off-by: Lars Wickel <[email protected]>
This was referenced Oct 9, 2023
herkulessi
pushed a commit
to herkulessi/matrix-react-sdk
that referenced
this issue
Jun 8, 2024
fixes element-hq/element-web/issues/26002 During serialization of messages, pills were wrongfully serialized to a URL starting with `permalink_prefix`. This is against the Spec (which mandates https://matrix.to/#/ links) and the resulting pills were not recognized as pills in other clients. Spec-Appendix concerning matrix.to links: https://spec.matrix.org/v1.8/appendices/#matrixto-navigation Signed-off-by: Lars Wickel <[email protected]>
github-merge-queue bot
pushed a commit
to matrix-org/matrix-react-sdk
that referenced
this issue
Aug 1, 2024
* Ignore permalink_prefix when serializing Markdown fixes element-hq/element-web/issues/26002 During serialization of messages, pills were wrongfully serialized to a URL starting with `permalink_prefix`. This is against the Spec (which mandates https://matrix.to/#/ links) and the resulting pills were not recognized as pills in other clients. Spec-Appendix concerning matrix.to links: https://spec.matrix.org/v1.8/appendices/#matrixto-navigation Signed-off-by: Lars Wickel <[email protected]> * Test for pill serialization with permalink_prefix set Signed-off-by: Lars Wickel <[email protected]> * Test that permalink_prefix is used for permalink creation Signed-off-by: Lars Wickel <[email protected]> * Fix lint issues introduced Signed-off-by: Lars Wickel <[email protected]> * Incorporate requested changes Signed-off-by: Lars Wickel <[email protected]> --------- Signed-off-by: Lars Wickel <[email protected]> Co-authored-by: herkulessi <[email protected]> Co-authored-by: David Baker <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Pills
O-Uncommon
Most users are unlikely to come across this or unexpected workflow
S-Minor
Impairs non-critical functionality or suitable workarounds exist
T-Defect
Steps to reproduce
permalink_prefix
inconfig.json
to the URL where your Element webapp is hosted.Outcome
What did you expect?
Inline mentions should be Matrix URIs (i.e.
matrix.to
ormatrix://
) according to the specWhat happened instead?
The inline mention followed the URL format in
permalink_prefix
, which is problematic for several reasons:Other clients (such as Element-Android or other Element-Web instances) render these mentions as links instead of proper pilled mentions. Most users on federated rooms are on a different homeserver and use a different config.json if not a different Matrix client.
In addition, config.md says the following about
permalink_prefix
:When using the share button,
permalink_prefix
should be used to generate links, but not when pinging people, since these aren't permalinks and are in theory just fallback links for clients which don't know how to render mentions.Other than spec compliance, this breaks bridges, since bridges only deal with inline mentions as stated in the spec. Trying to ping a bridged user would send a link to the Element web instance instead, so it would be unsuccessful at getting their attention and make it unnecessarily obvious that the person on the other side is using a Matrix bridge.
Operating system
No response
Browser information
No response
URL for webapp
No response
Application version
Element version: 1.11.45
Homeserver
No response
Will you send logs?
No
The text was updated successfully, but these errors were encountered: