mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Remove useless file
This commit is contained in:
parent
4d1d97ad86
commit
48def5010d
@ -1,61 +0,0 @@
|
||||
import { pathUserData } from "../utils/UserDataUtils";
|
||||
|
||||
/**
|
||||
* Single user account image
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
const defaultAccountImage = "0Reverse.png";
|
||||
const errorAccountImage = "0Red.png";
|
||||
|
||||
export enum AccountImageVisibilityLevel {
|
||||
FRIENDS = 1,
|
||||
COMUNIC_USERS = 2,
|
||||
EVERYONE = 3
|
||||
}
|
||||
|
||||
export class AccountImage {
|
||||
|
||||
public constructor(
|
||||
public userID: number,
|
||||
public path : string,
|
||||
public level: AccountImageVisibilityLevel
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get account image URL
|
||||
*/
|
||||
get url() : string {
|
||||
if(this.path.length < 1)
|
||||
return AccountImage.pathForFile(defaultAccountImage);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out whether the user has an account image
|
||||
* or if it is the default account image
|
||||
*/
|
||||
get hasImage() : boolean {
|
||||
return this.path.length > 0;
|
||||
}
|
||||
|
||||
static get errorURL() : string {
|
||||
return this.pathForFile(errorAccountImage);
|
||||
}
|
||||
|
||||
private static pathForFile(file : string, sysPath = false) : string {
|
||||
return pathUserData("avatars/" + file, sysPath);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user