Skip to content

Commit

Permalink
fixed profile picture changes not persisted
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Feb 9, 2022
1 parent e752d9b commit b6efa6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.erudika.scoold.utils.avatars;

import com.erudika.scoold.ScooldServer;
import com.erudika.scoold.core.Profile;
import com.erudika.scoold.utils.ScooldUtils;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -39,7 +40,11 @@ public String getAnonymizedLink(String data) {
@Override
public boolean store(Profile profile, String url) {
if (StringUtils.isBlank(url) || !url.equalsIgnoreCase(profile.getOriginalPicture())) {
profile.setPicture(ScooldUtils.getDefaultAvatar());
if (StringUtils.startsWithIgnoreCase(url, ScooldServer.getServerURL())) {
profile.setPicture(url);
} else {
profile.setPicture(ScooldUtils.getDefaultAvatar());
}
} else {
profile.setPicture(profile.getOriginalPicture());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/base.vm
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
#end

#set($ctxPathJS = "CONTEXT_PATH = '$CONTEXT_PATH'")
#set($imgurJS = "IMGUR_CLIENT_ID = '$IMGUR_CLIENT_ID';IMGUR_ENABLED = '$IMGUR_ENABLED';")
#set($imgurJS = "IMGUR_CLIENT_ID = '$IMGUR_CLIENT_ID';IMGUR_ENABLED = $IMGUR_ENABLED")
#set($isRTLJS = "RTL_ENABLED = $RTL_ENABLED")
#set($isAdminJS = "IS_ADMIN = $isAdmin")
#set($maxTagsJS = "MAX_TAGS_PER_POST = $MAX_TAGS_PER_POST")
Expand Down

0 comments on commit b6efa6b

Please sign in to comment.