Commit 0ef055a4 authored by Izaak Alpert's avatar Izaak Alpert

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
parent 09112dbb
...@@ -194,7 +194,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -194,7 +194,6 @@ class MergeRequest < ActiveRecord::Base
commits commits
end end
def merge!(user_id) def merge!(user_id)
self.author_id_of_changes = user_id self.author_id_of_changes = user_id
self.merge self.merge
...@@ -222,7 +221,6 @@ class MergeRequest < ActiveRecord::Base ...@@ -222,7 +221,6 @@ class MergeRequest < ActiveRecord::Base
Gitlab::Satellite::MergeAction.new(current_user, self).diff_in_satellite Gitlab::Satellite::MergeAction.new(current_user, self).diff_in_satellite
end end
# Returns the commit as a series of email patches. # Returns the commit as a series of email patches.
# #
# see "git format-patch" # see "git format-patch"
......
...@@ -52,11 +52,11 @@ class Note < ActiveRecord::Base ...@@ -52,11 +52,11 @@ class Note < ActiveRecord::Base
def self.create_status_change_note(noteable, project, author, status) def self.create_status_change_note(noteable, project, author, status)
create({ create({
noteable: noteable, noteable: noteable,
project: project, project: project,
author: author, author: author,
note: "_Status changed to #{status}_" note: "_Status changed to #{status}_"
}, without_protection: true) }, without_protection: true)
end end
def commit_author def commit_author
...@@ -97,7 +97,7 @@ class Note < ActiveRecord::Base ...@@ -97,7 +97,7 @@ class Note < ActiveRecord::Base
# otherwise false is returned # otherwise false is returned
def downvote? def downvote?
votable? && (note.start_with?('-1') || votable? && (note.start_with?('-1') ||
note.start_with?(':-1:') note.start_with?(':-1:')
) )
end end
...@@ -136,8 +136,8 @@ class Note < ActiveRecord::Base ...@@ -136,8 +136,8 @@ class Note < ActiveRecord::Base
else else
super super
end end
# Temp fix to prevent app crash # Temp fix to prevent app crash
# if note commit id doesn't exist # if note commit id doesn't exist
rescue rescue
nil nil
end end
...@@ -146,7 +146,7 @@ class Note < ActiveRecord::Base ...@@ -146,7 +146,7 @@ class Note < ActiveRecord::Base
# otherwise false is returned # otherwise false is returned
def upvote? def upvote?
votable? && (note.start_with?('+1') || votable? && (note.start_with?('+1') ||
note.start_with?(':+1:') note.start_with?(':+1:')
) )
end end
......
:plain :plain
$(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}"); $(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}");
$(".target_branch").trigger("liszt:updated"); $(".target_branch").trigger("liszt:updated");
$(".mr_target_commit").html(""); $(".mr_target_commit").html("");
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} 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} Author: #{@merge_request.author_name}
Assignee: #{@merge_request.assignee_name} Assignee: #{@merge_request.assignee_name}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Merge Request Url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} 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} Author: #{@merge_request.author_name}
Assignee: #{@merge_request.assignee_name} Assignee: #{@merge_request.assignee_name}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%p %p
= link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request) = link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request)
%p %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} &rarr; #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
%p %p
Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name} Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
...@@ -71,12 +71,12 @@ ...@@ -71,12 +71,12 @@
$.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() }); $.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() }); $.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() }); $.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() }); $.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() }); $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() });
}); });
\ No newline at end of file
...@@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests ...@@ -4,7 +4,6 @@ Feature: Project Forked Merge Requests
And I am a member of project "Shop" And I am a member of project "Shop"
And I have a project forked off of "Shop" called "Forked Shop" And I have a project forked off of "Shop" called "Forked Shop"
@javascript @javascript
Scenario: I can visit the target projects commit for a forked merge request Scenario: I can visit the target projects commit for a forked merge request
Given I visit project "Forked Shop" merge requests page Given I visit project "Forked Shop" merge requests page
......
...@@ -3,13 +3,10 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -3,13 +3,10 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
step 'project has deploy key' do step 'project has deploy key' do
create(:deploy_keys_project, project: @project) create(:deploy_keys_project, project: @project)
end end
step 'I should see project deploy keys' do step 'I should see project deploy keys' do
within '.enabled-keys' do within '.enabled-keys' do
page.should have_content deploy_key.title page.should have_content deploy_key.title
......
...@@ -16,7 +16,6 @@ class ForkProject < Spinach::FeatureSteps ...@@ -16,7 +16,6 @@ class ForkProject < Spinach::FeatureSteps
@project.team << [@user, :reporter] @project.team << [@user, :reporter]
end end
step 'I should see the forked project page' do step 'I should see the forked project page' do
page.should have_content "Project was successfully forked." page.should have_content "Project was successfully forked."
current_path.should include current_user.namespace.path current_path.should include current_user.namespace.path
......
...@@ -4,8 +4,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -4,8 +4,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
include SharedNote include SharedNote
include SharedPaths include SharedPaths
Given 'I am a member of project "Shop"' do Given 'I am a member of project "Shop"' do
@project = Project.find_by_name "Shop" @project = Project.find_by_name "Shop"
@project ||= create(:project_with_code, name: "Shop") @project ||= create(:project_with_code, name: "Shop")
...@@ -22,12 +20,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -22,12 +20,10 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
forked_project_link.save! forked_project_link.save!
end end
Given 'I click link "New Merge Request"' do Given 'I click link "New Merge Request"' do
click_link "New Merge Request" click_link "New Merge Request"
end end
Then 'I should see merge request "Merge Request On Forked Project"' do Then 'I should see merge request "Merge Request On Forked Project"' do
page.should have_content "Merge Request On Forked Project" page.should have_content "Merge Request On Forked Project"
@project.merge_requests.size.should >= 1 @project.merge_requests.size.should >= 1
...@@ -151,7 +147,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -151,7 +147,6 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
verify_commit_link(".mr_target_commit",@project) verify_commit_link(".mr_target_commit",@project)
end end
And 'I fill out an invalid "Merge Request On Forked Project" merge request' do 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 #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" fill_in "merge_request_title", with: "Merge Request On Forked Project"
...@@ -161,14 +156,12 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -161,14 +156,12 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
find(:select, "merge_request_target_branch", {}).value.should == "" find(:select, "merge_request_target_branch", {}).value.should == ""
end end
Then 'I should see validation errors' do Then 'I should see validation errors' do
page.should have_content "Source branch can't be blank" page.should have_content "Source branch can't be blank"
page.should have_content "Target 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" page.should have_content "Branch conflict You can not use same project/branch for source and target"
end end
def project def project
@project ||= Project.find_by_name!("Shop") @project ||= Project.find_by_name!("Shop")
end end
...@@ -179,5 +172,4 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -179,5 +172,4 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
find(:div,container_div).should have_css ".browse_code_link_holder" 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" find(:div,container_div).find(".commit_short_id")['href'].should have_content "#{container_project.path_with_namespace}/commit"
end end
end end
...@@ -24,7 +24,6 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -24,7 +24,6 @@ class ProjectMergeRequests < Spinach::FeatureSteps
page.should have_content "Wiki Feature" page.should have_content "Wiki Feature"
end end
Then 'I should see closed merge request "Bug NS-04"' do Then 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by_title!("Bug NS-04") merge_request = MergeRequest.find_by_title!("Bug NS-04")
merge_request.closed?.should be_true merge_request.closed?.should be_true
......
...@@ -44,7 +44,6 @@ module Gitlab ...@@ -44,7 +44,6 @@ module Gitlab
handle_exception(ex) handle_exception(ex)
end end
# Get a raw diff of the source to the target # Get a raw diff of the source to the target
def diff_in_satellite def diff_in_satellite
in_locked_and_timed_satellite do |merge_repo| in_locked_and_timed_satellite do |merge_repo|
...@@ -114,14 +113,12 @@ module Gitlab ...@@ -114,14 +113,12 @@ module Gitlab
end end
commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) }
return commits return commits
end end
rescue Grit::Git::CommandFailed => ex rescue Grit::Git::CommandFailed => ex
handle_exception(ex) handle_exception(ex)
end end
private private
# Merges the source_branch into the target_branch in the satellite. # Merges the source_branch into the target_branch in the satellite.
# #
# Note: it will clear out the satellite before doing anything # Note: it will clear out the satellite before doing anything
......
...@@ -71,7 +71,6 @@ FactoryGirl.define do ...@@ -71,7 +71,6 @@ FactoryGirl.define do
end end
end end
factory :group do factory :group do
sequence(:name) { |n| "group#{n}" } sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') } path { name.downcase.gsub(/\s/, '_') }
......
...@@ -5,7 +5,6 @@ INVALID_FACTORIES = [ ...@@ -5,7 +5,6 @@ INVALID_FACTORIES = [
:invalid_key, :invalid_key,
] ]
FactoryGirl.factories.map(&:name).each do |factory_name| FactoryGirl.factories.map(&:name).each do |factory_name|
next if INVALID_FACTORIES.include?(factory_name) next if INVALID_FACTORIES.include?(factory_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment