Skip to content

Commit d445fb6

Browse files
authored
Merge pull request #2721 from objectcomputing/release/0.8
Release v0.8.3
2 parents 083053a + acb6ee4 commit d445fb6

File tree

5 files changed

+47
-25
lines changed

5 files changed

+47
-25
lines changed

.github/workflows/gradle-build-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ jobs:
8282
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
8383
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
8484
--set-env-vars "WEB_ADDRESS=${{ env.TARGET_URL }}" \
85-
--set-env-vars "FROM_ADDRESS=kimberlinm@objectcomputing.com" \
85+
--set-env-vars "FROM_ADDRESS=no-reply@objectcomputing.com" \
8686
--set-env-vars "FROM_NAME=Check-Ins" \
8787
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=cloud,google,gcp" \
8888
--platform "managed" \
89-
--max-instances 5 \
89+
--max-instances 8 \
9090
--allow-unauthenticated

.github/workflows/gradle-deploy-develop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
108108
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
109109
--set-env-vars "WEB_ADDRESS=${{ env.TARGET_URL }}" \
110-
--set-env-vars "FROM_ADDRESS=kimberlinm@objectcomputing.com" \
110+
--set-env-vars "FROM_ADDRESS=no-reply@objectcomputing.com" \
111111
--set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \
112112
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \
113113
--platform "managed" \

server/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77
id "jacoco"
88
}
99

10-
version "0.8.2"
10+
version "0.8.3"
1111
group "com.objectcomputing.checkins"
1212

1313
repositories {

server/src/main/java/com/objectcomputing/checkins/notifications/email/MailJetSender.java

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ public void sendEmail(String fromName, String fromAddress, String subject, Strin
9090
return;
9191
}
9292

93-
List<JSONArray> emailBatches = getEmailBatches(recipients);
94-
List<JSONArray> failedBatches = new ArrayList<>();
9593
JSONObject sender = new JSONObject()
9694
.put("Email", fromAddress)
9795
.put("Name", fromName);
@@ -106,27 +104,33 @@ public void sendEmail(String fromName, String fromAddress, String subject, Strin
106104
final String localEmailFormat = modifiedEmailFormat;
107105
final String localContent = content;
108106

109-
emailBatches.forEach((recipientList) -> {
110-
MailjetRequest request = new MailjetRequest(Emailv31.resource)
111-
.property(Emailv31.MESSAGES, new JSONArray()
112-
.put(new JSONObject()
113-
.put(Emailv31.Message.FROM, sender)
114-
.put(Emailv31.Message.TO, new JSONArray().put(sender))
115-
.put(Emailv31.Message.BCC, recipientList)
116-
.put(Emailv31.Message.SUBJECT, subject)
117-
.put(localEmailFormat, localContent)));
107+
if (recipients.length == 1) {
108+
final JSONArray to = new JSONArray()
109+
.put(new JSONObject().put("Email", recipients[0]));
118110
try {
119-
MailjetResponse response = client.post(request);
120-
LOG.info("Mailjet response status: {}", response.getStatus());
121-
LOG.info("Mailjet response data: {}", response.getData());
111+
send(sender, to, null, subject, localEmailFormat, localContent);
122112
} catch (MailjetException e) {
123-
LOG.error("An unexpected error occurred while sending the upload notification: {}", e.getLocalizedMessage(), e);
124-
failedBatches.add(recipientList);
113+
throw new BadArgException("Failed to send email for " + to);
114+
}
115+
} else {
116+
List<JSONArray> emailBatches = getEmailBatches(recipients);
117+
List<JSONArray> failedBatches = new ArrayList<>();
118+
final JSONArray to =
119+
new JSONArray()
120+
.put(new JSONObject().put("Email", this.fromAddress));
121+
emailBatches.forEach((recipientList) -> {
122+
try {
123+
send(sender, to, recipientList,
124+
subject, localEmailFormat, localContent);
125+
} catch (MailjetException e) {
126+
LOG.error("An unexpected error occurred while sending the upload notification: {}", e.getLocalizedMessage(), e);
127+
failedBatches.add(recipientList);
128+
}
129+
});
130+
131+
if (!failedBatches.isEmpty()) {
132+
throw new BadArgException("Failed to send emails for " + failedBatches);
125133
}
126-
});
127-
128-
if (!failedBatches.isEmpty()) {
129-
throw new BadArgException("Failed to send emails for " + failedBatches);
130134
}
131135
}
132136

@@ -154,4 +158,22 @@ public void setEmailFormat(String format) {
154158
throw new BadArgException(String.format("Email format must be either HTMLPART, MJMLPART or TEXTPART, got %s", format));
155159
}
156160
}
161+
162+
private void send(JSONObject from, JSONArray to, JSONArray bcc,
163+
String subject, String emailFormat, String content) throws MailjetException {
164+
JSONObject values = new JSONObject()
165+
.put(Emailv31.Message.FROM, from)
166+
.put(Emailv31.Message.TO, to)
167+
.put(Emailv31.Message.SUBJECT, subject)
168+
.put(emailFormat, content);
169+
if (bcc != null) {
170+
values.put(Emailv31.Message.BCC, bcc);
171+
}
172+
173+
MailjetRequest request = new MailjetRequest(Emailv31.resource)
174+
.property(Emailv31.MESSAGES, new JSONArray().put(values));
175+
MailjetResponse response = client.post(request);
176+
LOG.info("Mailjet response status: {}", response.getStatus());
177+
LOG.info("Mailjet response data: {}", response.getData());
178+
}
157179
}

web-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-ui",
3-
"version": "0.8.2",
3+
"version": "0.8.3",
44
"private": true,
55
"type": "module",
66
"dependencies": {

0 commit comments

Comments
 (0)