From ad97bebfed2e65951c7dc39ee80b32089a032804 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 17 Feb 2016 07:11:48 +0100 Subject: Enhance new branch button on an issue --- app/services/system_note_service.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/services/system_note_service.rb') diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 58a861ee08e..751815c5b18 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -207,6 +207,15 @@ class SystemNoteService create_note(noteable: noteable, project: project, author: author, note: body) end + # Called when a branch is created from the 'new branch' button on a issue + # Example note text: + # + # "Started branch `201-issue-branch-button`" + def self.new_issue_branch(issue, project, author, branch) + body = "Started branch `#{branch}`" + create_note(noteable: issue, project: project, author: author, note: body) + end + # Called when a Mentionable references a Noteable # # noteable - Noteable object being referenced -- cgit v1.2.3 From e831a3b869cbb82e9a4294a5f9309ba56df46589 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Fri, 19 Feb 2016 11:58:02 +0100 Subject: Link in the note when started a new branch from an issue --- app/services/system_note_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/services/system_note_service.rb') diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 751815c5b18..b65ac47bce3 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -212,7 +212,10 @@ class SystemNoteService # # "Started branch `201-issue-branch-button`" def self.new_issue_branch(issue, project, author, branch) - body = "Started branch `#{branch}`" + h = Gitlab::Application.routes.url_helpers + link = "#{Gitlab.config.gitlab.url}#{h.namespace_project_compare_path(project.namespace, project, from: project.default_branch, to: branch)}" + + body = "Started branch [#{branch}](#{link})" create_note(noteable: issue, project: project, author: author, note: body) end -- cgit v1.2.3 From 2b97c921196a7be904bfe4f0a31347c3583c9e88 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Mon, 22 Feb 2016 09:20:04 +0100 Subject: Incorporate review --- app/services/system_note_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/services/system_note_service.rb') diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index b65ac47bce3..5ea7d405e4d 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -213,7 +213,7 @@ class SystemNoteService # "Started branch `201-issue-branch-button`" def self.new_issue_branch(issue, project, author, branch) h = Gitlab::Application.routes.url_helpers - link = "#{Gitlab.config.gitlab.url}#{h.namespace_project_compare_path(project.namespace, project, from: project.default_branch, to: branch)}" + link = "#{h.namespace_project_compare_url(project.namespace, project, from: project.default_branch, to: branch)}" body = "Started branch [#{branch}](#{link})" create_note(noteable: issue, project: project, author: author, note: body) -- cgit v1.2.3 From 48274581551b73575149463be0c050f6b5a564ee Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 15 Mar 2016 20:17:51 +0100 Subject: Incorporate the review and update spec The feature spec now also tests the absence of the new branch button --- app/services/system_note_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/services/system_note_service.rb') diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 5ea7d405e4d..f09b77c4a57 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -213,9 +213,9 @@ class SystemNoteService # "Started branch `201-issue-branch-button`" def self.new_issue_branch(issue, project, author, branch) h = Gitlab::Application.routes.url_helpers - link = "#{h.namespace_project_compare_url(project.namespace, project, from: project.default_branch, to: branch)}" + link = h.namespace_project_compare_url(project.namespace, project, from: project.default_branch, to: branch) - body = "Started branch [#{branch}](#{link})" + body = "Started branch [`#{branch}`](#{link})" create_note(noteable: issue, project: project, author: author, note: body) end -- cgit v1.2.3