Привел в порядок имена переменных для urls
This commit is contained in:
parent
a5e706a524
commit
b8c3fc6b25
@ -18,50 +18,54 @@ public class GitlabProperty {
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
/**
|
||||
* Адрес, по которому можно получить открытые ПР
|
||||
*/
|
||||
private String urlMergeRequestOpen;
|
||||
|
||||
/**
|
||||
* Адрес, по которому можно получить закрытые ПР
|
||||
*/
|
||||
private String urlMergeRequestClose;
|
||||
|
||||
/**
|
||||
* Адрес, по которому можно получить комментарии к ПР
|
||||
*/
|
||||
private String urlMergeRequestComment;
|
||||
|
||||
/**
|
||||
* Адрес ПР
|
||||
*/
|
||||
private String urlMergeRequest;
|
||||
|
||||
private String urlProject;
|
||||
|
||||
private String userUrl;
|
||||
private String replaceUrl;
|
||||
|
||||
private String usersUrl;
|
||||
|
||||
private String urlMergeRequestAdd;
|
||||
private String userUrl;
|
||||
|
||||
private String urlNote;
|
||||
private String projectsUrl;
|
||||
|
||||
private String urlNoteApi;
|
||||
/**
|
||||
* Адрес, по которому можно получить открытые MR
|
||||
*/
|
||||
private String openMergeRequestsUrl;
|
||||
|
||||
private String urlPipelines;
|
||||
/**
|
||||
* Адрес, по которому можно получить закрытые MR
|
||||
*/
|
||||
private String closeMergeRequestsUrl;
|
||||
|
||||
private String urlPipeline;
|
||||
/**
|
||||
* Адрес, по которому можно получить комментарии к MR
|
||||
*/
|
||||
private String commentsOfMergeRequestUrl;
|
||||
|
||||
private String urlCommit;
|
||||
/**
|
||||
* Адрес MR
|
||||
*/
|
||||
private String mergeRequestUrl;
|
||||
|
||||
private String urlNewNote;
|
||||
private String projectAddUrl;
|
||||
|
||||
private String urlDiscussion;
|
||||
private String noteUrl;
|
||||
|
||||
private String urlOneDiscussion;
|
||||
private String notesOfMergeRequestUrl;
|
||||
|
||||
private String pipelinesUrl;
|
||||
|
||||
private String pipelineUrl;
|
||||
|
||||
private String lastCommitOfMergeRequestUrl;
|
||||
|
||||
private String newNoteUrl;
|
||||
|
||||
/**
|
||||
* Адрес дискуссий для MR
|
||||
*/
|
||||
private String discussionsUrl;
|
||||
|
||||
private String discussionUrl;
|
||||
|
||||
private String replaceUrl;
|
||||
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public class DiscussionServiceImpl implements DiscussionService {
|
||||
final MergeRequest mergeRequest = discussion.getMergeRequest();
|
||||
final Long projectId = mergeRequest.getProjectId();
|
||||
|
||||
final String requestUrl = MessageFormat.format(gitlabProperty.getUrlNewNote(), projectId, mergeRequest.getTwoId(), discussion.getId(), text);
|
||||
final String requestUrl = MessageFormat.format(gitlabProperty.getNewNoteUrl(), projectId, mergeRequest.getTwoId(), discussion.getId(), text);
|
||||
|
||||
RequestBody formBody = new FormBody.Builder().build();
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class DiscussionParser {
|
||||
|
||||
private String createLinkOldDiscussion(Discussion discussion) {
|
||||
return MessageFormat.format(
|
||||
gitlabProperty.getUrlOneDiscussion(),
|
||||
gitlabProperty.getDiscussionUrl(),
|
||||
discussion.getMergeRequest().getProjectId(),
|
||||
discussion.getMergeRequest().getTwoId(),
|
||||
discussion.getId()
|
||||
@ -192,7 +192,7 @@ public class DiscussionParser {
|
||||
}
|
||||
|
||||
private List<DiscussionJson> getDiscussionJson(MergeRequest mergeRequest, int page) {
|
||||
return HttpParse.request(MessageFormat.format(gitlabProperty.getUrlDiscussion(), mergeRequest.getProjectId(), mergeRequest.getTwoId(), page))
|
||||
return HttpParse.request(MessageFormat.format(gitlabProperty.getDiscussionsUrl(), mergeRequest.getProjectId(), mergeRequest.getTwoId(), page))
|
||||
.header(ACCEPT)
|
||||
.header(H_PRIVATE_TOKEN, personProperty.getToken())
|
||||
.executeList(DiscussionJson.class);
|
||||
@ -201,7 +201,7 @@ public class DiscussionParser {
|
||||
private Consumer<Note> createNoteLink(MergeRequest mergeRequest) {
|
||||
return note -> {
|
||||
final String url = MessageFormat.format(
|
||||
gitlabProperty.getUrlNote(),
|
||||
gitlabProperty.getNoteUrl(),
|
||||
mergeRequest.getWebUrl(),
|
||||
note.getId()
|
||||
);
|
||||
|
@ -92,7 +92,7 @@ public class MergeRequestParser {
|
||||
final List<ForkJoinTask<Optional<MergeRequestJson>>> tasks = existIds.stream()
|
||||
.map(
|
||||
existId -> new GetSingleMergeRequestTask(
|
||||
gitlabProperty.getUrlMergeRequest(),
|
||||
gitlabProperty.getMergeRequestUrl(),
|
||||
existId.getProjectId(),
|
||||
existId.getTwoId(),
|
||||
personProperty.getToken()
|
||||
@ -146,7 +146,7 @@ public class MergeRequestParser {
|
||||
*/
|
||||
private List<MergeRequestJson> getMergeRequests(Set<Long> projectIds) {
|
||||
final List<ForkJoinTask<List<MergeRequestJson>>> tasks = projectIds.stream()
|
||||
.map(projectId -> new GetAllMergeRequestForProjectTask(projectId, gitlabProperty.getUrlMergeRequestOpen(), personProperty.getToken()))
|
||||
.map(projectId -> new GetAllMergeRequestForProjectTask(projectId, gitlabProperty.getOpenMergeRequestsUrl(), personProperty.getToken()))
|
||||
.map(forkJoinPool::submit)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -181,7 +181,7 @@ public class MergeRequestParser {
|
||||
|
||||
private void parsingCommits(MergeRequest mergeRequest) {
|
||||
final List<CommitJson> commitJson = HttpParse.request(
|
||||
MessageFormat.format(gitlabProperty.getUrlCommit(), mergeRequest.getProjectId(), mergeRequest.getTwoId())
|
||||
MessageFormat.format(gitlabProperty.getLastCommitOfMergeRequestUrl(), mergeRequest.getProjectId(), mergeRequest.getTwoId())
|
||||
)
|
||||
.header(ACCEPT)
|
||||
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
|
||||
|
@ -102,7 +102,7 @@ public class PipelineParser {
|
||||
private List<Pipeline> getNewPipelines(Map<Long, Long> pipelineProjectMap, Set<Long> idsNotFound) {
|
||||
final List<ForkJoinTask<Optional<PipelineJson>>> tasks = idsNotFound.stream()
|
||||
.map(pipelineId -> new GetPipelineTask(
|
||||
gitlabProperty.getUrlPipeline(),
|
||||
gitlabProperty.getPipelineUrl(),
|
||||
pipelineProjectMap.get(pipelineId),
|
||||
pipelineId,
|
||||
personProperty.getToken()
|
||||
@ -120,7 +120,7 @@ public class PipelineParser {
|
||||
LocalDateTime newLastUpdate = LocalDateTime.now();
|
||||
final List<ForkJoinTask<List<PipelineShortJson>>> tasks = projectIds.stream()
|
||||
.map(projectId -> new GetPipelineShortTask(
|
||||
gitlabProperty.getUrlPipelines(),
|
||||
gitlabProperty.getPipelinesUrl(),
|
||||
projectId,
|
||||
lastUpdate,
|
||||
personProperty.getToken()
|
||||
@ -142,7 +142,7 @@ public class PipelineParser {
|
||||
final List<ForkJoinTask<Optional<PipelineJson>>> tasks = pipelines.stream()
|
||||
.map(
|
||||
pipeline -> new GetPipelineTask(
|
||||
gitlabProperty.getUrlPipeline(),
|
||||
gitlabProperty.getPipelineUrl(),
|
||||
pipeline.getProjectId(),
|
||||
pipeline.getId(),
|
||||
personProperty.getToken()
|
||||
|
@ -120,7 +120,7 @@ public class ProjectParser {
|
||||
|
||||
private List<ProjectJson> getProjectJsons(int page, String... params) {
|
||||
String param = String.join("", params);
|
||||
final String url = MessageFormat.format(gitlabProperty.getUrlProject(), page);
|
||||
final String url = MessageFormat.format(gitlabProperty.getProjectsUrl(), page);
|
||||
return HttpParse.request(url + param)
|
||||
.header(ACCEPT)
|
||||
.header(StringUtils.H_PRIVATE_TOKEN, personProperty.getToken())
|
||||
|
@ -35,19 +35,19 @@ gitlab-bot:
|
||||
gitlab:
|
||||
base-url: ${GITLAB_URL}
|
||||
replaceUrl: ${GITLAB_REPLACE_URL}
|
||||
url-project: ${GITLAB_URL}/api/v4/projects?page={0, number, integer}&per_page=100
|
||||
url-merge-request-open: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests?state=opened&page={1, number, integer}&per_page={2, number, integer}"
|
||||
url-merge-request-close: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests?state=closed&page={1, number, integer}&per_page=100"
|
||||
url-merge-request-comment: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes?&page={2,number,#}&per_page=100"
|
||||
url-merge-request: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}"
|
||||
url-merge-request-add: "${GITLAB_URL}/api/v4/projects/"
|
||||
user-url: ${GITLAB_URL}/api/v4/user
|
||||
users-url: ${GITLAB_URL}/api/v4/users
|
||||
url-note: "{0}#note_{1,number,#}"
|
||||
url-note-api: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes/{2,number,#}"
|
||||
url-pipelines: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines?&page={1,number,#}&per_page={2,number,#}"
|
||||
url-pipeline: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines/{1,number,#}"
|
||||
url-commit: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1"
|
||||
url-new-note: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}"
|
||||
url-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page=100"
|
||||
url-one-discussion: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}"
|
||||
user-url: ${GITLAB_URL}/api/v4/user
|
||||
projects-url: "${GITLAB_URL}/api/v4/projects?page={0, number, integer}&per_page=100"
|
||||
open-merge-requests-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests?state=opened&page={1, number, integer}&per_page={2, number, integer}"
|
||||
close-merge-requests-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests?state=closed&page={1, number, integer}&per_page=100"
|
||||
comments-of-merge-request-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes?&page={2,number,#}&per_page=100"
|
||||
merge-request-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}"
|
||||
project-add-url: "${GITLAB_URL}/api/v4/projects/"
|
||||
note-url: "{0}#note_{1,number,#}"
|
||||
notes-of-merge-request-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes/{2,number,#}"
|
||||
pipelines-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines?&page={1,number,#}&per_page={2,number,#}"
|
||||
pipeline-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/pipelines/{1,number,#}"
|
||||
last-commit-of-merge-request-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1"
|
||||
new-note-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}"
|
||||
discussions-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page=100"
|
||||
discussion-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}"
|
@ -91,7 +91,7 @@ public class MenuConfig {
|
||||
return AnswerText.<Mail>builder()
|
||||
.answer(mail -> {
|
||||
final String mailText = mail.getText();
|
||||
final String projectUrl = gitlabProperty.getUrlMergeRequestAdd() + mailText.replace(gitlabProperty.getBaseUrl(), "")
|
||||
final String projectUrl = gitlabProperty.getProjectAddUrl() + mailText.replace(gitlabProperty.getBaseUrl(), "")
|
||||
.substring(1)
|
||||
.replace("/", "%2F");
|
||||
projectParser.parseByUrl(projectUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user