From 42ab851117f036ac336b3dae4c909a8a2a9ac742 Mon Sep 17 00:00:00 2001 From: upagge Date: Wed, 16 Sep 2020 06:35:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=8F=D0=B2=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../change/pullrequest/ReviewersPrChange.java | 4 ++-- .../service/impl/CommentServiceImpl.java | 2 +- .../service/impl/PullRequestsServiceImpl.java | 24 ++++++++++++++++++- .../service/impl/TaskServiceImpl.java | 2 +- .../v.2.0.0/2020-09-06-create-table.xml | 2 +- .../v.2.0.0/2020-09-06-cumulative.xml | 1 + .../v.2.0.0/2020-09-15-fix-task-comments.xml | 24 +++++++++++++++++++ 7 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/liquibase/v.2.0.0/2020-09-15-fix-task-comments.xml diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/pullrequest/ReviewersPrChange.java b/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/pullrequest/ReviewersPrChange.java index cb9c72e..1723667 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/pullrequest/ReviewersPrChange.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/domain/change/pullrequest/ReviewersPrChange.java @@ -63,9 +63,9 @@ public class ReviewersPrChange extends PrChange { ); } final String createMessage = stringBuilder.toString(); - return Smile.PEN + " *Изменения ревьюверов вашего ПР*" + + return Smile.PEN + " *Изменения ревьюверов PullRequest*" + Smile.HR + - "[" + title + "](" + url + ")\n" + + "[" + title + "](" + url + ")" + Smile.HR + createMessage; } } diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/CommentServiceImpl.java b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/CommentServiceImpl.java index 60e4bba..9be3b29 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/CommentServiceImpl.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/CommentServiceImpl.java @@ -125,7 +125,7 @@ public class CommentServiceImpl extends AbstractSimpleManagerService oldAnswerIds = oldComment.getAnswers(); final Set newAnswerIds = newComment.getAnswers(); - if (!newAnswerIds.isEmpty()) { + if (!oldAnswerIds.equals(newAnswerIds)) { final Set existsNewAnswersIds = commentRepository.existsById(newAnswerIds); final List newAnswers = commentRepository.findAllById(existsNewAnswersIds).stream() .filter(comment -> !oldAnswerIds.contains(comment.getId())) diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/PullRequestsServiceImpl.java b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/PullRequestsServiceImpl.java index 71ad4a3..fc4f9e4 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/PullRequestsServiceImpl.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/PullRequestsServiceImpl.java @@ -14,6 +14,7 @@ import org.sadtech.bot.bitbucketbot.domain.ReviewerStatus; import org.sadtech.bot.bitbucketbot.domain.change.pullrequest.ConflictPrChange; import org.sadtech.bot.bitbucketbot.domain.change.pullrequest.NewPrChange; import org.sadtech.bot.bitbucketbot.domain.change.pullrequest.ReviewersPrChange; +import org.sadtech.bot.bitbucketbot.domain.change.pullrequest.StatusPrChange; import org.sadtech.bot.bitbucketbot.domain.change.pullrequest.UpdatePrChange; import org.sadtech.bot.bitbucketbot.domain.entity.PullRequest; import org.sadtech.bot.bitbucketbot.domain.entity.PullRequestMini; @@ -104,8 +105,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService oldReviewers = oldPullRequest.getReviewers().stream() .collect(Collectors.toMap(Reviewer::getPersonLogin, reviewer -> reviewer)); diff --git a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java index 6cb9f42..740fbf6 100644 --- a/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java +++ b/src/main/java/org/sadtech/bot/bitbucketbot/service/impl/TaskServiceImpl.java @@ -126,7 +126,7 @@ public class TaskServiceImpl extends AbstractSimpleManagerService im private void updateAnswer(Task oldTask, Task task) { final Set oldAnswerIds = oldTask.getAnswers(); final Set newAnswerIds = task.getAnswers(); - if (!newAnswerIds.isEmpty()) { + if (!oldAnswerIds.equals(newAnswerIds)) { final Set existsNewAnswersIds = commentService.existsById(newAnswerIds); final List newAnswers = commentService.getAllById(existsNewAnswersIds).stream() .filter(comment -> !oldAnswerIds.contains(comment.getId())) diff --git a/src/main/resources/liquibase/v.2.0.0/2020-09-06-create-table.xml b/src/main/resources/liquibase/v.2.0.0/2020-09-06-create-table.xml index 1aa4394..02d3a18 100644 --- a/src/main/resources/liquibase/v.2.0.0/2020-09-06-create-table.xml +++ b/src/main/resources/liquibase/v.2.0.0/2020-09-06-create-table.xml @@ -174,7 +174,7 @@ - + diff --git a/src/main/resources/liquibase/v.2.0.0/2020-09-06-cumulative.xml b/src/main/resources/liquibase/v.2.0.0/2020-09-06-cumulative.xml index 5ec625e..2ff2041 100644 --- a/src/main/resources/liquibase/v.2.0.0/2020-09-06-cumulative.xml +++ b/src/main/resources/liquibase/v.2.0.0/2020-09-06-cumulative.xml @@ -4,5 +4,6 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> + \ No newline at end of file diff --git a/src/main/resources/liquibase/v.2.0.0/2020-09-15-fix-task-comments.xml b/src/main/resources/liquibase/v.2.0.0/2020-09-15-fix-task-comments.xml new file mode 100644 index 0000000..de774df --- /dev/null +++ b/src/main/resources/liquibase/v.2.0.0/2020-09-15-fix-task-comments.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + +