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 number of characters on display names #5739

Open
happyGNU opened this issue Nov 30, 2017 · 6 comments
Open

Limit number of characters on display names #5739

happyGNU opened this issue Nov 30, 2017 · 6 comments
Labels
A-Pills P2 S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect

Comments

@happyGNU
Copy link

Description

A kid today changed his nickname on Riot.im to a 36,213 characters long nickname, spamming everyone on IRC and Riot.im

Steps to reproduce

  • Login to Riot, change username to something extremely long (for fun you can copy and paste from the file I attach).

Expected behavior

  • I expect usernames to be able to be long, but within a rational size. So it can't be used to spam everyone else.

Ok, just for fun I will... Keep in mind that the amount of screenshots would had been immense, so I just post a few and a file with a copy paste of the username.

This bug probably affects all devices, although is probably easier to make it happen on a desktop because of the easy use of copy+paste.

captura de pantalla_2017-11-29_22-28-57
captura de pantalla_2017-11-29_22-29-12
captura de pantalla_2017-11-29_22-29-28
captura de pantalla_2017-11-29_22-29-58
spam.txt

@ericabxy
Copy link

Yeah I encountered this issue as well. To make Riot useable a username ought to be limited to some reasonable amount of characters, and maybe even abbreviated in cases such as this.

@uhoreg
Copy link
Member

uhoreg commented Nov 30, 2017

One possibility is to add CSS that prevents the displayname from wrapping, along with "text-overflow: ellipsis".

Also, pills will need the same treatment.

@lampholder lampholder added T-Defect S-Minor Impairs non-critical functionality or suitable workarounds exist P2 ui/ux labels Dec 1, 2017
@lampholder
Copy link
Member

This should certainly be fixed :D The only questions are:

  • whether it's fixed on the setting or the rendering of the display name (or both)
  • what precise limits are put in place (and where)

36213 characters is unhelpfully obviously too long; it doesn't help us to set a sensible limit at all

I'd suggest that:

  • The Matrix spec should be modified to specify a (flexible but reasonable) limit
  • Riot should be modified to implement its own (possibly more restrictive) limit, especially on rendering

But what should the limit be?

  • UK's GDS suggests 70 characters for a full human name (http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/254290/GDS%20Catalogue%20Vol%202.pdf)
  • Picasso had a long name; 121 characters including spaces: Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso
  • The longest name ever was 858 characters including spaces: Adolph Blaine Charles David Earl Frederick Gerald Hubert Irvin John Kenneth Lloyd Martin Nero Oliver Paul Quincy Randolph Sherman Thomas Uncas Victor William Xerxes Yancy Zeus Wolfe­schlegel­stein­hausen­berger­dorff­welche­vor­altern­waren­gewissen­haft­schafers­wessen­schafe­waren­wohl­gepflege­und­sorg­faltig­keit­be­schutzen­vor­an­greifen­durch­ihr­raub­gierig­feinde­welche­vor­altern­zwolf­hundert­tausend­jah­res­voran­die­er­scheinen­von­der­erste­erde­mensch­der­raum­schiff­genacht­mit­tung­stein­und­sieben­iridium­elek­trisch­motors­ge­brauch­licht­als­sein­ur­sprung­von­kraft­ge­start­sein­lange­fahrt­hin­zwischen­stern­artig­raum­auf­der­suchen­nach­bar­schaft­der­stern­welche­ge­habt­be­wohn­bar­planeten­kreise­drehen­sich­und­wo­hin­der­neue­rasse­von­ver­stand­ig­mensch­lich­keit­konnte­fort­pflanzen­und­sicher­freuen­an­lebens­lang­lich­freude­und­ru­he­mit­nicht­ein­furcht­vor­an­greifen­vor­anderer­intelligent­ge­schopfs­von­hin­zwischen­stern­art­ig­raum, Senior

Personally I'd vote for Matrix supporting Picasso and for Riot to truncate (with ellipsis and full text on hover) whenever a display name goes over a line break (always making room for disambiguation-mxid-in-parenthesis for the inevitable case when some idiot copies another idiot's massive name).

And Adolf W671m, Senior is out of luck and will have to implement his own realtime messaging protocol.

@lampholder
Copy link
Member

Aaaand I forgot about pills. They should probably be more restrictive again - noodling around in firebug it seems that anything longer than ~35 characters looks dreadful.

@uhoreg
Copy link
Member

uhoreg commented Jan 25, 2018

The display in the timeline heading can be addressed by adding something along these lines:

.mx_MatrixChat_useCompactLayout .mx_EventTile .mx_SenderProfile {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

This limits the display name to one line, and adds a "..." at the end of the line if it is too long.

before:
image

after:
image

Note: this probably does not fix the length of membership events (e.g. "X joined", or "X changed their displayname...") nor pills

@uhoreg
Copy link
Member

uhoreg commented Nov 1, 2018

a.mx_UserPill {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 20em;
    vertical-align: text-bottom;
}

will address the issue for pills, and

span.mx_MEmoteBody_sender {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    display: inline-block;
    max-width: calc(100% - 2em);
    vertical-align: bottom;
}

will address the issue for emotes. (the calc in the max-width is to take into account the preceding "* ") Maybe someone who understands CSS better than I can figure out why one wants vertical-align: bottom, and the other wants vertical-align: bottom.

There doesn't seem to be an easy way to fix membership events, since the usernames are not enclosed in any tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Pills P2 S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect
Projects
None yet
Development

No branches or pull requests

5 participants