From be02c495072eb1ac91ee3c29a90d3db81769cfa4 Mon Sep 17 00:00:00 2001 From: "EVOFORGE\\dimay" Date: Wed, 13 Dec 2023 08:44:26 -0500 Subject: [PATCH] #2498: removed message from self-report points request/reject emails --- ...pprovalRequestedNotificationBuilder.groovy | 2 -- ...ApprovalResponseNotificationBuilder.groovy | 6 ++--- .../services/SelfReportingService.groovy | 5 ++-- .../services/SkillApprovalService.groovy | 11 ++++++--- .../templates/skill_approval_request.html | 1 - .../templates/skill_approval_response.html | 5 ++-- .../ReportSkills_SelfReportingSpecs.groovy | 24 ++++--------------- 7 files changed, 19 insertions(+), 35 deletions(-) diff --git a/service/src/main/java/skills/notify/builders/SkillApprovalRequestedNotificationBuilder.groovy b/service/src/main/java/skills/notify/builders/SkillApprovalRequestedNotificationBuilder.groovy index 0070d78ae6..43b9cf2382 100644 --- a/service/src/main/java/skills/notify/builders/SkillApprovalRequestedNotificationBuilder.groovy +++ b/service/src/main/java/skills/notify/builders/SkillApprovalRequestedNotificationBuilder.groovy @@ -56,7 +56,6 @@ class SkillApprovalRequestedNotificationBuilder implements NotificationEmailBuil templateContext.setVariable("skillName", parsed.skillName) templateContext.setVariable("approveUrl", parsed.approveUrl) templateContext.setVariable("skillId", parsed.skillId) - templateContext.setVariable("requestMsg", parsed.requestMsg) templateContext.setVariable("projectId", parsed.projectId) templateContext.setVariable("publicUrl", parsed.publicUrl) templateContext.setVariable("projectName", parsed.projectName) @@ -73,7 +72,6 @@ class SkillApprovalRequestedNotificationBuilder implements NotificationEmailBuil "\n Project: ${parsed.projectName}" + "\n Skill: ${parsed.skillName} (${parsed.skillId})" + "\n Number of Points: ${String.format("%,d", parsed.numPoints)}" + - "\n Request Message: ${parsed.requestMsg}" + "\n" + "\nAs an approver for the '${parsed.projectId}' project, you can approve or reject this request." + "\n\n" + diff --git a/service/src/main/java/skills/notify/builders/SkillApprovalResponseNotificationBuilder.groovy b/service/src/main/java/skills/notify/builders/SkillApprovalResponseNotificationBuilder.groovy index d545eaf1e5..13d63cf50a 100644 --- a/service/src/main/java/skills/notify/builders/SkillApprovalResponseNotificationBuilder.groovy +++ b/service/src/main/java/skills/notify/builders/SkillApprovalResponseNotificationBuilder.groovy @@ -55,9 +55,9 @@ class SkillApprovalResponseNotificationBuilder implements NotificationEmailBuild templateContext.setVariable("approved", parsed.approved) templateContext.setVariable("skillName", parsed.skillName) templateContext.setVariable("skillId", parsed.skillId) + templateContext.setVariable("subjectId", parsed.subjectId) templateContext.setVariable("projectName", parsed.projectName) templateContext.setVariable("projectId", parsed.projectId) - templateContext.setVariable("rejectionMsg", parsed.rejectionMsg ?: '') templateContext.setVariable("publicUrl", parsed.publicUrl) templateContext.setVariable("htmlHeader", formatting.htmlHeader) templateContext.setVariable("htmlFooter", formatting.htmlFooter) @@ -76,9 +76,7 @@ class SkillApprovalResponseNotificationBuilder implements NotificationEmailBuild "\n Project: ${parsed.projectName}" + "\n Skill: ${parsed.skillName}" + "\n Approver: ${parsed.approver}" + - "\n ${parsed.approved ? '' : "Message: ${parsed.rejectionMsg ?: ''}\n"}" + - "\n" + - "\nAlways yours," + + "\n\n\nAlways yours," + "\nSkillTree Bot" if (formatting.plaintextHeader) { diff --git a/service/src/main/java/skills/services/SelfReportingService.groovy b/service/src/main/java/skills/services/SelfReportingService.groovy index 1d994259c9..83bb0039cb 100644 --- a/service/src/main/java/skills/services/SelfReportingService.groovy +++ b/service/src/main/java/skills/services/SelfReportingService.groovy @@ -140,7 +140,7 @@ class SelfReportingService { ) skillApprovalRepo.save(skillApproval) - sentNotifications(skillDefinition, userId, requestMsg) + sentNotifications(skillDefinition, userId) res = new SkillEventsService.AppliedCheckRes( skillApplied: false, @@ -187,7 +187,7 @@ class SelfReportingService { settingsService.saveSetting(userProjectSettingsRequest) } - private void sentNotifications(SkillDefMin skillDefinition, String userId, String requestMsg) { + private void sentNotifications(SkillDefMin skillDefinition, String userId) { String publicUrl = featureService.getPublicUrl() if(!publicUrl) { return @@ -220,7 +220,6 @@ class SelfReportingService { skillName : skillDefinition.name, approveUrl : "${publicUrl}administrator/projects/${skillDefinition.projectId}/self-report", skillId : skillDefinition.skillId, - requestMsg : requestMsg, projectId : skillDefinition.projectId, publicUrl : publicUrl, projectName : projDef.name, diff --git a/service/src/main/java/skills/services/SkillApprovalService.groovy b/service/src/main/java/skills/services/SkillApprovalService.groovy index 51fd027087..93bebe31a0 100644 --- a/service/src/main/java/skills/services/SkillApprovalService.groovy +++ b/service/src/main/java/skills/services/SkillApprovalService.groovy @@ -69,6 +69,9 @@ class SkillApprovalService { @Autowired SkillDefRepo skillDefRepo + @Autowired + SkillRelDefRepo skillRelDefRepo + @Autowired SkillDefAccessor skillDefAccessor @@ -261,7 +264,7 @@ class SkillApprovalService { // send email Optional optional = skillDefRepo.findById(it.skillRefId) SkillDef skillDef = optional.get() - sendApprovalNotifications(it, skillDef, false, rejectionMsg) + sendApprovalNotifications(it, skillDef, false) } } @@ -312,7 +315,7 @@ class SkillApprovalService { } } - private void sendApprovalNotifications(SkillApproval skillApproval, SkillDef skillDefinition, boolean approved, String rejectionMsg=null) { + private void sendApprovalNotifications(SkillApproval skillApproval, SkillDef skillDefinition, boolean approved) { String publicUrl = featureService.getPublicUrl() if(!publicUrl) { return @@ -326,6 +329,8 @@ class SkillApprovalService { UserInfo currentUser = userInfoService.getCurrentUser() String sender = currentUser.getEmail() + String subjectId = skillRelDefRepo.findSubjectSkillIdByChildId(skillDefinition.id) + ProjectSummaryResult projDef = projDefRepo.getProjectName(skillDefinition.projectId) Boolean isUcProject = userCommunityService.isUserCommunityOnlyProject(skillDefinition.projectId) Notifier.NotificationRequest request = new Notifier.NotificationRequest( @@ -336,9 +341,9 @@ class SkillApprovalService { approved : approved, skillName : skillDefinition.name, skillId : skillDefinition.skillId, + subjectId : subjectId, projectName : projDef.getProjectName(), projectId : skillDefinition.projectId, - rejectionMsg : rejectionMsg, publicUrl : publicUrl, replyTo : sender, communityHeaderDescriptor : isUcProject ? uiConfigProperties.ui.userCommunityRestrictedDescriptor : uiConfigProperties.ui.defaultCommunityDescriptor diff --git a/service/src/main/resources/templates/skill_approval_request.html b/service/src/main/resources/templates/skill_approval_request.html index a7c5c6a55a..fe12e65628 100644 --- a/service/src/main/resources/templates/skill_approval_request.html +++ b/service/src/main/resources/templates/skill_approval_request.html @@ -54,7 +54,6 @@

SkillTree Points Requested!

  • Project: [[${projectName}]]
  • Skill: [[${skillName}]]
  • Points: [[${numPoints}]]
  • -
  • Message: [[${requestMsg}]]
  • diff --git a/service/src/main/resources/templates/skill_approval_response.html b/service/src/main/resources/templates/skill_approval_response.html index e3c4f2b6f6..7abdbf5883 100644 --- a/service/src/main/resources/templates/skill_approval_response.html +++ b/service/src/main/resources/templates/skill_approval_response.html @@ -29,14 +29,13 @@

    [[${htmlHeader}]]

    SkillTree Points

    -

    Congratulations! Your request for the [[${skillName}]] skill in the [[${projectName}]] project has been approved!

    -

    Your request for the [[${skillName}]] skill in the [[${projectName}]] project has been denied.

    +

    Congratulations! Your request for the [[${skillName}]] skill in the [[${projectName}]] project has been approved!

    +

    Your request for the [[${skillName}]] skill in the [[${projectName}]] project has been denied.

    You can view your progress for the [[${projectName}]] project in the SkillTree dashboard.

    diff --git a/service/src/test/java/skills/intTests/reportSkills/ReportSkills_SelfReportingSpecs.groovy b/service/src/test/java/skills/intTests/reportSkills/ReportSkills_SelfReportingSpecs.groovy index 62519cad8a..8f42fcfabc 100644 --- a/service/src/test/java/skills/intTests/reportSkills/ReportSkills_SelfReportingSpecs.groovy +++ b/service/src/test/java/skills/intTests/reportSkills/ReportSkills_SelfReportingSpecs.groovy @@ -347,7 +347,6 @@ limitations under the License.
  • Project: Test Project#1
  • Skill: Test Skill 1
  • Points: 2,000
  • -
  • Message: Please approve this!
  • @@ -363,7 +362,6 @@ Always yours,
    -SkillTree Bot Project: Test Project#1 Skill: Test Skill 1 (skill1) Number of Points: 2,000 - Request Message: Please approve this! As an approver for the 'TestProject1' project, you can approve or reject this request. @@ -447,10 +445,7 @@ SkillTree Bot''' Congratulations! Your request for the Test Skill 1 skill in the Test Project#1 project has been approved. Project: Test Project#1 Skill: Test Skill 1 - Approver: ''' + projectAdminUserAttrs.userIdForDisplay + ''' - - -Always yours, + Approver: ''' + projectAdminUserAttrs.userIdForDisplay + '''Always yours, SkillTree Bot ''' String expectedHtml = ''' @@ -483,14 +478,13 @@ limitations under the License.

    SkillTree Points Approved!

    -

    Congratulations! Your request for the Test Skill 1 skill in the Test Project#1 project has been approved!

    +

    Congratulations! Your request for the Test Skill 1 skill in the Test Project#1 project has been approved!

    You can view your progress for the Test Project#1 project in the SkillTree dashboard.

    @@ -668,9 +662,6 @@ Your request for the Test Skill 1 skill in the Test Project#1 project has been d Project: Test Project#1 Skill: Test Skill 1 Approver: '''+projectAdminUserAttrs.userIdForDisplay+''' - Message: Just felt like it - - Always yours, SkillTree Bot ''' @@ -705,13 +696,12 @@ limitations under the License.

    SkillTree Points Denied

    -

    Your request for the Test Skill 1 skill in the Test Project#1 project has been denied.

    +

    Your request for the Test Skill 1 skill in the Test Project#1 project has been denied.

    You can view your progress for the Test Project#1 project in the SkillTree dashboard.

    @@ -752,7 +742,7 @@ Always yours,
    -SkillTree Bot approvalsEndpointResAfter.data.get(0).requestedOn == date1.time } - def "report via approval should validate approval message if 'paragraphValidationRegex' property is configurede"() { + def "report via approval should validate approval message if 'paragraphValidationRegex' property is configured"() { String user = "user0" def proj = SkillsFactory.createProject() @@ -809,9 +799,6 @@ Your request for the Test Skill 1 skill in the Test Project#1 project has been d Project: Test Project#1 Skill: Test Skill 1 Approver: '''+projectAdminUserAttrs.userIdForDisplay+''' - Message: - - Always yours, SkillTree Bot ''' @@ -846,13 +833,12 @@ limitations under the License.

    SkillTree Points Denied

    -

    Your request for the Test Skill 1 skill in the Test Project#1 project has been denied.

    +

    Your request for the Test Skill 1 skill in the Test Project#1 project has been denied.

    You can view your progress for the Test Project#1 project in the SkillTree dashboard.