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
This commit is contained in:
Izaak Alpert 2013-07-12 12:23:42 -04:00
parent 09112dbb1d
commit 0ef055a4ae
15 changed files with 17 additions and 42 deletions

View file

@ -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"

View file

@ -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

View file

@ -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("");

View file

@ -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}

View file

@ -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}

View file

@ -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} &rarr; #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
%p
Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}

View file

@ -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() });
});
});

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -71,7 +71,6 @@ FactoryGirl.define do
end
end
factory :group do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }

View file

@ -5,7 +5,6 @@ INVALID_FACTORIES = [
:invalid_key,
]
FactoryGirl.factories.map(&:name).each do |factory_name|
next if INVALID_FACTORIES.include?(factory_name)