Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Invite dialog: display MXID on its own line - #11756

Merged
t3chguy merged 2 commits into
matrix-org:developfrom
AndrewFerr:invite-mxid-on-next-line
Aug 1, 2024
Merged

Invite dialog: display MXID on its own line#11756
t3chguy merged 2 commits into
matrix-org:developfrom
AndrewFerr:invite-mxid-on-next-line

Conversation

@AndrewFerr

@AndrewFerr AndrewFerr commented Oct 16, 2023

Copy link
Copy Markdown
Member

The reason for doing this is to make the invite dialog more readable when the inviter's MXID is very long, which tends to be the case when the inviter is a bridged user with a machine-generated MXID.

Screenshots

DM invite

Before

image

After

image

Room invite

Before

image

After

image

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Here's what your changelog entry will look like:

✨ Features

@AndrewFerr
AndrewFerr requested a review from a team as a code owner October 16, 2023 16:12
@AndrewFerr AndrewFerr added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Oct 16, 2023
subTitle = [avatar, _t("room|invite_subtitle", {}, { userName: () => inviterElement })];
primaryActionLabel = _t("action|accept");
}
subTitle = [avatar, inviterElement];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

these don't have keys so shouldn't be an array, use a React Fragment instead please

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

subTitle currently has a type of string | ReactNode[] | undefined; is a React Fragment a ReactNode[] or should the type of subTitle be expanded to include it?

And is something like the below what you're after? It's a pattern used elsewhere in this function.

subTitle = [
    <>
        {avatar}
        {inviterElement}
    </>,
];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fragment would qualify as ReactNode, but if using an array must be given a key otherwise https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key

Your snippet would work but would trigger the warning due to missing a key

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh looks like the code further down inserts a key based on position, that's not ideal but good enough

subTitleElements = subTitle.map((t, i) => <p key={subTitle${i}}>{t}</p>);

Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
@t3chguy
t3chguy added this pull request to the merge queue Aug 1, 2024
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 1, 2024
@t3chguy
t3chguy added this pull request to the merge queue Aug 1, 2024
Merged via the queue into matrix-org:develop with commit 1270518 Aug 1, 2024
@AndrewFerr
AndrewFerr deleted the invite-mxid-on-next-line branch August 1, 2024 14:39
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Sep 9, 2024
https://build.opensuse.org/request/show/1196036
by user dheidler + anag+factory
- Version 1.11.75
  # Security
- Fixes for GHSA-vhr5-g3pm-49fm (CVE-2024-42369).
- Version 1.11.74
  ## ✨ Features
  * Update unsupported browser react component to new designs (element-hq/element-web#27857). Contributed by @t3chguy.
  * Invite dialog: display MXID on its own line (matrix-org/matrix-react-sdk#11756). Contributed by @AndrewFerr.
  * Align RoomSummaryCard styles with Figma (matrix-org/matrix-react-sdk#12793). Contributed by @t3chguy.
  * Extract Extensions into their own right panel tab (matrix-org/matrix-react-sdk#12844). Contributed by @t3chguy.
  * Remove topic from new room header and expand right panel topic (http
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Sep 9, 2024
https://build.opensuse.org/request/show/1196035
by user dheidler + anag+factory
- Version 1.11.75
  * Fixes for CVE-2024-42369 / GHSA-vhr5-g3pm-49fm.
- Version 1.11.74
  ## ✨ Features
  * Update unsupported browser react component to new designs (element-hq/element-web#27857). Contributed by @t3chguy.
  * Invite dialog: display MXID on its own line (matrix-org/matrix-react-sdk#11756). Contributed by @AndrewFerr.
  * Align RoomSummaryCard styles with Figma (matrix-org/matrix-react-sdk#12793). Contributed by @t3chguy.
  * Extract Extensions into their own right panel tab (matrix-org/matrix-react-sdk#12844). Contributed by @t3chguy.
  * Remove topic from new room header and expand right panel topic (matrix-org/matrix-react-sdk#12842). Contributed by @t3c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants