Skip to content

Commit

Permalink
Revert "Update template existence check with resolve param in org tem…
Browse files Browse the repository at this point in the history
…plates."

This reverts commit eb70b91.
  • Loading branch information
dhaura committed Dec 10, 2024
1 parent eb70b91 commit 52cc594
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public SimpleEmailTemplate addEmailTemplate(String templateTypeId, EmailTemplate
try {
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager()
.isEmailTemplateExists(templateTypeDisplayName, emailTemplateWithID.getId(),
getTenantDomainFromContext(), null, false);
getTenantDomainFromContext());
if (!isTemplateExists) {
// Email template is new, hence add to the system.
addEmailTemplateToTheSystem(templateTypeDisplayName, emailTemplateWithID);
Expand Down Expand Up @@ -308,7 +308,7 @@ public void deleteEmailTemplate(String templateTypeId, String templateId) {
}
try {
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager().isEmailTemplateExists(
templateTypeDisplayName, templateId, getTenantDomainFromContext(), null, false);
templateTypeDisplayName, templateId, getTenantDomainFromContext());
if (isTemplateExists) {
EmailTemplatesServiceHolder.getEmailTemplateManager().deleteEmailTemplate(templateTypeDisplayName,
templateId, getTenantDomainFromContext());
Expand All @@ -329,11 +329,9 @@ public void updateEmailTemplate(String templateTypeId, String templateId, EmailT

String templateTypeDisplayName = decodeTemplateTypeId(templateTypeId);
try {
/* Check whether the email template exists, first. Here, resolve param is specified as true since
resolved org templates are returned in GET endpoint, by default. Therefore, resolved template existence
is checked before updating. */
// Check whether the email template exists, first.
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager().isEmailTemplateExists(
templateTypeDisplayName, templateId, getTenantDomainFromContext(), null, true);
templateTypeDisplayName, templateId, getTenantDomainFromContext());
if (isTemplateExists) {
addEmailTemplateToTheSystem(templateTypeDisplayName, emailTemplateWithID);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public SimpleEmailTemplate addEmailTemplate(String templateTypeId, EmailTemplate
try {
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager()
.isEmailTemplateExists(templateTypeDisplayName, emailTemplateWithID.getLocale(),
getTenantDomainFromContext(), null, false);
getTenantDomainFromContext());
if (!isTemplateExists) {
// Email template is new, hence add to the system.
addEmailTemplateToTheSystem(templateTypeDisplayName, emailTemplateWithID);
Expand Down Expand Up @@ -332,7 +332,7 @@ public void deleteEmailTemplate(String templateTypeId, String templateId) {
}
try {
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager().isEmailTemplateExists(
templateTypeDisplayName, templateId, getTenantDomainFromContext(), null, false);
templateTypeDisplayName, templateId, getTenantDomainFromContext());
if (isTemplateExists) {
EmailTemplatesServiceHolder.getEmailTemplateManager().deleteEmailTemplate(templateTypeDisplayName,
templateId, getTenantDomainFromContext());
Expand All @@ -353,11 +353,9 @@ public void updateEmailTemplate(String templateTypeId, String templateId, EmailT

String templateTypeDisplayName = decodeTemplateTypeId(templateTypeId);
try {
/* Check whether the email template exists, first. Here, resolve param is specified as true since
resolved org templates are returned in GET endpoint, by default. Therefore, resolved template existence
is checked before updating. */
// Check whether the email template exists, first.
boolean isTemplateExists = EmailTemplatesServiceHolder.getEmailTemplateManager().isEmailTemplateExists(
templateTypeDisplayName, templateId, getTenantDomainFromContext(), null, true);
templateTypeDisplayName, templateId, getTenantDomainFromContext());
if (isTemplateExists) {
addEmailTemplateToTheSystem(templateTypeDisplayName, emailTemplateWithID);
} else {
Expand Down

0 comments on commit 52cc594

Please sign in to comment.