mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Can display user account image in all cases
This commit is contained in:
parent
1ac9a927f1
commit
2453deeec3
@ -76,7 +76,7 @@ export class UserController {
|
|||||||
"publicPage": user.pageStatus == UserPageStatus.PUBLIC,
|
"publicPage": user.pageStatus == UserPageStatus.PUBLIC,
|
||||||
"openPage": user.pageStatus == UserPageStatus.OPEN,
|
"openPage": user.pageStatus == UserPageStatus.OPEN,
|
||||||
"virtualDirectory": user.hasVirtualDirectory ? user.virtualDirectory : "",
|
"virtualDirectory": user.hasVirtualDirectory ? user.virtualDirectory : "",
|
||||||
"accountImage": this.GetAccountImageURL(user.accountImage, h)
|
"accountImage": await this.GetAccountImageURL(user.accountImage, h)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(advanced) {
|
if(advanced) {
|
||||||
@ -98,22 +98,20 @@ export class UserController {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GetAccountImageURL(image : AccountImage, handler: RequestHandler) {
|
private static async GetAccountImageURL(image : AccountImage, handler: RequestHandler) {
|
||||||
|
|
||||||
if(image.level == AccountImageVisibilityLevel.EVERYONE
|
if(image.level == AccountImageVisibilityLevel.EVERYONE
|
||||||
|| (handler.signedIn && handler.getUserId() == image.userID))
|
|| (handler.signedIn && handler.getUserId() == image.userID))
|
||||||
return image.url;
|
return image.url;
|
||||||
|
|
||||||
if(image.level == AccountImageVisibilityLevel.COMUNIC_USERS) {
|
if(!handler.signedIn)
|
||||||
if(handler.signedIn)
|
return AccountImage.errorURL;
|
||||||
|
|
||||||
|
if(image.level == AccountImageVisibilityLevel.COMUNIC_USERS
|
||||||
|
|| await FriendsHelper.AreFriend(image.userID, handler.getUserId())) {
|
||||||
return image.url;
|
return image.url;
|
||||||
else
|
|
||||||
return AccountImage.errorURL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : implement frienship support
|
|
||||||
console.error("ERR: Can not check friends for now (for account image)!");
|
|
||||||
|
|
||||||
return AccountImage.errorURL;
|
return AccountImage.errorURL;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user