FEATURE: New API to create a custom formatter for displaying usernames

This is not exhaustive right now, but a good start and we can add to
it over time.
This commit is contained in:
Robin Ward
2017-10-30 12:40:58 -04:00
parent e02ad4249e
commit a0dd75ba88
11 changed files with 57 additions and 16 deletions

View File

@ -21,6 +21,17 @@ export function escapeExpression(string) {
return escape(string);
}
let _usernameFormatDelegate = username => username;
export function formatUsername(username) {
return _usernameFormatDelegate(username || '');
}
export function replaceFormatter(fn) {
_usernameFormatDelegate = fn;
}
export function avatarUrl(template, size) {
if (!template) { return ""; }
const rawSize = getRawSize(translateSize(size));