mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 13:17:13 +08:00
FIX: improve matching algorithm
This commit is contained in:
parent
6d8200b1b1
commit
8701a39044
@ -2,6 +2,11 @@ var PosterNameComponent = Em.Component.extend({
|
||||
classNames: ['names'],
|
||||
displayNameOnPosts: Discourse.computed.setting('display_name_on_posts'),
|
||||
|
||||
// sanitize name for comparison
|
||||
sanitizeName: function(name){
|
||||
return name.toLowerCase().replace(/[\s_-]/g,'');
|
||||
},
|
||||
|
||||
render: function(buffer) {
|
||||
var post = this.get('post');
|
||||
|
||||
@ -27,8 +32,10 @@ var PosterNameComponent = Em.Component.extend({
|
||||
}
|
||||
buffer.push("</span>");
|
||||
|
||||
|
||||
|
||||
// Are we showing full names?
|
||||
if (name && (name.toLowerCase().trim() !== username.toLowerCase().trim()) && this.get('displayNameOnPosts')) {
|
||||
if (name && this.get('displayNameOnPosts') && (this.sanitizeName(name) !== this.sanitizeName(username))) {
|
||||
name = Handlebars.Utils.escapeExpression(name);
|
||||
buffer.push("<span class='full-name'><a href='#'>" + name + "</a></span>");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user