Fix mentions

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-02 19:27:23 +02:00
parent e3753c041e
commit 3afc7c7feb
7 changed files with 291 additions and 374 deletions

View File

@@ -52,9 +52,7 @@ export class Actor implements IActor {
}
public displayName(): string {
return this.name != null && this.name !== ""
? this.name
: this.usernameWithDomain();
return displayName(this);
}
}
@@ -68,6 +66,12 @@ export function usernameWithDomain(actor: IActor, force = false): string {
return actor.preferredUsername;
}
export function displayName(actor: IActor): string {
return actor.name != null && actor.name !== ""
? actor.name
: usernameWithDomain(actor);
}
export function displayNameAndUsername(actor: IActor): string {
if (actor.name) {
return `${actor.name} (@${usernameWithDomain(actor)})`;