Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2498: removed message from self-report points request/reject emails #2499

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class SelfReportingService {
)

skillApprovalRepo.save(skillApproval)
sentNotifications(skillDefinition, userId, requestMsg)
sentNotifications(skillDefinition, userId)

res = new SkillEventsService.AppliedCheckRes(
skillApplied: false,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class SkillApprovalService {
@Autowired
SkillDefRepo skillDefRepo

@Autowired
SkillRelDefRepo skillRelDefRepo

@Autowired
SkillDefAccessor skillDefAccessor

Expand Down Expand Up @@ -261,7 +264,7 @@ class SkillApprovalService {
// send email
Optional<SkillDef> optional = skillDefRepo.findById(it.skillRefId)
SkillDef skillDef = optional.get()
sendApprovalNotifications(it, skillDef, false, rejectionMsg)
sendApprovalNotifications(it, skillDef, false)
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ <h1>SkillTree Points Requested!</h1>
<li><span class="label">Project</span>: [[${projectName}]]</li>
<li><span class="label">Skill</span>: [[${skillName}]]</li>
<li><span class="label">Points</span>: [[${numPoints}]]</li>
<li><span class="label">Message</span>: [[${requestMsg}]]</li>
</ul>

<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@
<body class="overall-container">
<div th:remove="tag" th:utext="${htmlHeader}" th:if= "${htmlHeader != null}">[[${htmlHeader}]]</div>
<h1>SkillTree Points <span th:text="${approved} ? 'Approved!' : 'Denied'"></span></h1>
<p th:if="${approved}">Congratulations! Your request for the <b>[[${skillName}]]</b> skill in the <b>[[${projectName}]]</b> project has been approved!</p>
<p th:if="${!approved}">Your request for the <b>[[${skillName}]]</b> skill in the <b>[[${projectName}]]</b> project has been denied.</p>
<p th:if="${approved}">Congratulations! Your request for the <a th:href="@{${publicUrl}+'progress-and-rankings/projects/'+${projectId}+'?skillsClientDisplayPath=/subjects/'+${subjectId}+'/skills/'+${skillId}}">[[${skillName}]]</a> skill in the <b>[[${projectName}]]</b> project has been approved!</p>
<p th:if="${!approved}">Your request for the <a th:href="@{${publicUrl}+'progress-and-rankings/projects/'+${projectId}+'?skillsClientDisplayPath=/subjects/'+${subjectId}+'/skills/'+${skillId}}">[[${skillName}]]</a> skill in the <b>[[${projectName}]]</b> project has been denied.</p>

<ul>
<li><span class="label">Project</span>: [[${projectName}]]</li>
<li><span class="label">Skill</span>: [[${skillName}]]</li>
<li><span class="label">Approver</span>: [[${approver}]]</li>
<li th:if="${!approved}"><span class="label">Message</span>: [[${rejectionMsg}]]</li>
</ul>

<p>You can view your progress for the <a th:href="@{${publicUrl}+'progress-and-rankings/projects/'+${projectId}}">[[${projectName}]]</a> project in the SkillTree dashboard.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ limitations under the License.
<li><span class="label">Project</span>: Test Project#1</li>
<li><span class="label">Skill</span>: Test Skill 1</li>
<li><span class="label">Points</span>: 2,000</li>
<li><span class="label">Message</span>: Please approve this!</li>
</ul>

<p>
Expand All @@ -363,7 +362,6 @@ Always yours, <br/> -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.

Expand Down Expand Up @@ -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 = '''
Expand Down Expand Up @@ -483,14 +478,13 @@ limitations under the License.
</head>
<body class="overall-container">
<h1>SkillTree Points <span>Approved!</span></h1>
<p>Congratulations! Your request for the <b>Test Skill 1</b> skill in the <b>Test Project#1</b> project has been approved!</p>
<p>Congratulations! Your request for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1?skillsClientDisplayPath=/subjects/TestSubject1/skills/skill1">Test Skill 1</a> skill in the <b>Test Project#1</b> project has been approved!</p>


<ul>
<li><span class="label">Project</span>: Test Project#1</li>
<li><span class="label">Skill</span>: Test Skill 1</li>
<li><span class="label">Approver</span>: '''+ projectAdminUserAttrs.userIdForDisplay + '''</li>

</ul>

<p>You can view your progress for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1">Test Project#1</a> project in the SkillTree dashboard.</p>
Expand Down Expand Up @@ -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
'''
Expand Down Expand Up @@ -705,13 +696,12 @@ limitations under the License.
<body class="overall-container">
<h1>SkillTree Points <span>Denied</span></h1>

<p>Your request for the <b>Test Skill 1</b> skill in the <b>Test Project#1</b> project has been denied.</p>
<p>Your request for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1?skillsClientDisplayPath=/subjects/TestSubject1/skills/skill1">Test Skill 1</a> skill in the <b>Test Project#1</b> project has been denied.</p>

<ul>
<li><span class="label">Project</span>: Test Project#1</li>
<li><span class="label">Skill</span>: Test Skill 1</li>
<li><span class="label">Approver</span>: '''+projectAdminUserAttrs.userIdForDisplay+'''</li>
<li><span class="label">Message</span>: Just felt like it</li>
</ul>

<p>You can view your progress for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1">Test Project#1</a> project in the SkillTree dashboard.</p>
Expand Down Expand Up @@ -752,7 +742,7 @@ Always yours, <br/> -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()
Expand Down Expand Up @@ -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
'''
Expand Down Expand Up @@ -846,13 +833,12 @@ limitations under the License.
<body class="overall-container">
<h1>SkillTree Points <span>Denied</span></h1>

<p>Your request for the <b>Test Skill 1</b> skill in the <b>Test Project#1</b> project has been denied.</p>
<p>Your request for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1?skillsClientDisplayPath=/subjects/TestSubject1/skills/skill1">Test Skill 1</a> skill in the <b>Test Project#1</b> project has been denied.</p>

<ul>
<li><span class="label">Project</span>: Test Project#1</li>
<li><span class="label">Skill</span>: Test Skill 1</li>
<li><span class="label">Approver</span>: '''+projectAdminUserAttrs.userIdForDisplay+'''</li>
<li><span class="label">Message</span>: </li>
</ul>

<p>You can view your progress for the <a href="http://localhost:{{port}}/progress-and-rankings/projects/TestProject1">Test Project#1</a> project in the SkillTree dashboard.</p>
Expand Down