diff --git a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java index 4b18a09..efcb154 100644 --- a/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java +++ b/bot-core/bot-core-quarkus/src/main/java/dev/struchkov/godfather/quarkus/core/action/AnswerSaveAction.java @@ -24,28 +24,30 @@ public class AnswerSaveAction implements ActionUnit, M final AnswerSave answerSave = unitRequest.getUnit(); final Message message = unitRequest.getMessage(); - final AnswerSavePreservable preservable = answerSave.getPreservable(); - final String personId = message.getFromPersonId(); - final CheckSave checkSave = answerSave.getCheckSave(); if (checkNotNull(checkSave)) { return Uni.createFrom().voidItem() .onItem().transformToUni( v -> checkSave.check(message) - .onItem().transform( + .onItem().ifNotNull().transformToUni( unit -> { if (checkNotNull(unit)) { - return UnitRequest.of(unit, message); + return Uni.createFrom().item(UnitRequest.of(unit, message)); } - return UnitRequest.of(answerSave, message); + return getUnitRequestUni(answerSave, message); } ) ); } + return getUnitRequestUni(answerSave, message); + } + + private Uni> getUnitRequestUni(AnswerSave answerSave, Message message) { + final String personId = message.getFromPersonId(); + final AnswerSavePreservable preservable = answerSave.getPreservable(); final PreservableData preservableData = answerSave.getPreservableData(); final Pusher pusher = answerSave.getPusher(); - return Uni.createFrom().voidItem() .onItem().transformToUni( v -> {