-
Notifications
You must be signed in to change notification settings - Fork 85
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
Conversation
@@ -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] + "…" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if len(substitutions["room_name"]) > 30: | ||
substitutions["room_name"] = substitutions["room_name"][:25] + "…" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
No description provided.