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:
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user