From cb9ddea57ed12def017ecbefa3a6c66a80f0448c Mon Sep 17 00:00:00 2001 From: uPagge Date: Fri, 5 Feb 2021 19:58:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=81=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B1=D0=B0=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot-app/src/main/resources/application.yaml | 2 +- .../bot/gitlab/core/service/parser/NoteParser.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bot-app/src/main/resources/application.yaml b/bot-app/src/main/resources/application.yaml index 38c962b..5517a6c 100644 --- a/bot-app/src/main/resources/application.yaml +++ b/bot-app/src/main/resources/application.yaml @@ -22,7 +22,7 @@ telegram-config: bot-username: ${TELEGRAM_BOT_USERNAME} bot-token: ${TELEGRAM_BOT_TOKEN} gitlab-bot: - version: 0.0.3 Beta + version: 0.0.4 Beta person: telegram-id: ${TELEGRAM_PERSON_ID} token: ${GITLAB_PERSONAL_TOKEN} diff --git a/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java b/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java index 03e684b..a9c5a33 100644 --- a/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java +++ b/bot-core/src/main/java/org/sadtech/bot/gitlab/core/service/parser/NoteParser.java @@ -122,6 +122,14 @@ public class NoteParser { ) .collect(Collectors.toList()); + final Set newNoteIds = newNotes.stream().map(Task::getId).collect(Collectors.toSet()); + + final ExistsContainer existsNoteContainer = noteService.existsById(newNoteIds); + + if (existsContainer.getContainer() != null && !existsContainer.getContainer().isEmpty()) { + noteService.deleteAllById(existsNoteContainer.getContainer().stream().map(Note::getId).collect(Collectors.toSet())); + } + final List newTasks = taskService.createAll(newNotes); newTasks.forEach(task -> noteService.link(task.getId(), mergeRequest.getId())); }