fixes
This commit is contained in:
parent
39f364c22b
commit
7da67a11f0
@ -57,6 +57,9 @@ public class MergeRequest {
|
|||||||
@Column(name = "description")
|
@Column(name = "description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = "milestone")
|
||||||
|
private String milestone;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
@Column(name = "state")
|
@Column(name = "state")
|
||||||
private MergeRequestState state;
|
private MergeRequestState state;
|
||||||
|
@ -20,9 +20,10 @@ public class ConflictMrNotify extends MrNotify {
|
|||||||
String name,
|
String name,
|
||||||
String url,
|
String url,
|
||||||
String projectKey,
|
String projectKey,
|
||||||
String sourceBranch
|
String sourceBranch,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(mrId, projectKey, name, url);
|
super(mrId, projectKey, name, url, milestone);
|
||||||
this.sourceBranch = sourceBranch;
|
this.sourceBranch = sourceBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,10 @@ public class ConflictResolveMrNotify extends MrNotify {
|
|||||||
String name,
|
String name,
|
||||||
String url,
|
String url,
|
||||||
String projectKey,
|
String projectKey,
|
||||||
String sourceBranch
|
String sourceBranch,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(mrId, projectKey, name, url);
|
super(mrId, projectKey, name, url, milestone);
|
||||||
this.sourceBranch = sourceBranch;
|
this.sourceBranch = sourceBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,17 +10,20 @@ public abstract class MrNotify implements Notify {
|
|||||||
protected final String projectName;
|
protected final String projectName;
|
||||||
protected final String title;
|
protected final String title;
|
||||||
protected final String url;
|
protected final String url;
|
||||||
|
protected final String milestone;
|
||||||
|
|
||||||
protected MrNotify(
|
protected MrNotify(
|
||||||
Long mrId,
|
Long mrId,
|
||||||
String projectName,
|
String projectName,
|
||||||
String title,
|
String title,
|
||||||
String url
|
String url,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
this.mrId = mrId;
|
this.mrId = mrId;
|
||||||
this.projectName = projectName;
|
this.projectName = projectName;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
this.milestone = milestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ public class NewMrForAssignee extends NewMrNotify {
|
|||||||
Set<String> labels,
|
Set<String> labels,
|
||||||
@Singular List<String> reviewers,
|
@Singular List<String> reviewers,
|
||||||
String oldAssigneeName,
|
String oldAssigneeName,
|
||||||
String newAssigneeName
|
String newAssigneeName,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
mrId,
|
mrId,
|
||||||
@ -44,7 +45,8 @@ public class NewMrForAssignee extends NewMrNotify {
|
|||||||
projectName,
|
projectName,
|
||||||
targetBranch,
|
targetBranch,
|
||||||
sourceBranch,
|
sourceBranch,
|
||||||
labels
|
labels,
|
||||||
|
milestone
|
||||||
);
|
);
|
||||||
this.reviewers = reviewers;
|
this.reviewers = reviewers;
|
||||||
this.oldAssigneeName = oldAssigneeName;
|
this.oldAssigneeName = oldAssigneeName;
|
||||||
|
@ -27,7 +27,8 @@ public class NewMrForReview extends NewMrNotify {
|
|||||||
String targetBranch,
|
String targetBranch,
|
||||||
String sourceBranch,
|
String sourceBranch,
|
||||||
Set<String> labels,
|
Set<String> labels,
|
||||||
String assignee
|
String assignee,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
mrId,
|
mrId,
|
||||||
@ -38,7 +39,8 @@ public class NewMrForReview extends NewMrNotify {
|
|||||||
projectName,
|
projectName,
|
||||||
targetBranch,
|
targetBranch,
|
||||||
sourceBranch,
|
sourceBranch,
|
||||||
labels
|
labels,
|
||||||
|
milestone
|
||||||
);
|
);
|
||||||
this.assignee = assignee;
|
this.assignee = assignee;
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,10 @@ public abstract class NewMrNotify extends MrNotify {
|
|||||||
String projectName,
|
String projectName,
|
||||||
String targetBranch,
|
String targetBranch,
|
||||||
String sourceBranch,
|
String sourceBranch,
|
||||||
Set<String> labels
|
Set<String> labels,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(mrId, projectName, title, url);
|
super(mrId, projectName, title, url, milestone);
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.targetBranch = targetBranch;
|
this.targetBranch = targetBranch;
|
||||||
|
@ -23,9 +23,10 @@ public class StatusMrNotify extends MrNotify {
|
|||||||
String url,
|
String url,
|
||||||
String projectName,
|
String projectName,
|
||||||
MergeRequestState oldStatus,
|
MergeRequestState oldStatus,
|
||||||
MergeRequestState newStatus
|
MergeRequestState newStatus,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(mrId, projectName, name, url);
|
super(mrId, projectName, name, url, milestone);
|
||||||
this.oldStatus = oldStatus;
|
this.oldStatus = oldStatus;
|
||||||
this.newStatus = newStatus;
|
this.newStatus = newStatus;
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,10 @@ public class UpdateMrNotify extends MrNotify {
|
|||||||
Long allResolvedTasks,
|
Long allResolvedTasks,
|
||||||
Long personTasks,
|
Long personTasks,
|
||||||
Long personResolvedTasks,
|
Long personResolvedTasks,
|
||||||
String comment
|
String comment,
|
||||||
|
String milestone
|
||||||
) {
|
) {
|
||||||
super(mrId, projectName, name, url);
|
super(mrId, projectName, name, url, milestone);
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.allTasks = allTasks;
|
this.allTasks = allTasks;
|
||||||
this.allResolvedTasks = allResolvedTasks;
|
this.allResolvedTasks = allResolvedTasks;
|
||||||
|
@ -22,6 +22,7 @@ public class Icons {
|
|||||||
public static final String BUILD = "⚙️";
|
public static final String BUILD = "⚙️";
|
||||||
public static final String LINK = "\uD83D\uDD17";
|
public static final String LINK = "\uD83D\uDD17";
|
||||||
public static final String REVIEWER = "\uD83D\uDD0E";
|
public static final String REVIEWER = "\uD83D\uDD0E";
|
||||||
|
public static final String MILESTONE = "\uD83C\uDFAF";
|
||||||
public static final String PROJECT = "\uD83C\uDFD7";
|
public static final String PROJECT = "\uD83C\uDFD7";
|
||||||
public static final String DISABLE_NOTIFY = "\uD83D\uDD15";
|
public static final String DISABLE_NOTIFY = "\uD83D\uDD15";
|
||||||
public static final String YES = "✅";
|
public static final String YES = "✅";
|
||||||
|
@ -43,6 +43,10 @@ public class MergeRequestJsonConverter implements Converter<MergeRequestJson, Me
|
|||||||
convertLabels(mergeRequest, source.getLabels());
|
convertLabels(mergeRequest, source.getLabels());
|
||||||
convertReviewers(mergeRequest, source.getReviewers());
|
convertReviewers(mergeRequest, source.getReviewers());
|
||||||
|
|
||||||
|
if (checkNotNull(source.getMilestone())) {
|
||||||
|
mergeRequest.setMilestone(source.getMilestone().getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
if (checkNotNull(source.getAssignee())) {
|
if (checkNotNull(source.getAssignee())) {
|
||||||
mergeRequest.setAssignee(convertPerson.convert(source.getAssignee()));
|
mergeRequest.setAssignee(convertPerson.convert(source.getAssignee()));
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -122,6 +123,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.projectName(projectName)
|
.projectName(projectName)
|
||||||
.labels(mergeRequest.getLabels())
|
.labels(mergeRequest.getLabels())
|
||||||
.author(mergeRequest.getAuthor().getName())
|
.author(mergeRequest.getAuthor().getName())
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.description(mergeRequest.getDescription())
|
.description(mergeRequest.getDescription())
|
||||||
.title(mergeRequest.getTitle())
|
.title(mergeRequest.getTitle())
|
||||||
.url(mergeRequest.getWebUrl())
|
.url(mergeRequest.getWebUrl())
|
||||||
@ -146,10 +148,12 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.labels(mergeRequest.getLabels())
|
.labels(mergeRequest.getLabels())
|
||||||
.author(mergeRequest.getAuthor().getName())
|
.author(mergeRequest.getAuthor().getName())
|
||||||
.description(mergeRequest.getDescription())
|
.description(mergeRequest.getDescription())
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.title(mergeRequest.getTitle())
|
.title(mergeRequest.getTitle())
|
||||||
.url(mergeRequest.getWebUrl())
|
.url(mergeRequest.getWebUrl())
|
||||||
.targetBranch(mergeRequest.getTargetBranch())
|
.targetBranch(mergeRequest.getTargetBranch())
|
||||||
.sourceBranch(mergeRequest.getSourceBranch())
|
.sourceBranch(mergeRequest.getSourceBranch())
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.reviewers(mergeRequest.getReviewers().stream().map(Person::getName).toList());
|
.reviewers(mergeRequest.getReviewers().stream().map(Person::getName).toList());
|
||||||
|
|
||||||
if (checkNotNull(oldAssigneeName)) {
|
if (checkNotNull(oldAssigneeName)) {
|
||||||
@ -180,8 +184,9 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
|
|
||||||
final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate()) || oldMergeRequest.isConflict() != mergeRequest.isConflict();
|
final boolean isChangedMr = !oldMergeRequest.getUpdatedDate().equals(mergeRequest.getUpdatedDate()) || oldMergeRequest.isConflict() != mergeRequest.isConflict();
|
||||||
final boolean isChangedLinkedEntity = reviewerChanged.isChanged() || assigneeChanged.isChanged();
|
final boolean isChangedLinkedEntity = reviewerChanged.isChanged() || assigneeChanged.isChanged();
|
||||||
|
final boolean isMilestone = !Objects.equals(oldMergeRequest.getMilestone(), mergeRequest.getMilestone());
|
||||||
|
|
||||||
if (isChangedMr || isChangedLinkedEntity) {
|
if (isChangedMr || isChangedLinkedEntity || isMilestone) {
|
||||||
|
|
||||||
if (oldMergeRequest.isNotification()) {
|
if (oldMergeRequest.isNotification()) {
|
||||||
final Project project = projectService.getByIdOrThrow(mergeRequest.getProjectId());
|
final Project project = projectService.getByIdOrThrow(mergeRequest.getProjectId());
|
||||||
@ -198,6 +203,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
notifyAssignee(assigneeChanged, oldMergeRequest, mergeRequest, project);
|
notifyAssignee(assigneeChanged, oldMergeRequest, mergeRequest, project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return repository.save(mergeRequest);
|
return repository.save(mergeRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,6 +332,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.projectName(project.getName())
|
.projectName(project.getName())
|
||||||
.url(oldMergeRequest.getWebUrl())
|
.url(oldMergeRequest.getWebUrl())
|
||||||
.allTasks(allTask)
|
.allTasks(allTask)
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.allResolvedTasks(resolvedTask)
|
.allResolvedTasks(resolvedTask)
|
||||||
.personTasks(allYouTasks)
|
.personTasks(allYouTasks)
|
||||||
.personResolvedTasks(resolvedYouTask);
|
.personResolvedTasks(resolvedYouTask);
|
||||||
@ -352,6 +359,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.name(mergeRequest.getTitle())
|
.name(mergeRequest.getTitle())
|
||||||
.url(mergeRequest.getWebUrl())
|
.url(mergeRequest.getWebUrl())
|
||||||
.projectKey(project.getName())
|
.projectKey(project.getName())
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -372,6 +380,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.name(mergeRequest.getTitle())
|
.name(mergeRequest.getTitle())
|
||||||
.url(mergeRequest.getWebUrl())
|
.url(mergeRequest.getWebUrl())
|
||||||
.projectKey(project.getName())
|
.projectKey(project.getName())
|
||||||
|
.milestone(mergeRequest.getMilestone())
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -395,6 +404,7 @@ public class MergeRequestsServiceImpl implements MergeRequestsService {
|
|||||||
.projectName(project.getName())
|
.projectName(project.getName())
|
||||||
.newStatus(newStatus)
|
.newStatus(newStatus)
|
||||||
.oldStatus(oldStatus)
|
.oldStatus(oldStatus)
|
||||||
|
.milestone(newMergeRequest.getMilestone())
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class PipelineParser {
|
|||||||
final LocalDateTime newLastUpdate = LocalDateTime.now();
|
final LocalDateTime newLastUpdate = LocalDateTime.now();
|
||||||
final List<ForkJoinTask<List<PipelineShortJson>>> tasks = projectIds.stream()
|
final List<ForkJoinTask<List<PipelineShortJson>>> tasks = projectIds.stream()
|
||||||
.map(projectId -> new GetPipelineShortTask(
|
.map(projectId -> new GetPipelineShortTask(
|
||||||
gitlabProperty.getPipelineUrl(),
|
gitlabProperty.getPipelinesUrl(),
|
||||||
projectId,
|
projectId,
|
||||||
lastUpdate,
|
lastUpdate,
|
||||||
personProperty.getToken()
|
personProperty.getToken()
|
||||||
|
@ -97,10 +97,10 @@ public class HttpParse {
|
|||||||
isNotNull(classOfT);
|
isNotNull(classOfT);
|
||||||
final HttpUrl url = httpUrlBuilder.build();
|
final HttpUrl url = httpUrlBuilder.build();
|
||||||
final Request request = requestBuilder.url(url).build();
|
final Request request = requestBuilder.url(url).build();
|
||||||
log.debug("Выполняется okhttp3 запрос | {}", url);
|
log.trace("Выполняется okhttp3 запрос | {}", url);
|
||||||
final OkHttpClient httpClient = getNewClient();
|
final OkHttpClient httpClient = getNewClient();
|
||||||
try (Response execute = httpClient.newCall(request).execute()) {
|
try (Response execute = httpClient.newCall(request).execute()) {
|
||||||
log.debug("Запрос выполнен | {}", url);
|
log.trace("Запрос выполнен | {}", url);
|
||||||
ResponseBody body = execute.body();
|
ResponseBody body = execute.body();
|
||||||
if (execute.isSuccessful() && checkNotNull(body)) {
|
if (execute.isSuccessful() && checkNotNull(body)) {
|
||||||
final String stringBody = body.string();
|
final String stringBody = body.string();
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
<databaseChangeLog
|
||||||
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd">
|
||||||
|
|
||||||
|
<changeSet id="2024-08-21-add-milestone" author="mstruchkov">
|
||||||
|
<addColumn tableName="merge_request">
|
||||||
|
<column name="milestone" type="varchar">
|
||||||
|
<constraints nullable="true"/>
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
@ -8,5 +8,6 @@
|
|||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<include file="2024-02-06-change-varchar.xml" relativeToChangelogFile="true"/>
|
<include file="2024-02-06-change-varchar.xml" relativeToChangelogFile="true"/>
|
||||||
|
<include file="2024-08-21-add-milestone.xml" relativeToChangelogFile="true"/>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
@ -41,6 +41,7 @@ public class MergeRequestJson {
|
|||||||
private PersonJson author;
|
private PersonJson author;
|
||||||
private PersonJson assignee;
|
private PersonJson assignee;
|
||||||
|
|
||||||
|
private MilestoneJson milestone;
|
||||||
private List<PersonJson> reviewers;
|
private List<PersonJson> reviewers;
|
||||||
|
|
||||||
@JsonProperty("web_url")
|
@JsonProperty("web_url")
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package dev.struchkov.bot.gitlab.sdk.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MilestoneJson {
|
||||||
|
private Long id;
|
||||||
|
private String title;
|
||||||
|
}
|
8
pom.xml
8
pom.xml
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
<godfather.telegram.version>1.0.0-SNAPSHOT</godfather.telegram.version>
|
<godfather.telegram.version>1.0.0-SNAPSHOT</godfather.telegram.version>
|
||||||
<!-- https://mvnrepository.com/artifact/dev.struchkov.haiti/haiti-utils -->
|
<!-- https://mvnrepository.com/artifact/dev.struchkov.haiti/haiti-utils -->
|
||||||
<haiti.utils.version>3.0.2</haiti.utils.version>
|
<haiti.utils.version>3.0.3</haiti.utils.version>
|
||||||
<haiti.utils.fields.version>1.1.1</haiti.utils.fields.version>
|
<haiti.utils.fields.version>1.1.1</haiti.utils.fields.version>
|
||||||
<haiti.filter.version>0.0.5</haiti.filter.version>
|
<haiti.filter.version>0.0.5</haiti.filter.version>
|
||||||
|
|
||||||
@ -53,12 +53,12 @@
|
|||||||
<jakarta.persistance.version>3.2.0-M1</jakarta.persistance.version>
|
<jakarta.persistance.version>3.2.0-M1</jakarta.persistance.version>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||||
<google.guava.version>33.0.0-jre</google.guava.version>
|
<google.guava.version>33.3.0-jre</google.guava.version>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
|
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
|
||||||
<plugin.maven.compiler.ver>3.12.1</plugin.maven.compiler.ver>
|
<plugin.maven.compiler.ver>3.13.0</plugin.maven.compiler.ver>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
|
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
|
||||||
<plugin.maven.release.ver>3.0.1</plugin.maven.release.ver>
|
<plugin.maven.release.ver>3.1.1</plugin.maven.release.ver>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -8,6 +8,7 @@ import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
|||||||
import dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload;
|
import dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -20,6 +21,7 @@ import java.util.stream.Collectors;
|
|||||||
*
|
*
|
||||||
* @author upagge 17.09.2020
|
* @author upagge 17.09.2020
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class MessageSendTelegramService implements MessageSendService {
|
public class MessageSendTelegramService implements MessageSendService {
|
||||||
|
|
||||||
@ -45,6 +47,7 @@ public class MessageSendTelegramService implements MessageSendService {
|
|||||||
final BoxAnswer answer = generator.generate(notify);
|
final BoxAnswer answer = generator.generate(notify);
|
||||||
answer.setRecipientIfNull(personInformation.getTelegramId());
|
answer.setRecipientIfNull(personInformation.getTelegramId());
|
||||||
answer.addPayload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true);
|
answer.addPayload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true);
|
||||||
|
log.debug("Будет отправлено следующее уведомление: {}. Текст: {}", answer, answer.getMessage());
|
||||||
return answer;
|
return answer;
|
||||||
})
|
})
|
||||||
.ifPresent(sending::send);
|
.ifPresent(sending::send);
|
||||||
|
@ -14,6 +14,7 @@ import static dev.struchkov.godfather.telegram.domain.keyboard.SimpleKeyBoardLin
|
|||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
||||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
||||||
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -26,7 +27,13 @@ public class ConflictPrNotifyGenerator implements NotifyBoxAnswerGenerator<Confl
|
|||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(escapeMarkdown(notify.getTitle()))
|
.append(escapeMarkdown(notify.getTitle()))
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n")
|
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder.append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder
|
||||||
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch()));
|
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch()));
|
||||||
|
|
||||||
final String notifyMessage = builder.toString();
|
final String notifyMessage = builder.toString();
|
||||||
|
@ -14,6 +14,7 @@ import static dev.struchkov.godfather.telegram.domain.keyboard.SimpleKeyBoardLin
|
|||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
||||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
||||||
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -26,7 +27,13 @@ public class ConflictResolvePrNotifyGenerator implements NotifyBoxAnswerGenerato
|
|||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(escapeMarkdown(notify.getTitle()))
|
.append(escapeMarkdown(notify.getTitle()))
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n")
|
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder.append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder
|
||||||
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch()));
|
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch()));
|
||||||
|
|
||||||
final String notifyMessage = builder.toString();
|
final String notifyMessage = builder.toString();
|
||||||
|
@ -48,6 +48,10 @@ public class NewMrForAssigneeNotifyGenerator implements NotifyBoxAnswerGenerator
|
|||||||
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch())).append(Icons.ARROW).append(escapeMarkdown(notify.getTargetBranch())).append("\n")
|
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch())).append(Icons.ARROW).append(escapeMarkdown(notify.getTargetBranch())).append("\n")
|
||||||
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor()).append("\n");
|
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor()).append("\n");
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder.append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
final List<String> reviewers = notify.getReviewers();
|
final List<String> reviewers = notify.getReviewers();
|
||||||
if (checkNotEmpty(reviewers)) {
|
if (checkNotEmpty(reviewers)) {
|
||||||
builder.append(Icons.REVIEWER).append(": ").append(String.join(", ", reviewers)).append("\n");
|
builder.append(Icons.REVIEWER).append(": ").append(String.join(", ", reviewers)).append("\n");
|
||||||
|
@ -43,6 +43,10 @@ public class NewMrForReviewNotifyGenerator implements NotifyBoxAnswerGenerator<N
|
|||||||
builder.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
builder.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder.append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch())).append(Icons.ARROW).append(escapeMarkdown(notify.getTargetBranch())).append("\n")
|
.append(Icons.TREE).append(": ").append(escapeMarkdown(notify.getSourceBranch())).append(Icons.ARROW).append(escapeMarkdown(notify.getTargetBranch())).append("\n")
|
||||||
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor()).append("\n");
|
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor()).append("\n");
|
||||||
|
@ -11,6 +11,7 @@ import static dev.struchkov.godfather.telegram.domain.keyboard.SimpleKeyBoardLin
|
|||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
||||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.ENABLE_MARKDOWN;
|
||||||
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -22,7 +23,14 @@ public class StatusMrNotifyGenerator implements NotifyBoxAnswerGenerator<StatusM
|
|||||||
final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed*")
|
final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed*")
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(escapeMarkdown(notify.getTitle())).append("\n\n")
|
.append(escapeMarkdown(notify.getTitle())).append("\n\n")
|
||||||
.append(notify.getOldStatus().name()).append(Icons.ARROW).append(notify.getNewStatus().name())
|
.append(notify.getOldStatus().name()).append(Icons.ARROW).append(notify.getNewStatus().name());
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder
|
||||||
|
.append("\n").append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName()));
|
.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName()));
|
||||||
|
|
||||||
|
@ -48,6 +48,10 @@ public class UpdateMrNotifyGenerator implements NotifyBoxAnswerGenerator<UpdateM
|
|||||||
builder.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
builder.append(Icons.PROJECT).append(": ").append(escapeMarkdown(notify.getProjectName())).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkNotNull(notify.getMilestone())) {
|
||||||
|
builder.append(Icons.MILESTONE).append(": ").append(notify.getMilestone()).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor());
|
.append(Icons.AUTHOR).append(": ").append(notify.getAuthor());
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ public class DeleteMessageUnit implements PersonUnitConfiguration {
|
|||||||
})
|
})
|
||||||
.answer(mail -> {
|
.answer(mail -> {
|
||||||
final ButtonClickAttachment clickButton = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow();
|
final ButtonClickAttachment clickButton = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow();
|
||||||
telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().getId());
|
//TODO [21.08.2024|uPagge]: fixme
|
||||||
|
telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().get().getId());
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,8 @@ public class DisableNotifyMrUnit implements PersonUnitConfiguration {
|
|||||||
|
|
||||||
if (confirmation) {
|
if (confirmation) {
|
||||||
mergeRequestsService.notification(false, mrId);
|
mergeRequestsService.notification(false, mrId);
|
||||||
scheduledExecutorService.schedule(() -> telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().getId()), 5, TimeUnit.SECONDS);
|
//TODO [21.08.2024|uPagge]: fixme
|
||||||
|
scheduledExecutorService.schedule(() -> telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().get().getId()), 5, TimeUnit.SECONDS);
|
||||||
return replaceBoxAnswer(SUCCESSFULLY_DISABLED);
|
return replaceBoxAnswer(SUCCESSFULLY_DISABLED);
|
||||||
} else {
|
} else {
|
||||||
return replaceBoxAnswer(
|
return replaceBoxAnswer(
|
||||||
|
@ -73,7 +73,8 @@ public class DisableNotifyThreadUnit implements PersonUnitConfiguration {
|
|||||||
|
|
||||||
if (confirmation) {
|
if (confirmation) {
|
||||||
discussionService.notification(false, discussionId);
|
discussionService.notification(false, discussionId);
|
||||||
scheduledExecutorService.schedule(() -> telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().getId()), 5, TimeUnit.SECONDS);
|
//TODO [21.08.2024|uPagge]: fixme
|
||||||
|
scheduledExecutorService.schedule(() -> telegramSending.deleteMessage(mail.getFromPersonId(), clickButton.getMessage().get().getId()), 5, TimeUnit.SECONDS);
|
||||||
return replaceBoxAnswer(SUCCESSFULLY_DISABLED);
|
return replaceBoxAnswer(SUCCESSFULLY_DISABLED);
|
||||||
} else {
|
} else {
|
||||||
return replaceBoxAnswer(
|
return replaceBoxAnswer(
|
||||||
|
@ -24,6 +24,7 @@ import dev.struchkov.godfather.telegram.starter.PersonUnitConfiguration;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -218,6 +219,8 @@ public class InitSettingFlow implements PersonUnitConfiguration {
|
|||||||
final String personId = mail.getFromPersonId();
|
final String personId = mail.getFromPersonId();
|
||||||
final String messageId = Attachments.findFirstButtonClick(mail.getAttachments())
|
final String messageId = Attachments.findFirstButtonClick(mail.getAttachments())
|
||||||
.map(ButtonClickAttachment::getMessage)
|
.map(ButtonClickAttachment::getMessage)
|
||||||
|
//TODO [21.08.2024|uPagge]: fixme
|
||||||
|
.map(Optional::get)
|
||||||
.map(Mail::getId)
|
.map(Mail::getId)
|
||||||
.orElseThrow();
|
.orElseThrow();
|
||||||
sending.send(
|
sending.send(
|
||||||
@ -407,6 +410,8 @@ public class InitSettingFlow implements PersonUnitConfiguration {
|
|||||||
final String personId = mail.getFromPersonId();
|
final String personId = mail.getFromPersonId();
|
||||||
final String messageId = Attachments.findFirstButtonClick(mail.getAttachments())
|
final String messageId = Attachments.findFirstButtonClick(mail.getAttachments())
|
||||||
.map(ButtonClickAttachment::getMessage)
|
.map(ButtonClickAttachment::getMessage)
|
||||||
|
//TODO [21.08.2024|uPagge]: fixme
|
||||||
|
.map(Optional::get)
|
||||||
.map(Message::getId)
|
.map(Message::getId)
|
||||||
.orElseThrow();
|
.orElseThrow();
|
||||||
sending.send(
|
sending.send(
|
||||||
|
Loading…
Reference in New Issue
Block a user