Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Derive the message used for macros from the Pull Request state

Aaron Contreras50711b72c406
diff --git a/modules/github_integration/frontend/module/pull-request/pull-request-macro.component.ts b/modules/github_integration/frontend/module/pull-request/pull-request-macro.component.ts
index 72c995616a3..254246f9cbc 100644
--- a/modules/github_integration/frontend/module/pull-request/pull-request-macro.component.ts
+++ b/modules/github_integration/frontend/module/pull-request/pull-request-macro.component.ts
@@ -90,7 +90,7 @@ export class PullRequestMacroComponent implements OnInit {
const repositoryLink = this.htmlLink(pr.repositoryHtmlUrl, pr.repository);
const prLink = this.htmlLink(pr.htmlUrl, pr.title);
- const message = this.pullRequestState === 'referenced' ? 'referenced_message' : 'message';
+ const message = this.deriveMessage();
return this.I18n.t(
`js.github_integration.pull_requests.${message}`,
{
@@ -115,6 +115,16 @@ export class PullRequestMacroComponent implements OnInit {
}
}
+ private deriveMessage() {
+ if (this.pullRequestState === 'referenced') {
+ return 'referenced_message';
+ } else if (this.pullRequestState === 'merged') {
+ return 'merged_message';
+ }
+
+ return 'message';
+ }
+
private htmlLink(href:string, title:string):string {
const link = document.createElement('a');
link.href = href;
diff --git a/modules/github_integration/spec/features/work_package_activity_spec.rb b/modules/github_integration/spec/features/work_package_activity_spec.rb
index 27b3c98eeff..df38f3f0095 100644
--- a/modules/github_integration/spec/features/work_package_activity_spec.rb
+++ b/modules/github_integration/spec/features/work_package_activity_spec.rb
@@ -106,7 +106,7 @@ RSpec.describe 'Work Package Activity Tab',
it 'renders a comment stating the Pull Request was merged by the merge actor' do
expected_merge_comment = <<~GITHUB_MERGE_COMMENT.squish
- Merged#{I18n.t('js.github_integration.pull_requests.message',
+ Merged#{I18n.t('js.github_integration.pull_requests.merged_message',
pr_number: pull_request.number,
pr_link: pull_request.title,
repository_link: pull_request.repository,