Skip to content

Commit

Permalink
Issue # SB-794 Developement : Sunbird Staging : Mail triggered to the…
Browse files Browse the repository at this point in the history
… creator on rejecting a content contains an invalid text "smiley face" .
  • Loading branch information
arvindyadav108 committed Nov 17, 2017
1 parent d95746b commit b3c527c
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ProjectUtil {
"elasticsearch.config.properties", "cassandra.config.properties", "dbconfig.properties",
"externalresource.properties", "sso.properties", "userencryption.properties",
"profilecompleteness.properties", "mailTemplates.properties"};
public static final PropertiesCache propertiesCache = PropertiesCache.getInstance();
public static PropertiesCache propertiesCache ;

/**
* @author Manzarul
Expand Down Expand Up @@ -238,6 +238,7 @@ public static String formatDate(Date date) {
static {
pattern = Pattern.compile(EMAIL_PATTERN);
initializeMailTemplateMap();
propertiesCache = PropertiesCache.getInstance();
}

private static void initializeMailTemplateMap() {
Expand Down Expand Up @@ -561,6 +562,7 @@ private void setName(String name) {
}

public static VelocityContext getContext(Map<String, Object> map) {
propertiesCache = PropertiesCache.getInstance();
VelocityContext context = new VelocityContext();

if (!ProjectUtil.isStringNullOREmpty((String) map.get(JsonKey.ACTION_URL))) {
Expand All @@ -581,13 +583,20 @@ public static VelocityContext getContext(Map<String, Object> map) {
context.put(JsonKey.ORG_NAME, (String) map.get(JsonKey.ORG_NAME));
map.remove(JsonKey.ORG_NAME);
// add image url in the mail
String sunbirdLogUrlFromCache = PropertiesCache.getInstance().getProperty(JsonKey.SUNBIRD_ENV_LOGO_URL);
if (!ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ENV_LOGO_URL))
|| !ProjectUtil
.isStringNullOREmpty(propertiesCache.getProperty(JsonKey.SUNBIRD_ENV_LOGO_URL))) {
context.put(JsonKey.ORG_IMAGE_URL,
ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ENV_LOGO_URL))
? propertiesCache.getProperty(JsonKey.SUNBIRD_ENV_LOGO_URL)
: System.getenv(JsonKey.SUNBIRD_ENV_LOGO_URL));
.isStringNullOREmpty(propertiesCache.getProperty(JsonKey.SUNBIRD_ENV_LOGO_URL))) {
String logoUrl = null;
if(!ProjectUtil.isStringNullOREmpty(System.getenv(JsonKey.SUNBIRD_ENV_LOGO_URL))){
logoUrl = System.getenv(JsonKey.SUNBIRD_ENV_LOGO_URL);
}else if(!JsonKey.SUNBIRD_ENV_LOGO_URL.equalsIgnoreCase(sunbirdLogUrlFromCache)){
logoUrl = sunbirdLogUrlFromCache;
}

if(!ProjectUtil.isStringNullOREmpty(logoUrl)){
context.put(JsonKey.ORG_IMAGE_URL, logoUrl);
}
}
context.put(JsonKey.ACTION_NAME, (String) map.get(JsonKey.ACTION_NAME));
map.remove(JsonKey.ACTION_NAME);
Expand Down

0 comments on commit b3c527c

Please sign in to comment.