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

Export to csv #1941

Merged
merged 4 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -81,6 +81,7 @@ public class ImageEditController {
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String handleRequest(
HttpServletRequest request,
HttpSession session,
Model model,
@PathVariable Long id) {
logger.info("handleRequest");
Expand All @@ -89,10 +90,32 @@ public String handleRequest(

if (image.getCid() == null) {
// Pin file to IPFS
long timeMillisBeforePinning = System.currentTimeMillis();
String filename = request.getServerName() + "_image" + image.getId() + "-r" + image.getRevisionNumber() + "_" + image.getTitle();
String ipfsHash = IpfsHelper.pinFileToIpfs(image.getBytes(), filename);
image.setCid(ipfsHash);
imageDao.update(image);

jo-elimu marked this conversation as resolved.
Show resolved Hide resolved
ImageContributionEvent imageContributionEvent = new ImageContributionEvent();
imageContributionEvent.setContributor((Contributor) session.getAttribute("contributor"));
imageContributionEvent.setTimestamp(Calendar.getInstance());
imageContributionEvent.setImage(image);
imageContributionEvent.setRevisionNumber(image.getRevisionNumber());
imageContributionEvent.setComment("Pinned file to IPFS (🤖 auto-generated comment)");
imageContributionEvent.setTimeSpentMs(System.currentTimeMillis() - timeMillisBeforePinning);
imageContributionEventDao.create(imageContributionEvent);
jo-elimu marked this conversation as resolved.
Show resolved Hide resolved

if (!EnvironmentContextLoaderListener.PROPERTIES.isEmpty()) {
String contentUrl = "http://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = image.getUrl();
DiscordHelper.sendChannelMessage(
"Image edited: " + contentUrl,
"\"" + image.getTitle() + "\"",
"Comment: \"" + imageContributionEvent.getComment() + "\"",
null,
embedThumbnailUrl
);
}
jo-elimu marked this conversation as resolved.
Show resolved Hide resolved
}

model.addAttribute("image", image);
Expand Down Expand Up @@ -208,8 +231,8 @@ public String handleSubmit(
imageContributionEventDao.create(imageContributionEvent);

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();
String contentUrl = "http://" + EnvironmentContextLoaderListener.PROPERTIES.getProperty("content.language").toLowerCase() + ".elimu.ai/content/multimedia/image/edit/" + image.getId();
String embedThumbnailUrl = image.getUrl();
DiscordHelper.sendChannelMessage(
"Image edited: " + contentUrl,
"\"" + image.getTitle() + "\"",
Expand Down
Loading
Loading