1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 08:35:17 +00:00

Can replace account image

This commit is contained in:
2020-03-22 15:00:08 +01:00
parent d02eb7afce
commit 34b0a29e77
4 changed files with 51 additions and 6 deletions

View File

@ -28,9 +28,19 @@ export class AccountImage {
*/
get url() : string {
if(this.path.length < 1)
return AccountImage.urlForFile(defaultAccountImage);
return AccountImage.pathForFile(defaultAccountImage);
return AccountImage.urlForFile(this.path);
return AccountImage.pathForFile(this.path);
}
/**
* Get account image sys path
*/
get sysPath() : string {
if(this.path.length < 1)
throw new Error("This user has no account image!");
return AccountImage.pathForFile(this.path, true);
}
/**
@ -42,10 +52,10 @@ export class AccountImage {
}
static get errorURL() : string {
return this.urlForFile(errorAccountImage);
return this.pathForFile(errorAccountImage);
}
private static urlForFile(file : string) : string {
return pathUserData("avatars/" + file, false);
private static pathForFile(file : string, sysPath = false) : string {
return pathUserData("avatars/" + file, sysPath);
}
}