From 38f71dded18f929355718c0039e7e12fc0ba72b1 Mon Sep 17 00:00:00 2001 From: stetsche <53173679+stetsche@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:55:08 +0200 Subject: [PATCH] S2U-42 SAK-49311 Cannot change / add profile photo (#11958) --- .../src/java/org/sakaiproject/profile2/model/ProfileImage.java | 1 + .../org/sakaiproject/profile2/logic/ProfileImageLogicImpl.java | 3 ++- .../sakaiproject/webapi/controllers/CardGameController.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/profile2/api/src/java/org/sakaiproject/profile2/model/ProfileImage.java b/profile2/api/src/java/org/sakaiproject/profile2/model/ProfileImage.java index 0e9c9bf85f1c..18d149f433f3 100644 --- a/profile2/api/src/java/org/sakaiproject/profile2/model/ProfileImage.java +++ b/profile2/api/src/java/org/sakaiproject/profile2/model/ProfileImage.java @@ -49,6 +49,7 @@ public class ProfileImage { private String altText; private String mimeType; private boolean isDefault; + private boolean isInitials; /** * Get access to the binary data from either the uploaded image or the base64 encoded data diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileImageLogicImpl.java b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileImageLogicImpl.java index 710a051d9651..e6e7e9f1c642 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileImageLogicImpl.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileImageLogicImpl.java @@ -1116,8 +1116,9 @@ public ProfileImage getProfileAvatarInitials(String userUuid) { image.setUploadedImage(bytes); } else { image.setExternalImageUrl(getUnavailableImageURL()); + image.setDefault(true); } - image.setDefault(true); + image.setInitials(true); cache.put(userUuid, image); } return image; diff --git a/webapi/src/main/java/org/sakaiproject/webapi/controllers/CardGameController.java b/webapi/src/main/java/org/sakaiproject/webapi/controllers/CardGameController.java index e3d5e7ab2dd1..7a4563c13676 100644 --- a/webapi/src/main/java/org/sakaiproject/webapi/controllers/CardGameController.java +++ b/webapi/src/main/java/org/sakaiproject/webapi/controllers/CardGameController.java @@ -345,6 +345,6 @@ private Boolean hasDefaultImage(String userId, String siteId, boolean official) profileImage = profileImageLogic.getProfileImage(userId, null, null, ProfileConstants.PROFILE_IMAGE_MAIN, siteId); } - return profileImage.isDefault(); + return profileImage.isDefault() || profileImage.isInitials(); } }