Skip to content

Commit

Permalink
Merge branch 'master' into 11810-remove-archive-courses-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
daongochieu2810 authored Jul 26, 2022
2 parents c826770 + 46979fb commit be741f4
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 36 deletions.
2 changes: 1 addition & 1 deletion datastore-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:alpine

RUN apk --update add openjdk8-jre
RUN apk --update add openjdk11-jre
RUN gcloud components install beta cloud-datastore-emulator

ENTRYPOINT gcloud beta emulators datastore start --host-port 0.0.0.0:8484 --project placeholder
2 changes: 2 additions & 0 deletions src/main/java/teammates/common/util/Templates.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static class EmailTemplates {
FileHelper.readResourceFile("instructorEmailFragment-registrationKeyReset.html");
public static final String USER_FEEDBACK_SESSION =
FileHelper.readResourceFile("userEmailTemplate-feedbackSession.html");
public static final String USER_FEEDBACK_SESSION_OPENING =
FileHelper.readResourceFile("userEmailTemplate-feedbackSessionOpening.html");
public static final String USER_FEEDBACK_SESSION_PUBLISHED =
FileHelper.readResourceFile("userEmailTemplate-feedbackSessionPublished.html");
public static final String FRAGMENT_SESSION_LINKS_RECOVERY_ACCESS_LINKS_BY_SESSION =
Expand Down
28 changes: 15 additions & 13 deletions src/main/java/teammates/logic/api/EmailGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,22 @@
* @see EmailWrapper
*/
public final class EmailGenerator {
// feedback action strings
private static final String FEEDBACK_ACTION_SUBMIT_EDIT_OR_VIEW = "submit, edit or view";
private static final String FEEDBACK_ACTION_VIEW = "view";
private static final String FEEDBACK_ACTION_SUBMIT_OR_UPDATE =
", in case you have not submitted yet or wish to update your submission. ";
private static final String HTML_NO_ACTION_REQUIRED = "<mark>No action is required if you have already submitted</mark>";

// status-related strings
private static final String FEEDBACK_STATUS_SESSION_OPEN = "is still open for submissions";
private static final String FEEDBACK_STATUS_SESSION_OPEN = "is still open for submissions"
+ FEEDBACK_ACTION_SUBMIT_OR_UPDATE + HTML_NO_ACTION_REQUIRED;
private static final String FEEDBACK_STATUS_SESSION_OPENING = "is now open";
private static final String FEEDBACK_STATUS_SESSION_CLOSING = "is closing soon";
private static final String FEEDBACK_STATUS_SESSION_CLOSING = "is closing soon"
+ FEEDBACK_ACTION_SUBMIT_OR_UPDATE + HTML_NO_ACTION_REQUIRED;
private static final String FEEDBACK_STATUS_SESSION_CLOSED = "is now closed for submission";
private static final String FEEDBACK_STATUS_SESSION_OPENING_SOON = "is due to open soon";

// feedback action strings
private static final String FEEDBACK_ACTION_SUBMIT_EDIT_OR_VIEW = "submit, edit or view";
private static final String FEEDBACK_ACTION_VIEW = "view";
private static final String HTML_NO_ACTION_REQUIRED =
"<p>No action is required if you have already submitted.</p>" + System.lineSeparator();

private static final String DATETIME_DISPLAY_FORMAT = "EEE, dd MMM yyyy, hh:mm a z";

private static final long SESSION_LINK_RECOVERY_DURATION_IN_DAYS = 90;
Expand Down Expand Up @@ -107,7 +110,10 @@ private List<EmailWrapper> generateFeedbackSessionOpeningOrClosingEmails(
? FEEDBACK_STATUS_SESSION_OPENING
: FEEDBACK_STATUS_SESSION_CLOSING;

String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", status);
String template = emailType == EmailType.FEEDBACK_OPENING
? EmailTemplates.USER_FEEDBACK_SESSION_OPENING.replace("${status}", status)
: EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", status);

return generateFeedbackSessionEmailBases(course, session, students, instructors, instructorsToNotify, template,
emailType, FEEDBACK_ACTION_SUBMIT_EDIT_OR_VIEW);
}
Expand Down Expand Up @@ -695,10 +701,6 @@ private List<EmailWrapper> generateFeedbackSessionEmailBases(
EmailType type, String feedbackAction) {
StringBuilder studentAdditionalContactBuilder = new StringBuilder();
StringBuilder instructorAdditionalContactBuilder = new StringBuilder();
if (type == EmailType.FEEDBACK_CLOSING || type == EmailType.FEEDBACK_SESSION_REMINDER) {
studentAdditionalContactBuilder.append(HTML_NO_ACTION_REQUIRED);
instructorAdditionalContactBuilder.append(HTML_NO_ACTION_REQUIRED);
}
studentAdditionalContactBuilder.append(getAdditionalContactInformationFragment(course, false));
instructorAdditionalContactBuilder.append(getAdditionalContactInformationFragment(course, true));

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/userEmailTemplate-feedbackSession.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
${instructorPreamble}

<p>
The following feedback session ${status}.
Just a gentle reminder that the following feedback session ${status}.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down
73 changes: 73 additions & 0 deletions src/main/resources/userEmailTemplate-feedbackSessionOpening.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<p>Hello ${userName},</p>

${instructorPreamble}

<p>
The following feedback session ${status}.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
<td style="padding:5px;">
<strong>
Course:
</strong>
</td>
<td style="padding:5px;">
[${courseId}] ${courseName}
</td>
</tr>

<tr>
<td style="padding:5px;">
<strong>
Feedback Session Name:
</strong>
</td>
<td style="padding:5px;">
${feedbackSessionName}
</td>
</tr>

<tr>
<td style="padding:5px;">
<strong>
Deadline:
</strong>
</td>
<td style="padding:5px;">
${deadline}
</td>
</tr>

<tr>
<td style="padding:5px;vertical-align:top">
<strong>
Session Instructions:
</strong>
</td>
<td style="padding:5px;">
${sessionInstructions}
</td>
</tr>
</table>
</div>
<ul>
<li>
<strong>To ${feedbackAction} your feedback for the above session, please go to this Web address: </strong>
<a href="${submitUrl}">${submitUrl}</a>
</li>
<li>
The above link is unique to you. Please do not share it with others.
</li>
<li>
After submitting, you are encouraged to download the proof of submission, which will contain your latest responses.
</li>
</ul>
</p>

${additionalContactInformation}

<p>
Regards,
<br>TEAMMATES Team.
</p>
1 change: 0 additions & 1 deletion src/test/java/teammates/logic/api/EmailGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,5 +767,4 @@ private void verifyEmailReceivedCorrectly(
}
assertTrue(hasReceivedEmailCorrectly);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</p>

<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -69,7 +69,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/emails/sessionClosingEmailForStudent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</p>

<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -69,7 +69,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is closing soon.
Just a gentle reminder that the following feedback session is closing soon, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</p>

<p>
The following feedback session is still open for submissions.
Just a gentle reminder that the following feedback session is still open for submissions, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -69,7 +69,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is still open for submissions.
Just a gentle reminder that the following feedback session is still open for submissions, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


<p>
The following feedback session is still open for submissions.
Just a gentle reminder that the following feedback session is still open for submissions, in case you have not submitted yet or wish to update your submission. <mark>No action is required if you have already submitted</mark>.
<div>
<table style="max-width:600px;border:1px solid black;">
<tr>
Expand Down Expand Up @@ -65,7 +65,6 @@
</ul>
</p>

<p>No action is required if you have already submitted.</p>
<p>
<ul>
<li>
Expand Down

0 comments on commit be741f4

Please sign in to comment.