Skip to content

Conversation

Half-Shot
Copy link
Member

@Half-Shot Half-Shot commented Sep 1, 2025

Fixes #19620
For element-hq/element-meta#1366

This adds some additional context to the invite preview screen in Element so that you can roughly figure out how much you trust an invite from another person. This is another tool for users to feel safer on Matrix by having instant context to how they might relate to another user.

This does not currently rely on any third party services to provide context, all the information is taken from clientside held events. This means we don't always have a complete picture of a user's activities, but it neither leaks any information to you or to the server.

This has gone through light review with @element-hq/trust-safety but needs both product review and design review to really progress.

Design docs: https://www.figma.com/design/OK9VOhqfATe9eLdhV8qaZC/User-Context-on-Invite-Preview?node-id=1-632&p=f&t=7NqTf2JSEyPC4yrJ-0

Screenshot

image

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

@Half-Shot Half-Shot requested a review from a team as a code owner September 1, 2025 07:56
@Half-Shot Half-Shot marked this pull request as draft September 1, 2025 07:56
}

function useGetUserSafety(inviterMember: RoomMember | null): {
score: InviteScore | null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused now since we don't have a headline score.

setIsLocalTrustedServer(false);
}

(async () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to remove this, it was rather flaky.

);
}

function useGetUserSafety(inviterMember: RoomMember | null): {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be useful to factor this out, we might use it in other parts of the UI.

}

const { roomCount, joinedTo, userBanned, userKicked, userFirstSeen, isLocalTrustedServer } = details;
return (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaaaaaaaaaaall of this needs i18n-ing

Unsafe = "unsafe",
}

function SafetyDetailItem({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially a candidate for Compound-ing, will check with design.

(async () => {
let rooms: string[];
try {
rooms = await client._unstable_getSharedRooms(inviterMember.userId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not actually be useful if we already have a store of rooms locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show more info when you are invited to a room: mxid, preview, topic, common circles with inviter
1 participant