mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Can change account image visibility
This commit is contained in:
@ -55,6 +55,29 @@ export class AccountImageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change account image visiblity level
|
||||
*
|
||||
* @param userID Target user ID
|
||||
* @param level New level for account image
|
||||
*/
|
||||
public static async SetVisibilityLevel(userID: number, level: AccountImageVisibilityLevel) {
|
||||
const file = this.GetPathVisibilityFile(userID);
|
||||
|
||||
// If the visiblity is set to everyone, we do not
|
||||
// need to have a visibility file
|
||||
if(level == AccountImageVisibilityLevel.EVERYONE) {
|
||||
|
||||
if(existsSync(file))
|
||||
unlinkSync(file);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
writeFileSync(file, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content of the file associated to the user account image, if any
|
||||
*
|
||||
|
Reference in New Issue
Block a user