diff options
author | Izaak Alpert <ialpert@blackberry.com> | 2013-07-12 20:23:42 +0400 |
---|---|---|
committer | Izaak Alpert <ialpert@blackberry.com> | 2013-07-18 06:46:38 +0400 |
commit | 0ef055a4aef76d20668a40717fb33bfe41599cfb (patch) | |
tree | caa845c06e1b0c61dce3038474383696ad2ea691 | |
parent | 09112dbb1df2669b0042d6d785a5469a9855ac20 (diff) |
MR on fork: Email fixes, style fixes
-Removed many extra spaces I added
-Fixed email templates to be consistent/better looking
GITLAB-894, GITLAB-895, (GITLAB-858)
Change-Id: I35c1a8e0e22af7de26d54e5c3da987fa7bb3921e
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | app/models/note.rb | 18 | ||||
-rw-r--r-- | app/views/merge_requests/update_branches.js.haml | 6 | ||||
-rw-r--r-- | app/views/notify/closed_merge_request_email.text.haml | 2 | ||||
-rw-r--r-- | app/views/notify/merged_merge_request_email.text.haml | 2 | ||||
-rw-r--r-- | app/views/notify/new_merge_request_email.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_form.html.haml | 8 | ||||
-rw-r--r-- | features/project/forked_merge_requests.feature | 1 | ||||
-rw-r--r-- | features/steps/project/deploy_keys.rb | 3 | ||||
-rw-r--r-- | features/steps/project/project_fork.rb | 1 | ||||
-rw-r--r-- | features/steps/project/project_forked_merge_requests.rb | 8 | ||||
-rw-r--r-- | features/steps/project/project_merge_requests.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/satellite/merge_action.rb | 3 | ||||
-rw-r--r-- | spec/factories.rb | 1 | ||||
-rw-r--r-- | spec/factories_spec.rb | 1 |
15 files changed, 17 insertions, 42 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index b5d1a34ec31..28ea8499fc0 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -194,7 +194,6 @@ class MergeRequest < ActiveRecord::Base commits end - def merge!(user_id) self.author_id_of_changes = user_id self.merge @@ -222,7 +221,6 @@ class MergeRequest < ActiveRecord::Base Gitlab::Satellite::MergeAction.new(current_user, self).diff_in_satellite end - # Returns the commit as a series of email patches. # # see "git format-patch" diff --git a/app/models/note.rb b/app/models/note.rb index 0175430be4d..6b119f00235 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -52,11 +52,11 @@ class Note < ActiveRecord::Base def self.create_status_change_note(noteable, project, author, status) create({ - noteable: noteable, - project: project, - author: author, - note: "_Status changed to #{status}_" - }, without_protection: true) + noteable: noteable, + project: project, + author: author, + note: "_Status changed to #{status}_" + }, without_protection: true) end def commit_author @@ -97,7 +97,7 @@ class Note < ActiveRecord::Base # otherwise false is returned def downvote? votable? && (note.start_with?('-1') || - note.start_with?(':-1:') + note.start_with?(':-1:') ) end @@ -136,8 +136,8 @@ class Note < ActiveRecord::Base else super end - # Temp fix to prevent app crash - # if note commit id doesn't exist + # Temp fix to prevent app crash + # if note commit id doesn't exist rescue nil end @@ -146,7 +146,7 @@ class Note < ActiveRecord::Base # otherwise false is returned def upvote? votable? && (note.start_with?('+1') || - note.start_with?(':+1:') + note.start_with?(':+1:') ) end diff --git a/app/views/merge_requests/update_branches.js.haml b/app/views/merge_requests/update_branches.js.haml index c9171622669..7324aa89a5e 100644 --- a/app/views/merge_requests/update_branches.js.haml +++ b/app/views/merge_requests/update_branches.js.haml @@ -1,8 +1,4 @@ :plain $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}"); $(".target_branch").trigger("liszt:updated"); - $(".mr_target_commit").html(""); - - - - + $(".mr_target_commit").html("");
\ No newline at end of file diff --git a/app/views/notify/closed_merge_request_email.text.haml b/app/views/notify/closed_merge_request_email.text.haml index 1c92e004ff6..7cf066339c3 100644 --- a/app/views/notify/closed_merge_request_email.text.haml +++ b/app/views/notify/closed_merge_request_email.text.haml @@ -2,7 +2,7 @@ Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} -Project:Branches: #{@merge_request.source_project.path_with_namespace}/#{@merge_request.source_branch} - #{@merge_request.target_project.path_with_namespace}#{@merge_request.target_branch} +Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} to #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch} Author: #{@merge_request.author_name} Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/merged_merge_request_email.text.haml b/app/views/notify/merged_merge_request_email.text.haml index 5f19473fae0..ca18d8f30e5 100644 --- a/app/views/notify/merged_merge_request_email.text.haml +++ b/app/views/notify/merged_merge_request_email.text.haml @@ -2,7 +2,7 @@ Merge Request Url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} -Project:Branches: #{@merge_request.source_project.path_with_namespace}/#{@merge_request.source_branch} - #{@merge_request.target_project.path_with_namespace}#{@merge_request.target_branch} +Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} to #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch} Author: #{@merge_request.author_name} Assignee: #{@merge_request.assignee_name} diff --git a/app/views/notify/new_merge_request_email.html.haml b/app/views/notify/new_merge_request_email.html.haml index fc4ffba1102..72546e00b15 100644 --- a/app/views/notify/new_merge_request_email.html.haml +++ b/app/views/notify/new_merge_request_email.html.haml @@ -3,7 +3,7 @@ %p = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request) %p - Project:Branches: #{@merge_request.source_project.path_with_namespace}/#{@merge_request.source_branch} - #{@merge_request.target_project.path_with_namespace}#{@merge_request.target_branch} + Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} → #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch} %p Assignee: #{@merge_request.author_name} → #{@merge_request.assignee_name} diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 558c17eb0f6..7d43dc93eea 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -71,12 +71,12 @@ $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() }); $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() }); - target_project.live("change", function() { + target_project.on("change", function() { $.get("#{update_branches_project_merge_requests_path(@source_project)}", {target_project_id: $(this).val() }); }); - source_branch.live("change", function() { + source_branch.on("change", function() { $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() }); }); - target_branch.live("change", function() { + target_branch.on("change", function() { $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); - });
\ No newline at end of file + }); diff --git a/features/project/forked_merge_requests.feature b/features/project/forked_merge_requests.feature index 4312d5748b8..ef8c3cb3dee 100644 --- a/features/project/forked_merge_requests.feature +++ b/features/project/forked_merge_requests.feature @@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests And I am a member of project "Shop" And I have a project forked off of "Shop" called "Forked Shop" - @javascript Scenario: I can visit the target projects commit for a forked merge request Given I visit project "Forked Shop" merge requests page diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index bd0801784f7..7f7492bfd6d 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -3,13 +3,10 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps include SharedProject include SharedPaths - - step 'project has deploy key' do create(:deploy_keys_project, project: @project) end - step 'I should see project deploy keys' do within '.enabled-keys' do page.should have_content deploy_key.title diff --git a/features/steps/project/project_fork.rb b/features/steps/project/project_fork.rb index 4aa1e44b91e..858c7d11b32 100644 --- a/features/steps/project/project_fork.rb +++ b/features/steps/project/project_fork.rb @@ -16,7 +16,6 @@ class ForkProject < Spinach::FeatureSteps @project.team << [@user, :reporter] end - step 'I should see the forked project page' do page.should have_content "Project was successfully forked." current_path.should include current_user.namespace.path diff --git a/features/steps/project/project_forked_merge_requests.rb b/features/steps/project/project_forked_merge_requests.rb index 7579dce9268..a00a3b0a9ba 100644 --- a/features/steps/project/project_forked_merge_requests.rb +++ b/features/steps/project/project_forked_merge_requests.rb @@ -4,8 +4,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps include SharedNote include SharedPaths - - Given 'I am a member of project "Shop"' do @project = Project.find_by_name "Shop" @project ||= create(:project_with_code, name: "Shop") @@ -22,12 +20,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps forked_project_link.save! end - Given 'I click link "New Merge Request"' do click_link "New Merge Request" end - Then 'I should see merge request "Merge Request On Forked Project"' do page.should have_content "Merge Request On Forked Project" @project.merge_requests.size.should >= 1 @@ -151,7 +147,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps verify_commit_link(".mr_target_commit",@project) end - And 'I fill out an invalid "Merge Request On Forked Project" merge request' do #If this isn't filled in the rest of the validations won't be triggered fill_in "merge_request_title", with: "Merge Request On Forked Project" @@ -161,14 +156,12 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps find(:select, "merge_request_target_branch", {}).value.should == "" end - Then 'I should see validation errors' do page.should have_content "Source branch can't be blank" page.should have_content "Target branch can't be blank" page.should have_content "Branch conflict You can not use same project/branch for source and target" end - def project @project ||= Project.find_by_name!("Shop") end @@ -179,5 +172,4 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps find(:div,container_div).should have_css ".browse_code_link_holder" find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit" end - end diff --git a/features/steps/project/project_merge_requests.rb b/features/steps/project/project_merge_requests.rb index 64dde145a89..7c70482deb5 100644 --- a/features/steps/project/project_merge_requests.rb +++ b/features/steps/project/project_merge_requests.rb @@ -24,7 +24,6 @@ class ProjectMergeRequests < Spinach::FeatureSteps page.should have_content "Wiki Feature" end - Then 'I should see closed merge request "Bug NS-04"' do merge_request = MergeRequest.find_by_title!("Bug NS-04") merge_request.closed?.should be_true diff --git a/lib/gitlab/satellite/merge_action.rb b/lib/gitlab/satellite/merge_action.rb index 604b2ca9a19..3610a18bc91 100644 --- a/lib/gitlab/satellite/merge_action.rb +++ b/lib/gitlab/satellite/merge_action.rb @@ -44,7 +44,6 @@ module Gitlab handle_exception(ex) end - # Get a raw diff of the source to the target def diff_in_satellite in_locked_and_timed_satellite do |merge_repo| @@ -114,14 +113,12 @@ module Gitlab end commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } return commits - end rescue Grit::Git::CommandFailed => ex handle_exception(ex) end private - # Merges the source_branch into the target_branch in the satellite. # # Note: it will clear out the satellite before doing anything diff --git a/spec/factories.rb b/spec/factories.rb index 831b4fbd46b..3082e86f07f 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -71,7 +71,6 @@ FactoryGirl.define do end end - factory :group do sequence(:name) { |n| "group#{n}" } path { name.downcase.gsub(/\s/, '_') } diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb index 7f887be9ce9..d38ce3d1c7e 100644 --- a/spec/factories_spec.rb +++ b/spec/factories_spec.rb @@ -5,7 +5,6 @@ INVALID_FACTORIES = [ :invalid_key, ] - FactoryGirl.factories.map(&:name).each do |factory_name| next if INVALID_FACTORIES.include?(factory_name) |