Рефакторинг
This commit is contained in:
parent
f02f80d606
commit
93258c6f88
@ -78,7 +78,7 @@ public class DiscussionServiceImpl implements DiscussionService {
|
|||||||
discussion.setNotification(true);
|
discussion.setNotification(true);
|
||||||
|
|
||||||
if (isNeedNotifyNewNote(discussion)) {
|
if (isNeedNotifyNewNote(discussion)) {
|
||||||
notifyNewDiscussion(discussion);
|
notifyNewThread(discussion);
|
||||||
} else {
|
} else {
|
||||||
notes.forEach(note -> notificationPersonal(discussion, note));
|
notes.forEach(note -> notificationPersonal(discussion, note));
|
||||||
}
|
}
|
||||||
@ -131,33 +131,6 @@ public class DiscussionServiceImpl implements DiscussionService {
|
|||||||
return repository.save(discussion);
|
return repository.save(discussion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Уведомляет пользователя, если появился новый комментарий</p>
|
|
||||||
*/
|
|
||||||
private void notifyNewDiscussion(Discussion discussion) {
|
|
||||||
final Note firstNote = discussion.getFirstNote();
|
|
||||||
final List<Note> notes = discussion.getNotes();
|
|
||||||
|
|
||||||
final MergeRequestForDiscussion mergeRequest = discussion.getMergeRequest();
|
|
||||||
final DiscussionNewNotify.DiscussionNewNotifyBuilder notifyBuilder = DiscussionNewNotify.builder()
|
|
||||||
.threadId(discussion.getId())
|
|
||||||
.mrName(mergeRequest.getTitle())
|
|
||||||
.authorName(firstNote.getAuthor().getName())
|
|
||||||
.discussionMessage(firstNote.getBody())
|
|
||||||
.url(firstNote.getWebUrl());
|
|
||||||
|
|
||||||
if (notes.size() > 1) {
|
|
||||||
for (int i = 1; i < notes.size(); i++) {
|
|
||||||
final Note note = notes.get(i);
|
|
||||||
notifyBuilder.note(
|
|
||||||
new Pair<>(note.getAuthor().getName(), note.getBody())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyService.send(notifyBuilder.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isNeedNotifyNewNote(Discussion discussion) {
|
private boolean isNeedNotifyNewNote(Discussion discussion) {
|
||||||
final Note firstNote = discussion.getFirstNote();
|
final Note firstNote = discussion.getFirstNote();
|
||||||
final Long gitlabUserId = personInformation.getId();
|
final Long gitlabUserId = personInformation.getId();
|
||||||
@ -349,7 +322,7 @@ public class DiscussionServiceImpl implements DiscussionService {
|
|||||||
/**
|
/**
|
||||||
* Уведомляет пользователя, если его никнейм упоминается в комментарии.
|
* Уведомляет пользователя, если его никнейм упоминается в комментарии.
|
||||||
*/
|
*/
|
||||||
protected void notificationPersonal(Discussion discussion, Note note) {
|
private void notificationPersonal(Discussion discussion, Note note) {
|
||||||
final DiscussionLevel discussionLevel = settingService.getLevelDiscussionNotify();
|
final DiscussionLevel discussionLevel = settingService.getLevelDiscussionNotify();
|
||||||
if (!WITHOUT_NOTIFY.equals(discussionLevel)) {
|
if (!WITHOUT_NOTIFY.equals(discussionLevel)) {
|
||||||
final Matcher matcher = PATTERN.matcher(note.getBody());
|
final Matcher matcher = PATTERN.matcher(note.getBody());
|
||||||
@ -390,4 +363,39 @@ public class DiscussionServiceImpl implements DiscussionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Уведомляет пользователя, если появился новый комментарий</p>
|
||||||
|
*/
|
||||||
|
private void notifyNewThread(Discussion discussion) {
|
||||||
|
final DiscussionLevel discussionLevel = settingService.getLevelDiscussionNotify();
|
||||||
|
if (!WITHOUT_NOTIFY.equals(discussionLevel)) {
|
||||||
|
final Note firstNote = discussion.getFirstNote();
|
||||||
|
|
||||||
|
final MergeRequestForDiscussion mergeRequest = discussion.getMergeRequest();
|
||||||
|
DiscussionNewNotify.DiscussionNewNotifyBuilder messageBuilder = DiscussionNewNotify.builder()
|
||||||
|
.threadId(discussion.getId())
|
||||||
|
.mrName(mergeRequest.getTitle())
|
||||||
|
.authorName(firstNote.getAuthor().getName());
|
||||||
|
|
||||||
|
if (NOTIFY_WITH_CONTEXT.equals(discussionLevel)) {
|
||||||
|
final List<Note> notes = discussion.getNotes();
|
||||||
|
|
||||||
|
messageBuilder
|
||||||
|
.discussionMessage(firstNote.getBody())
|
||||||
|
.url(firstNote.getWebUrl());
|
||||||
|
|
||||||
|
if (notes.size() > 1) {
|
||||||
|
for (int i = 1; i < notes.size(); i++) {
|
||||||
|
final Note note = notes.get(i);
|
||||||
|
messageBuilder.note(
|
||||||
|
new Pair<>(note.getAuthor().getName(), note.getBody())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyService.send(messageBuilder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,11 @@ import dev.struchkov.godfather.telegram.main.context.TelegramConnect;
|
|||||||
import dev.struchkov.godfather.telegram.simple.consumer.EventDistributorService;
|
import dev.struchkov.godfather.telegram.simple.consumer.EventDistributorService;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.EventDistributor;
|
import dev.struchkov.godfather.telegram.simple.context.service.EventDistributor;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
||||||
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramService;
|
||||||
import dev.struchkov.godfather.telegram.simple.core.MailAutoresponderTelegram;
|
import dev.struchkov.godfather.telegram.simple.core.MailAutoresponderTelegram;
|
||||||
import dev.struchkov.godfather.telegram.simple.core.TelegramConnectBot;
|
import dev.struchkov.godfather.telegram.simple.core.TelegramConnectBot;
|
||||||
import dev.struchkov.godfather.telegram.simple.core.service.SenderMapRepository;
|
import dev.struchkov.godfather.telegram.simple.core.service.SenderMapRepository;
|
||||||
|
import dev.struchkov.godfather.telegram.simple.core.service.TelegramServiceImpl;
|
||||||
import dev.struchkov.godfather.telegram.simple.sender.TelegramSender;
|
import dev.struchkov.godfather.telegram.simple.sender.TelegramSender;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -58,6 +60,11 @@ public class TelegramBotConfig {
|
|||||||
return Executors.newFixedThreadPool(3);
|
return Executors.newFixedThreadPool(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public TelegramService telegramService(TelegramConnect telegramConnect) {
|
||||||
|
return new TelegramServiceImpl(telegramConnect);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public StorylineContext storylineContext() {
|
public StorylineContext storylineContext() {
|
||||||
return new StorylineContextMapImpl();
|
return new StorylineContextMapImpl();
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
package dev.struchkov.bot.gitlab.telegram.service;
|
package dev.struchkov.bot.gitlab.telegram.service;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty;
|
||||||
import dev.struchkov.godfather.main.domain.content.Message;
|
import dev.struchkov.godfather.main.domain.content.Message;
|
||||||
import dev.struchkov.godfather.simple.context.service.ErrorHandler;
|
import dev.struchkov.godfather.simple.context.service.ErrorHandler;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ErrorHandlerService implements ErrorHandler {
|
public class ErrorHandlerService implements ErrorHandler {
|
||||||
|
|
||||||
|
private final PersonProperty personProperty;
|
||||||
private final TelegramSending telegramSending;
|
private final TelegramSending telegramSending;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Message message, Exception e) {
|
public void handle(Message message, Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
final BoxAnswer boxAnswer = boxAnswer(e.getMessage());
|
final BoxAnswer boxAnswer = boxAnswer(e.getMessage());
|
||||||
boxAnswer.setRecipientIfNull(message.getPersonId());
|
boxAnswer.setRecipientIfNull(personProperty.getTelegramId());
|
||||||
telegramSending.send(boxAnswer);
|
telegramSending.send(boxAnswer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import dev.struchkov.bot.gitlab.context.domain.PersonInformation;
|
|||||||
import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
|
||||||
import dev.struchkov.bot.gitlab.context.service.MessageSendService;
|
import dev.struchkov.bot.gitlab.context.service.MessageSendService;
|
||||||
import dev.struchkov.bot.gitlab.telegram.service.notify.NotifyBoxAnswerGenerator;
|
import dev.struchkov.bot.gitlab.telegram.service.notify.NotifyBoxAnswerGenerator;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package dev.struchkov.bot.gitlab.telegram.service;
|
package dev.struchkov.bot.gitlab.telegram.service;
|
||||||
|
|
||||||
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
|
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.simple.context.service.PreSendProcessing;
|
import dev.struchkov.godfather.simple.domain.action.PreSendProcessing;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service;
|
|||||||
import dev.struchkov.bot.gitlab.context.service.AppSettingService;
|
import dev.struchkov.bot.gitlab.context.service.AppSettingService;
|
||||||
import dev.struchkov.bot.gitlab.core.config.properties.AppProperty;
|
import dev.struchkov.bot.gitlab.core.config.properties.AppProperty;
|
||||||
import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty;
|
import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
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 jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
@ -44,7 +44,6 @@ public class StartNotify {
|
|||||||
)
|
)
|
||||||
.payload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true)
|
.payload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
sending.send(boxAnswer);
|
sending.send(boxAnswer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,16 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictMrNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictMrNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
@ -2,16 +2,16 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictResolveMrNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictResolveMrNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.comment.NewCommentNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.comment.NewCommentNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -10,8 +10,8 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Checker.checkNotNull;
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
|
@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForAssignee;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForAssignee;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,9 +12,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Checker.checkNotEmpty;
|
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
|
||||||
|
@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForReview;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForReview;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -11,9 +11,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Checker.checkNotNull;
|
import static dev.struchkov.haiti.utils.Checker.checkNotNull;
|
||||||
|
@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
import dev.struchkov.bot.gitlab.context.domain.notify.project.NewProjectNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.project.NewProjectNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.bot.gitlab.telegram.utils.Const;
|
import dev.struchkov.bot.gitlab.telegram.utils.Const;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.haiti.utils.Checker;
|
import dev.struchkov.haiti.utils.Checker;
|
||||||
import dev.struchkov.haiti.utils.Strings;
|
import dev.struchkov.haiti.utils.Strings;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -11,9 +11,9 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
@ -2,7 +2,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.task.DiscussionNewNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.task.DiscussionNewNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.haiti.utils.Pair;
|
import dev.struchkov.haiti.utils.Pair;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -13,15 +13,15 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMAT
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_THREAD_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Checker.checkNotEmpty;
|
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
|
||||||
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class DiscussionNewNotifyGenerator implements NotifyBoxAnswerGenerator<DiscussionNewNotify> {
|
public class NewThreadNotifyGenerator implements NotifyBoxAnswerGenerator<DiscussionNewNotify> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BoxAnswer generate(DiscussionNewNotify notify) {
|
public BoxAnswer generate(DiscussionNewNotify notify) {
|
@ -1,6 +1,7 @@
|
|||||||
package dev.struchkov.bot.gitlab.telegram.service.notify;
|
package dev.struchkov.bot.gitlab.telegram.service.notify;
|
||||||
|
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -3,7 +3,7 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
import dev.struchkov.bot.gitlab.context.domain.notify.pipeline.PipelineNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.pipeline.PipelineNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.service.ProjectService;
|
import dev.struchkov.bot.gitlab.context.service.ProjectService;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.haiti.utils.Strings;
|
import dev.struchkov.haiti.utils.Strings;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -11,9 +11,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.button.UrlButton.urlButton;
|
||||||
|
|
||||||
|
@ -2,21 +2,21 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.StatusMrNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.StatusMrNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.context.utils.Icons.link;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class StatusPrNotifyGenerator implements NotifyBoxAnswerGenerator<StatusMrNotify> {
|
public class StatusMrNotifyGenerator implements NotifyBoxAnswerGenerator<StatusMrNotify> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BoxAnswer generate(StatusMrNotify notify) {
|
public BoxAnswer generate(StatusMrNotify notify) {
|
||||||
|
|
||||||
final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed | ").append(notify.getProjectName()).append("*")
|
final StringBuilder builder = new StringBuilder(Icons.PEN).append(" *MergeRequest status changed*")
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(link(notify.getTitle(), notify.getUrl()))
|
.append(escapeMarkdown(notify.getTitle()))
|
||||||
.append(Icons.HR)
|
.append(Icons.HR)
|
||||||
.append(notify.getOldStatus().name()).append(Icons.ARROW).append(notify.getNewStatus().name());
|
.append(notify.getOldStatus().name()).append(Icons.ARROW).append(notify.getNewStatus().name());
|
||||||
|
|
@ -2,15 +2,15 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.task.TaskCloseNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.task.TaskCloseNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.context.utils.Icons.link;
|
import static dev.struchkov.bot.gitlab.context.utils.Icons.link;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
import static dev.struchkov.haiti.utils.Strings.escapeMarkdown;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class TaskCloseNotifyGenerate implements NotifyBoxAnswerGenerator<TaskCloseNotify> {
|
public class ThreadCloseNotifyGenerate implements NotifyBoxAnswerGenerator<TaskCloseNotify> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BoxAnswer generate(TaskCloseNotify notify) {
|
public BoxAnswer generate(TaskCloseNotify notify) {
|
@ -2,23 +2,23 @@ package dev.struchkov.bot.gitlab.telegram.service.notify;
|
|||||||
|
|
||||||
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.UpdateMrNotify;
|
import dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.UpdateMrNotify;
|
||||||
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
import dev.struchkov.bot.gitlab.context.utils.Icons;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_CONFIRMATION;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_NOTIFY_MR_ID;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_FALSE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
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.haiti.utils.Checker.checkNotNull;
|
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
|
||||||
public class UpdatePrNotifyGenerator implements NotifyBoxAnswerGenerator<UpdateMrNotify> {
|
public class UpdateMrNotifyGenerator implements NotifyBoxAnswerGenerator<UpdateMrNotify> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BoxAnswer generate(UpdateMrNotify notify) {
|
public BoxAnswer generate(UpdateMrNotify notify) {
|
@ -11,15 +11,16 @@ import dev.struchkov.bot.gitlab.context.utils.Icons;
|
|||||||
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
|
import dev.struchkov.bot.gitlab.core.config.properties.GitlabProperty;
|
||||||
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
|
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
|
||||||
import dev.struchkov.bot.gitlab.telegram.utils.UnitName;
|
import dev.struchkov.bot.gitlab.telegram.utils.UnitName;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.annotation.Unit;
|
import dev.struchkov.godfather.main.domain.annotation.Unit;
|
||||||
import dev.struchkov.godfather.main.domain.content.Mail;
|
import dev.struchkov.godfather.main.domain.content.Mail;
|
||||||
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
||||||
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment;
|
import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment;
|
||||||
import dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard;
|
import dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard;
|
||||||
import dev.struchkov.godfather.telegram.main.context.MailPayload;
|
import dev.struchkov.godfather.telegram.main.context.MailPayload;
|
||||||
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
||||||
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramService;
|
||||||
import dev.struchkov.haiti.utils.Checker;
|
import dev.struchkov.haiti.utils.Checker;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -36,10 +37,10 @@ import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.GET_ASSIGNEE_MERG
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.GET_TASKS;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.GET_TASKS;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.SETTINGS;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.SETTINGS;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_ADD_NEW_PROJECT;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_ADD_NEW_PROJECT;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.clickButtonRaw;
|
import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.clickButtonRaw;
|
||||||
import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.isLinks;
|
import static dev.struchkov.godfather.telegram.simple.core.util.TriggerChecks.isLinks;
|
||||||
@ -59,6 +60,7 @@ public class MenuConfig {
|
|||||||
|
|
||||||
private final ProjectParser projectParser;
|
private final ProjectParser projectParser;
|
||||||
|
|
||||||
|
private final TelegramService telegramService;
|
||||||
private final ProjectService projectService;
|
private final ProjectService projectService;
|
||||||
private final NoteService noteService;
|
private final NoteService noteService;
|
||||||
private final MergeRequestsService mergeRequestsService;
|
private final MergeRequestsService mergeRequestsService;
|
||||||
@ -79,7 +81,10 @@ public class MenuConfig {
|
|||||||
).append("\n")
|
).append("\n")
|
||||||
.append("\uD83D\uDCAC: ").append(message.getText())
|
.append("\uD83D\uDCAC: ").append(message.getText())
|
||||||
.toString();
|
.toString();
|
||||||
return BoxAnswer.builder().recipientPersonId(personInformation.getTelegramId()).message(messageText).build();
|
return BoxAnswer.builder()
|
||||||
|
.recipientPersonId(personInformation.getTelegramId())
|
||||||
|
.message(messageText)
|
||||||
|
.build();
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,17 @@ import dev.struchkov.godfather.main.domain.content.Mail;
|
|||||||
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
||||||
import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment;
|
import dev.struchkov.godfather.telegram.domain.attachment.LinkAttachment;
|
||||||
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
|
||||||
import dev.struchkov.haiti.utils.Checker;
|
import dev.struchkov.haiti.utils.Checker;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.ANSWER_NOTE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.ANSWER_NOTE;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -34,8 +32,6 @@ public class AnswerNoteUnit {
|
|||||||
private final AppSettingService settingService;
|
private final AppSettingService settingService;
|
||||||
private final NoteService noteService;
|
private final NoteService noteService;
|
||||||
private final DiscussionService discussionService;
|
private final DiscussionService discussionService;
|
||||||
private final ScheduledExecutorService scheduledExecutorService;
|
|
||||||
private final TelegramSending telegramSending;
|
|
||||||
|
|
||||||
//TODO [07.02.2023|uPagge]: Можно возвращать ссылку на ответ
|
//TODO [07.02.2023|uPagge]: Можно возвращать ссылку на ответ
|
||||||
@Unit(value = ANSWER_NOTE, global = true)
|
@Unit(value = ANSWER_NOTE, global = true)
|
||||||
|
@ -22,9 +22,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_N
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_MR;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_MR;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -22,9 +22,9 @@ import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_DISABLE_N
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_VALUE_TRUE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_THREAD;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DISABLE_NOTIFY_THREAD;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -22,7 +22,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_ENABLE_NOTIFY_PROJECT_ID;
|
import static dev.struchkov.bot.gitlab.telegram.utils.Const.BUTTON_ARG_ENABLE_NOTIFY_PROJECT_ID;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer;
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -65,7 +65,7 @@ public class EnableProjectNotify {
|
|||||||
return replaceBoxAnswer(mail.getId(), Icons.GOOD + " you will now receive notifications!");
|
return replaceBoxAnswer(mail.getId(), Icons.GOOD + " you will now receive notifications!");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.<Integer>callBack(
|
.callBack(
|
||||||
sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 5, TimeUnit.SECONDS)
|
sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 5, TimeUnit.SECONDS)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
@ -11,11 +11,11 @@ import dev.struchkov.bot.gitlab.core.service.parser.DiscussionParser;
|
|||||||
import dev.struchkov.bot.gitlab.core.service.parser.MergeRequestParser;
|
import dev.struchkov.bot.gitlab.core.service.parser.MergeRequestParser;
|
||||||
import dev.struchkov.bot.gitlab.core.service.parser.PipelineParser;
|
import dev.struchkov.bot.gitlab.core.service.parser.PipelineParser;
|
||||||
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
|
import dev.struchkov.bot.gitlab.core.service.parser.ProjectParser;
|
||||||
import dev.struchkov.godfather.main.domain.BoxAnswer;
|
|
||||||
import dev.struchkov.godfather.main.domain.annotation.Unit;
|
import dev.struchkov.godfather.main.domain.annotation.Unit;
|
||||||
import dev.struchkov.godfather.main.domain.content.Mail;
|
import dev.struchkov.godfather.main.domain.content.Mail;
|
||||||
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
import dev.struchkov.godfather.simple.core.unit.AnswerText;
|
||||||
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
import dev.struchkov.godfather.simple.core.unit.MainUnit;
|
||||||
|
import dev.struchkov.godfather.simple.domain.BoxAnswer;
|
||||||
import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment;
|
import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment;
|
||||||
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
import dev.struchkov.godfather.telegram.main.core.util.Attachments;
|
||||||
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
|
||||||
@ -42,10 +42,10 @@ import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PARSER_PRIVA
|
|||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING;
|
||||||
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING_THREAD_LEVEL;
|
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.TEXT_PRIVACY_SETTING_THREAD_LEVEL;
|
||||||
import static dev.struchkov.godfather.main.core.unit.UnitActiveType.AFTER;
|
import static dev.struchkov.godfather.main.core.unit.UnitActiveType.AFTER;
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.boxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.BoxAnswer.replaceBoxAnswer;
|
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
|
||||||
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
import static dev.struchkov.godfather.main.domain.keyboard.simple.SimpleKeyBoardLine.simpleLine;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.boxAnswer;
|
||||||
|
import static dev.struchkov.godfather.simple.domain.BoxAnswer.replaceBoxAnswer;
|
||||||
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
|
||||||
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
|
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
|
||||||
import static dev.struchkov.godfather.telegram.main.core.util.InlineKeyBoards.verticalMenuButton;
|
import static dev.struchkov.godfather.telegram.main.core.util.InlineKeyBoards.verticalMenuButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user