Skip to content
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

Limit length of room name in invite emails #528

Merged
merged 2 commits into from
Nov 18, 2022
Merged

Conversation

erikjohnston
Copy link
Member

No description provided.

@erikjohnston erikjohnston requested a review from a team as a code owner November 18, 2022 15:09
@@ -133,6 +133,9 @@ def render_POST(self, request: Request) -> JsonDict:

substitutions["ephemeral_private_key"] = ephemeralPrivateKeyBase64
if substitutions["room_name"] != "":
if len(substitutions["room_name"]) > 30:
substitutions["room_name"] = substitutions["room_name"][:25] + "…"
Copy link
Member

Choose a reason for hiding this comment

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

Curious why 25 instead of 29. Is that because of the "(%s) " below adding 3 characters? In which case we can put 26 here?

Otherwise just a nit and doesn't really matter all that much.

Copy link
Member Author

Choose a reason for hiding this comment

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

Eh, just arbitrary really, as it always irrationally annoys me when things truncate stuff when there's only a couple of extra characters 🤷

Copy link
Contributor

@squahtx squahtx left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +136 to +137
if len(substitutions["room_name"]) > 30:
substitutions["room_name"] = substitutions["room_name"][:25] + "…"
Copy link
Contributor

Choose a reason for hiding this comment

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

Unicode is terrible and we should note that we can may truncate in the middle of a grapheme here, eg. when there are multi-code point emoji or letters with combining diacritics.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! I don't really care about that right now though, but we should clean it up at some point

@erikjohnston erikjohnston merged commit 294a716 into main Nov 18, 2022
@erikjohnston erikjohnston deleted the erikj/limit_room_name branch November 18, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants