Добавил идентификацыию реп в уведомления
This commit is contained in:
parent
5dd2f32986
commit
0bb74203ea
@ -14,18 +14,20 @@ public class ConflictPrNotify extends PrNotify {
|
||||
private ConflictPrNotify(
|
||||
Set<String> recipients,
|
||||
String name,
|
||||
String url
|
||||
String url,
|
||||
String projectKey,
|
||||
String repositorySlug
|
||||
) {
|
||||
super(recipients, name, url);
|
||||
super(recipients, projectKey, repositorySlug, name, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Внимание конфликт в ПР*" +
|
||||
"{0} *Внимание конфликт в ПР | {4} | {5}*" +
|
||||
"{1}" +
|
||||
"[{2}]({3})\n\n",
|
||||
Smile.DANGEROUS, Smile.HR, title, url
|
||||
Smile.DANGEROUS, Smile.HR, title, url, projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -16,16 +16,22 @@ import java.util.Set;
|
||||
public class ForgottenSmartPrNotify extends PrNotify {
|
||||
|
||||
@Builder
|
||||
protected ForgottenSmartPrNotify(Set<String> recipients, String title, String url) {
|
||||
super(recipients, title, url);
|
||||
protected ForgottenSmartPrNotify(
|
||||
Set<String> recipients,
|
||||
String title,
|
||||
String url,
|
||||
String projectKey,
|
||||
String repositorySlug
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, title, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Напоминание о просмотре PullRequest*" +
|
||||
"{0} *Напоминание о просмотре PullRequest | {4} | {5}*" +
|
||||
"{3}[{1}]({2})",
|
||||
Smile.SMART, title, url, Smile.HR
|
||||
Smile.SMART, title, url, Smile.HR, projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,11 @@ public class NewPrNotify extends PrNotify {
|
||||
String title,
|
||||
String url,
|
||||
String description,
|
||||
String author) {
|
||||
super(recipients, title, url);
|
||||
String author,
|
||||
String projectKey,
|
||||
String repositorySlug
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, title, url);
|
||||
this.description = description;
|
||||
this.author = author;
|
||||
}
|
||||
@ -28,12 +31,12 @@ public class NewPrNotify extends PrNotify {
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Новый Pull Request*{1}" +
|
||||
"{0} *Новый PullRequest | {7} | {8}*{1}" +
|
||||
"[{2}]({3})" +
|
||||
"{1}{4}{5}: {6}\n\n",
|
||||
Smile.FUN, Smile.HR, title, url,
|
||||
(description != null && !"".equals(description)) ? escapeMarkdown(description) + Smile.HR : "",
|
||||
Smile.AUTHOR, author
|
||||
Smile.AUTHOR, author, projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,21 @@ import java.util.Set;
|
||||
@Getter
|
||||
public abstract class PrNotify extends Notify {
|
||||
|
||||
protected final String projectKey;
|
||||
protected final String repositorySlug;
|
||||
protected final String title;
|
||||
protected final String url;
|
||||
|
||||
protected PrNotify(Set<String> recipients, String title, String url) {
|
||||
protected PrNotify(
|
||||
Set<String> recipients,
|
||||
String projectKey,
|
||||
String repositorySlug,
|
||||
String title,
|
||||
String url
|
||||
) {
|
||||
super(EntityType.PERSON, recipients);
|
||||
this.projectKey = projectKey;
|
||||
this.repositorySlug = repositorySlug;
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
}
|
||||
|
@ -24,8 +24,11 @@ public class ReviewersPrNotify extends PrNotify {
|
||||
Set<String> recipients,
|
||||
String title,
|
||||
String url,
|
||||
List<ReviewerChange> reviewerChanges) {
|
||||
super(recipients, title, url);
|
||||
String projectKey,
|
||||
String repositorySlug,
|
||||
List<ReviewerChange> reviewerChanges
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, title, url);
|
||||
this.reviewerChanges = reviewerChanges;
|
||||
}
|
||||
|
||||
@ -60,7 +63,7 @@ public class ReviewersPrNotify extends PrNotify {
|
||||
);
|
||||
}
|
||||
final String createMessage = stringBuilder.toString();
|
||||
return Smile.PEN + " *Изменения ревьюверов | PullRequest*" +
|
||||
return Smile.PEN + " *Изменения ревьюверов PullRequest | " + projectKey + " | " + repositorySlug + "*" +
|
||||
Smile.HR +
|
||||
"[" + title + "](" + url + ")" + Smile.HR +
|
||||
createMessage;
|
||||
|
@ -19,19 +19,27 @@ public class SmartPrNotify extends PrNotify {
|
||||
private final Reviewer reviewerTriggered;
|
||||
|
||||
@Builder
|
||||
protected SmartPrNotify(Set<String> recipients, String title, String url, Reviewer reviewerTriggered) {
|
||||
super(recipients, title, url);
|
||||
protected SmartPrNotify(
|
||||
Set<String> recipients,
|
||||
String title,
|
||||
String url,
|
||||
String projectKey,
|
||||
String repositorySlug,
|
||||
Reviewer reviewerTriggered
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, title, url);
|
||||
this.reviewerTriggered = reviewerTriggered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Напоминание о просмотре PullRequest*" +
|
||||
"{0} *Напоминание о PullRequest | {6} | {7}*" +
|
||||
"{3}[{1}]({2})" +
|
||||
"{3}" +
|
||||
"{4} изменил свое решение на {5}\n\n",
|
||||
Smile.SMART, title, url, Smile.HR, reviewerTriggered.getPersonLogin(), reviewerTriggered.getStatus().getValue()
|
||||
Smile.SMART, title, url, Smile.HR, reviewerTriggered.getPersonLogin(), reviewerTriggered.getStatus().getValue(),
|
||||
projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,12 @@ public class StatusPrNotify extends PrNotify {
|
||||
Set<String> recipients,
|
||||
String name,
|
||||
String url,
|
||||
String projectKey,
|
||||
String repositorySlug,
|
||||
PullRequestStatus oldStatus,
|
||||
PullRequestStatus newStatus) {
|
||||
super(recipients, name, url);
|
||||
PullRequestStatus newStatus
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, name, url);
|
||||
this.oldStatus = oldStatus;
|
||||
this.newStatus = newStatus;
|
||||
}
|
||||
@ -29,10 +32,10 @@ public class StatusPrNotify extends PrNotify {
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Изменился статус вашего ПР*{1}" +
|
||||
"{0} *Изменился статус PullRequest | {7} | {8}*{1}" +
|
||||
"[{2}]({3}){1}" +
|
||||
"{4} {5} {6}\n\n",
|
||||
Smile.PEN, Smile.HR, title, url, oldStatus.name(), Smile.ARROW, newStatus.name()
|
||||
Smile.PEN, Smile.HR, title, url, oldStatus.name(), Smile.ARROW, newStatus.name(), projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -16,19 +16,23 @@ public class UpdatePrNotify extends PrNotify {
|
||||
private UpdatePrNotify(
|
||||
Set<String> recipients,
|
||||
String name,
|
||||
String url, String author) {
|
||||
super(recipients, name, url);
|
||||
String url,
|
||||
String author,
|
||||
String projectKey,
|
||||
String repositorySlug
|
||||
) {
|
||||
super(recipients, projectKey, repositorySlug, name, url);
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateMessage() {
|
||||
return MessageFormat.format(
|
||||
"{0} *Обновление PullRequest*\n" +
|
||||
"{0} *Обновление PullRequest | {6} | {7}*{3}" +
|
||||
"[{1}]({2})" +
|
||||
"{3}" +
|
||||
"{4}: {5}\n\n",
|
||||
Smile.UPDATE, title, url, Smile.HR, Smile.AUTHOR, author
|
||||
Smile.UPDATE, title, url, Smile.HR, Smile.AUTHOR, author, projectKey, repositorySlug
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
.description(newPullRequest.getDescription())
|
||||
.title(newPullRequest.getTitle())
|
||||
.url(newPullRequest.getUrl())
|
||||
.projectKey(newPullRequest.getProjectKey())
|
||||
.repositorySlug(newPullRequest.getRepositorySlug())
|
||||
.recipients(
|
||||
newPullRequest.getReviewers().stream()
|
||||
.map(Reviewer::getPersonLogin)
|
||||
@ -122,6 +124,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
if (!smartReviewers.isEmpty()) {
|
||||
notifyService.send(
|
||||
ForgottenSmartPrNotify.builder()
|
||||
.projectKey(pullRequest.getProjectKey())
|
||||
.repositorySlug(pullRequest.getRepositorySlug())
|
||||
.recipients(smartReviewers)
|
||||
.title(pullRequest.getTitle())
|
||||
.url(pullRequest.getUrl())
|
||||
@ -132,7 +136,9 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
}
|
||||
|
||||
private void updateBitbucketVersion(PullRequest oldPullRequest, PullRequest pullRequest) {
|
||||
if (!oldPullRequest.getBitbucketVersion().equals(pullRequest.getBitbucketVersion())) {
|
||||
if (
|
||||
!oldPullRequest.getBitbucketVersion().equals(pullRequest.getBitbucketVersion())
|
||||
) {
|
||||
oldPullRequest.setBitbucketVersion(pullRequest.getBitbucketVersion());
|
||||
notifyService.send(
|
||||
UpdatePrNotify.builder()
|
||||
@ -144,6 +150,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
.collect(Collectors.toSet())
|
||||
)
|
||||
.url(oldPullRequest.getUrl())
|
||||
.projectKey(oldPullRequest.getProjectKey())
|
||||
.repositorySlug(oldPullRequest.getRepositorySlug())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
@ -155,6 +163,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
ConflictPrNotify.builder()
|
||||
.name(pullRequest.getTitle())
|
||||
.url(pullRequest.getUrl())
|
||||
.projectKey(pullRequest.getProjectKey())
|
||||
.repositorySlug(pullRequest.getRepositorySlug())
|
||||
.recipients(Collections.singleton(pullRequest.getAuthorLogin()))
|
||||
.build()
|
||||
);
|
||||
@ -171,6 +181,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
StatusPrNotify.builder()
|
||||
.name(newPullRequest.getTitle())
|
||||
.url(oldPullRequest.getUrl())
|
||||
.projectKey(oldPullRequest.getProjectKey())
|
||||
.repositorySlug(oldPullRequest.getRepositorySlug())
|
||||
.newStatus(newStatus)
|
||||
.oldStatus(oldStatus)
|
||||
.recipients(Collections.singleton(oldPullRequest.getAuthorLogin()))
|
||||
@ -234,6 +246,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
ReviewersPrNotify.builder()
|
||||
.title(newPullRequest.getTitle())
|
||||
.url(newPullRequest.getUrl())
|
||||
.projectKey(newPullRequest.getProjectKey())
|
||||
.repositorySlug(newPullRequest.getRepositorySlug())
|
||||
.recipients(Collections.singleton(newPullRequest.getAuthorLogin()))
|
||||
.reviewerChanges(reviewerChanges)
|
||||
.build()
|
||||
@ -256,6 +270,8 @@ public class PullRequestsServiceImpl extends AbstractSimpleManagerService<PullRe
|
||||
.reviewerTriggered(newReviewer)
|
||||
.title(oldPullRequest.getTitle())
|
||||
.url(oldPullRequest.getUrl())
|
||||
.projectKey(oldPullRequest.getProjectKey())
|
||||
.repositorySlug(oldPullRequest.getRepositorySlug())
|
||||
.recipients(
|
||||
smartReviewers.stream()
|
||||
.map(Reviewer::getPersonLogin)
|
||||
|
Loading…
Reference in New Issue
Block a user