mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 07:41:43 +08:00
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:
@ -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));
|
||||
|
Reference in New Issue
Block a user