mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 05:50: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'],
|
classNames: ['names'],
|
||||||
displayNameOnPosts: Discourse.computed.setting('display_name_on_posts'),
|
displayNameOnPosts: Discourse.computed.setting('display_name_on_posts'),
|
||||||
|
|
||||||
|
// sanitize name for comparison
|
||||||
|
sanitizeName: function(name){
|
||||||
|
return name.toLowerCase().replace(/[\s_-]/g,'');
|
||||||
|
},
|
||||||
|
|
||||||
render: function(buffer) {
|
render: function(buffer) {
|
||||||
var post = this.get('post');
|
var post = this.get('post');
|
||||||
|
|
||||||
@ -27,8 +32,10 @@ var PosterNameComponent = Em.Component.extend({
|
|||||||
}
|
}
|
||||||
buffer.push("</span>");
|
buffer.push("</span>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Are we showing full names?
|
// 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);
|
name = Handlebars.Utils.escapeExpression(name);
|
||||||
buffer.push("<span class='full-name'><a href='#'>" + name + "</a></span>");
|
buffer.push("<span class='full-name'><a href='#'>" + name + "</a></span>");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user