1
0
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:
2020-03-22 15:15:12 +01:00
parent 95af444741
commit bd83a77fb2
3 changed files with 43 additions and 0 deletions

View File

@ -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
*