UX: There were many places where username formatters were not applied

This commit is contained in:
Robin Ward 2017-11-20 14:58:23 -05:00
parent b9595966d4
commit c53ed61bd3
2 changed files with 12 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import { transformBasicPost } from 'discourse/lib/transform-post';
import { h } from 'virtual-dom';
import DiscourseURL from 'discourse/lib/url';
import { dateNode } from 'discourse/helpers/node';
import { translateSize, avatarUrl } from 'discourse/lib/utilities';
import { translateSize, avatarUrl, formatUsername } from 'discourse/lib/utilities';
export function avatarImg(wanted, attrs) {
const size = translateSize(wanted);
@ -14,7 +14,7 @@ export function avatarImg(wanted, attrs) {
// We won't render an invalid url
if (!url || url.length === 0) { return; }
const title = attrs.username;
const title = formatUsername(attrs.username);
const properties = {
attributes: { alt: '', width: size, height: size, src: Discourse.getURLWithCDN(url), title },

View File

@ -5,7 +5,7 @@ import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';
import { iconNode } from 'discourse-common/lib/icon-library';
import highlightText from 'discourse/lib/highlight-text';
import { escapeExpression } from 'discourse/lib/utilities';
import { escapeExpression, formatUsername } from 'discourse/lib/utilities';
class Highlighted extends RawHtml {
constructor(html, term) {
@ -57,7 +57,15 @@ createSearchResult({
type: 'user',
linkField: 'path',
builder(u) {
return [ avatarImg('small', { template: u.avatar_template, username: u.username }), ' ', h('span.user-results', h('b', u.username)), ' ', h('span.user-results', u.name ? u.name : '') ];
return [
avatarImg('small', {
template: u.avatar_template, username: u.username
}),
' ',
h('span.user-results', h('b', formatUsername(u.username))),
' ',
h('span.user-results', u.name ? u.name : '')
];
}
});