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

#1606 context loader listener not initialized during controller tests #1608

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 @@ -51,18 +51,20 @@ public String handleSubmit(
if (StringUtils.isBlank(contributor.getMotivation())) {
// The Contributor completed the on-boarding wizard for the first time

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/contributor/" + contributor.getId();
String embedThumbnailUrl = null;
if (StringUtils.isNotBlank(contributor.getImageUrl())) {
embedThumbnailUrl = contributor.getImageUrl();
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/contributor/" + contributor.getId();
String embedThumbnailUrl = null;
if (StringUtils.isNotBlank(contributor.getImageUrl())) {
embedThumbnailUrl = contributor.getImageUrl();
}
DiscordHelper.sendChannelMessage(
"Contributor joined: " + contentUrl,
contributor.getFirstName() + " " + contributor.getLastName(),
"Motivation: \"" + motivation + "\"",
null,
embedThumbnailUrl
);
}
DiscordHelper.sendChannelMessage(
"Contributor joined: " + contentUrl,
contributor.getFirstName() + " " + contributor.getLastName(),
"Motivation: \"" + motivation + "\"",
null,
embedThumbnailUrl
);
}

contributor.setMotivation(motivation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ public String handleSubmit(
letterContributionEvent.setPlatform(Platform.WEBAPP);
letterContributionEventDao.create(letterContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter/edit/" + letter.getId();
DiscordHelper.sendChannelMessage(
"Letter created: " + contentUrl,
"\"" + letterContributionEvent.getLetter().getText() + "\"",
"Comment: \"" + letterContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter/edit/" + letter.getId();
DiscordHelper.sendChannelMessage(
"Letter created: " + contentUrl,
"\"" + letterContributionEvent.getLetter().getText() + "\"",
"Comment: \"" + letterContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/letter/list#" + letter.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ public String handleSubmit(
letterContributionEvent.setPlatform(Platform.WEBAPP);
letterContributionEventDao.create(letterContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter/edit/" + letter.getId();
DiscordHelper.sendChannelMessage(
"Letter edited: " + contentUrl,
"\"" + letterContributionEvent.getLetter().getText() + "\"",
"Comment: \"" + letterContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter/edit/" + letter.getId();
DiscordHelper.sendChannelMessage(
"Letter edited: " + contentUrl,
"\"" + letterContributionEvent.getLetter().getText() + "\"",
"Comment: \"" + letterContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/letter/list#" + letter.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,16 @@ public String handleSubmit(
letterSoundCorrespondenceContributionEvent.setPlatform(Platform.WEBAPP);
letterSoundCorrespondenceContributionEventDao.create(letterSoundCorrespondenceContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter-sound-correspondence/edit/" + letterSoundCorrespondence.getId();
DiscordHelper.sendChannelMessage(
"Letter-sound correspondence created: " + contentUrl,
"\"" + letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining()) + "\"",
"Comment: \"" + letterSoundCorrespondenceContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter-sound-correspondence/edit/" + letterSoundCorrespondence.getId();
DiscordHelper.sendChannelMessage(
"Letter-sound correspondence created: " + contentUrl,
"\"" + letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining()) + "\"",
"Comment: \"" + letterSoundCorrespondenceContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/letter-sound-correspondence/list#" + letterSoundCorrespondence.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ public String handleSubmit(
letterSoundCorrespondenceContributionEvent.setPlatform(Platform.WEBAPP);
letterSoundCorrespondenceContributionEventDao.create(letterSoundCorrespondenceContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter-sound-correspondence/edit/" + letterSoundCorrespondence.getId();
DiscordHelper.sendChannelMessage(
"Letter-sound correspondence edited: " + contentUrl,
"\"" + letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining()) + "\"",
"Comment: \"" + letterSoundCorrespondenceContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/letter-sound-correspondence/edit/" + letterSoundCorrespondence.getId();
DiscordHelper.sendChannelMessage(
"Letter-sound correspondence edited: " + contentUrl,
"\"" + letterSoundCorrespondence.getLetters().stream().map(Letter::getText).collect(Collectors.joining()) + "\"",
"Comment: \"" + letterSoundCorrespondenceContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/letter-sound-correspondence/list#" + letterSoundCorrespondence.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,16 @@ public String handleSubmit(
audioContributionEvent.setPlatform(Platform.WEBAPP);
audioContributionEventDao.create(audioContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audio.getId();
DiscordHelper.sendChannelMessage(
"Audio created: " + contentUrl,
"\"" + audio.getTranscription() + "\"",
"Comment: \"" + audioContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audio.getId();
DiscordHelper.sendChannelMessage(
"Audio created: " + contentUrl,
"\"" + audio.getTranscription() + "\"",
"Comment: \"" + audioContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/multimedia/audio/list#" + audio.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,16 @@ public String handleSubmit(
audioContributionEvent.setPlatform(Platform.WEBAPP);
audioContributionEventDao.create(audioContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audio.getId();
DiscordHelper.sendChannelMessage(
"Audio edited: " + contentUrl,
"\"" + audio.getTranscription() + "\"",
"Comment: \"" + audioContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audio.getId();
DiscordHelper.sendChannelMessage(
"Audio edited: " + contentUrl,
"\"" + audio.getTranscription() + "\"",
"Comment: \"" + audioContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/multimedia/audio/list#" + audio.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,17 @@ public String handleSubmit(
imageContributionEvent.setPlatform(Platform.WEBAPP);
imageContributionEventDao.create(imageContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/image/" + image.getId() + "_r" + image.getRevisionNumber() + "." + image.getImageFormat().toString().toLowerCase();
DiscordHelper.sendChannelMessage(
"Image created: " + contentUrl,
"\"" + image.getTitle() + "\"",
"Comment: \"" + imageContributionEvent.getComment() + "\"",
null,
embedThumbnailUrl
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/image/" + image.getId() + "_r" + image.getRevisionNumber() + "." + image.getImageFormat().toString().toLowerCase();
DiscordHelper.sendChannelMessage(
"Image created: " + contentUrl,
"\"" + image.getTitle() + "\"",
"Comment: \"" + imageContributionEvent.getComment() + "\"",
null,
embedThumbnailUrl
);
}

return "redirect:/content/multimedia/image/list#" + image.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,17 @@ public String handleSubmit(
imageContributionEvent.setPlatform(Platform.WEBAPP);
imageContributionEventDao.create(imageContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/image/" + image.getId() + "_r" + image.getRevisionNumber() + "." + image.getImageFormat().toString().toLowerCase();
DiscordHelper.sendChannelMessage(
"Image edited: " + contentUrl,
"\"" + image.getTitle() + "\"",
"Comment: \"" + imageContributionEvent.getComment() + "\"",
null,
embedThumbnailUrl
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/image/" + image.getId() + "_r" + image.getRevisionNumber() + "." + image.getImageFormat().toString().toLowerCase();
DiscordHelper.sendChannelMessage(
"Image edited: " + contentUrl,
"\"" + image.getTitle() + "\"",
"Comment: \"" + imageContributionEvent.getComment() + "\"",
null,
embedThumbnailUrl
);
}

return "redirect:/content/multimedia/image/list#" + image.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ public String handleSubmit(
numberContributionEvent.setPlatform(Platform.WEBAPP);
numberContributionEventDao.create(numberContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/number/edit/" + number.getId();
DiscordHelper.sendChannelMessage(
"Number created: " + contentUrl,
String.valueOf(numberContributionEvent.getNumber().getValue()),
"Comment: \"" + numberContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/number/edit/" + number.getId();
DiscordHelper.sendChannelMessage(
"Number created: " + contentUrl,
String.valueOf(numberContributionEvent.getNumber().getValue()),
"Comment: \"" + numberContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/number/list#" + number.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ public String handleSubmit(
numberContributionEvent.setPlatform(Platform.WEBAPP);
numberContributionEventDao.create(numberContributionEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/number/edit/" + number.getId();
DiscordHelper.sendChannelMessage(
"Number edited: " + contentUrl,
String.valueOf(numberContributionEvent.getNumber().getValue()),
"Comment: \"" + numberContributionEvent.getComment() + "\"",
null,
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/number/edit/" + number.getId();
DiscordHelper.sendChannelMessage(
"Number edited: " + contentUrl,
String.valueOf(numberContributionEvent.getNumber().getValue()),
"Comment: \"" + numberContributionEvent.getComment() + "\"",
null,
null
);
}

return "redirect:/content/number/list#" + number.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ public String handleSubmit(
audioPeerReviewEvent.setPlatform(Platform.WEBAPP);
audioPeerReviewEventDao.create(audioPeerReviewEvent);

String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audioContributionEvent.getAudio().getId();
DiscordHelper.sendChannelMessage(
"Audio peer-reviewed: " + contentUrl,
"\"" + audioContributionEvent.getAudio().getTitle() + "\"",
"Comment: \"" + audioPeerReviewEvent.getComment() + "\"",
audioPeerReviewEvent.isApproved(),
null
);
if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "https://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/audio/edit/" + audioContributionEvent.getAudio().getId();
DiscordHelper.sendChannelMessage(
"Audio peer-reviewed: " + contentUrl,
"\"" + audioContributionEvent.getAudio().getTitle() + "\"",
"Comment: \"" + audioPeerReviewEvent.getComment() + "\"",
audioPeerReviewEvent.isApproved(),
null
);
}

// Update the audio's peer review status
int approvedCount = 0;
Expand Down
Loading