From 6e9cd1fe1a63748e334abcc09f4a7a9d26600b91 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Mon, 16 Jan 2023 17:53:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B1=D0=B0=D0=B3,=20=D0=B8=D0=B7-=D0=B7=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=81=D0=BB=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=BD=D0=B5=20=D0=BF=D1=80=D0=B8=D1=85?= =?UTF-8?q?=D0=BE=D0=B4=D0=B8=D0=BB=D0=B8=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE?= =?UTF-8?q?=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/service/impl/DiscussionServiceImpl.java | 14 ++++++++------ .../gitlab/data/jpa/DiscussionJpaRepository.java | 6 ++++++ .../gitlab/telegram/unit/flow/InitSettingFlow.java | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java index aff089b..834262b 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/DiscussionServiceImpl.java @@ -111,9 +111,9 @@ public class DiscussionServiceImpl implements DiscussionService { final Note firstNote = discussion.getFirstNote(); final Long gitlabUserId = personInformation.getId(); return firstNote.isResolvable() // Тип комментария требует решения (Задачи) - && gitlabUserId.equals(discussion.getResponsible().getId()) // Ответственный за дискуссию пользователь - && !gitlabUserId.equals(firstNote.getAuthor().getId()) // Создатель комментария не пользователь системы - && FALSE.equals(firstNote.getResolved()); // Комментарий не отмечен как решенный + && gitlabUserId.equals(discussion.getResponsible().getId()) // Ответственный за дискуссию пользователь + && !gitlabUserId.equals(firstNote.getAuthor().getId()) // Создатель комментария не пользователь системы + && FALSE.equals(firstNote.getResolved()); // Комментарий не отмечен как решенный } @Override @@ -238,9 +238,9 @@ public class DiscussionServiceImpl implements DiscussionService { private boolean isResolved(Note note, Note oldNote) { return oldNote.getResolvedBy() == null - && note.getResolvedBy() != null - && personInformation.getId().equals(oldNote.getAuthor().getId()) - && !note.getResolvedBy().getId().equals(oldNote.getAuthor().getId()); + && note.getResolvedBy() != null + && personInformation.getId().equals(oldNote.getAuthor().getId()) + && !note.getResolvedBy().getId().equals(oldNote.getAuthor().getId()); } @@ -306,11 +306,13 @@ public class DiscussionServiceImpl implements DiscussionService { } @Override + @Transactional public void deleteById(@NonNull String discussionId) { repository.deleteById(discussionId); } @Override + @Transactional public void cleanOld() { log.debug("Старт очистки старых дискуссий"); repository.cleanOld(); diff --git a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java index e0d1e70..7393f61 100644 --- a/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java +++ b/bot-data/src/main/java/dev/struchkov/bot/gitlab/data/jpa/DiscussionJpaRepository.java @@ -2,7 +2,9 @@ package dev.struchkov.bot.gitlab.data.jpa; import dev.struchkov.bot.gitlab.context.domain.entity.Discussion; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import java.util.List; import java.util.Set; @@ -22,4 +24,8 @@ public interface DiscussionJpaRepository extends JpaRepository { context.save(mail.getPersonId(), Keys.INIT_SETTING_FINISH, Boolean.TRUE); - settingService.isEnableAllNotify(); + settingService.turnOnAllNotify(); settingService.disableFirstStart(); return boxAnswer(""" Configuration completed successfully