Discourse does not show the Real Name on a topic page then it (wrongly) assumes it is the same as the Username

User has set the Real Name:

But Discourse does not show the Real Name because it assumes it too similar to the Username

The problem code is https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/poster-name.js.es6#L40

if (name && this.get('displayNameOnPosts') && (this.sanitizeName(name) !== this.sanitizeName(username))) {

And sanitize method is defined as: https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/poster-name.js.es6#L7

  // sanitize name for comparison
  sanitizeName(name){
    return name.toLowerCase().replace(/[\s_-]/g,'');
  },

I think it could be better the one of:

  • have possibility to disable such sanitation
  • recode sanitize method as
  // sanitize name for comparison
  sanitizeName(name){
    return name.toLowerCase().trim();
  },
6 Likes

This is correct and as designed.

1 Like

Agreed; this is a horrible design and nobody likes it. :stuck_out_tongue:

See previous discussion:

4 Likes