summaryrefslogtreecommitdiff
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-05 12:31:20 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-05 12:52:33 +0200
commitc980952cfbb7c14d36cdd1e4755615fd1eb3ff59 (patch)
tree82bb78095eec5b253adfe3d51711659198c330a0 /src/main/java/eu
parentbee2677e895eda5de109c103494791f73b56c256 (diff)
KB66 PostResource#postComment: Return Uni<Response>.
Change-Id: I58ea7a2abd24b2f45b80f401ad0506a698993a9b
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
index 569c535..1870709 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
@@ -26,6 +26,7 @@ import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.TemplateExtension;
import io.quarkus.qute.TemplateInstance;
import io.quarkus.security.identity.SecurityIdentity;
+import io.smallrye.mutiny.Uni;
import java.math.BigInteger;
import java.net.URI;
import java.net.URLEncoder;
@@ -47,7 +48,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
@@ -309,7 +309,7 @@ public abstract class PostResource {
@Produces(TEXT_PLAIN)
@Path("{id}/comments")
@Transactional
- public Response postComment(
+ public Uni<Response> postComment(
@PathParam("id") int postId,
@FormParam("message") @NotEmpty String message,
@FormParam("hashcash-salt") long hashcashSalt)
@@ -358,9 +358,10 @@ public abstract class PostResource {
.to(mailSenderAddress)
.bcc(admins.stream().map(x -> x.email).toArray(String[]::new))
.send();
- sendJob.subscribe().asCompletionStage().get(10000, TimeUnit.SECONDS);
-
- return Response.seeOther(UriBuilder.fromUri("/posts/{id}").build(postId)).build();
+ return sendJob
+ .onItem()
+ .transform(
+ unused -> Response.seeOther(UriBuilder.fromUri("/posts/{id}").build(postId)).build());
}
private String makeFeed(