Merge branch 'master' of github.com:gitlabhq/gitlabhq

This commit is contained in:
Dmitriy Zaporozhets 2015-01-15 14:57:55 -08:00
commit e683d05453
23 changed files with 49 additions and 64 deletions

View file

@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController
super
end
def after_sign_up_path_for(resource)
def after_sign_up_path_for(_resource)
new_user_session_path
end
def after_inactive_sign_up_path_for(resource)
def after_inactive_sign_up_path_for(_resource)
new_user_session_path
end

View file

@ -108,7 +108,7 @@ module TreeHelper
end
end
def up_dir_path(tree)
def up_dir_path
file = File.join(@path, "..")
tree_join(@ref, file)
end

View file

@ -75,11 +75,11 @@ class Commit
return no_commit_message if title.blank?
title_end = title.index(/\n/)
title_end = title.index("\n")
if (!title_end && title.length > 100) || (title_end && title_end > 100)
title[0..79] << "&hellip;".html_safe
else
title.split(/\n/, 2).first
title.split("\n", 2).first
end
end
@ -87,11 +87,11 @@ class Commit
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def description
title_end = safe_message.index(/\n/)
title_end = safe_message.index("\n")
@description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100)
"&hellip;".html_safe << safe_message[80..-1]
else
safe_message.split(/\n/, 2)[1].try(:chomp)
safe_message.split("\n", 2)[1].try(:chomp)
end
end

View file

@ -89,7 +89,7 @@ class Key < ActiveRecord::Base
end
if cmd_status.zero?
cmd_output.gsub /([\d\h]{2}:)+[\d\h]{2}/ do |match|
cmd_output.gsub /(\h{2}:)+\h{2}/ do |match|
self.fingerprint = match
end
end

View file

@ -60,9 +60,9 @@ class CampfireService < Service
message << "[#{project.name_with_namespace}] "
message << "#{push[:user_name]} "
if before =~ /000000/
if before.include?('000000')
message << "pushed new branch #{ref} \n"
elsif after =~ /000000/
elsif after.include?('000000')
message << "removed branch #{ref} \n"
else
message << "pushed #{push[:total_commits_count]} commits to #{ref}. "

View file

@ -58,12 +58,12 @@ class HipchatService < Service
message = ""
message << "#{push[:user_name]} "
if before =~ /000000/
if before.include?('000000')
message << "pushed new branch <a href=\""\
"#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\
" to <a href=\"#{project.web_url}\">"\
"#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n"
elsif after =~ /000000/
elsif after.include?('000000')
message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n"
else
message << "pushed to branch <a href=\""\

View file

@ -80,9 +80,9 @@ class PushoverService < Service
before = push_data[:before]
after = push_data[:after]
if before =~ /000000/
if before.include?('000000')
message = "#{push_data[:user_name]} pushed new branch \"#{ref}\"."
elsif after =~ /000000/
elsif after.include?('000000')
message = "#{push_data[:user_name]} deleted branch \"#{ref}\"."
else
message = "#{push_data[:user_name]} push to branch \"#{ref}\"."

View file

@ -77,11 +77,11 @@ class SlackMessage
end
def new_branch?
before =~ /000000/
before.include?('000000')
end
def removed_branch?
after =~ /000000/
after.include?('000000')
end
def branch_url

View file

@ -488,7 +488,7 @@ class User < ActiveRecord::Base
end
def temp_oauth_email?
email =~ /\Atemp-email-for-oauth/
email.start_with?('temp-email-for-oauth')
end
def public_profile?

View file

@ -111,23 +111,23 @@ class GitPushService
ref_parts = ref.split('/')
# Return if this is not a push to a branch (e.g. new commits)
ref_parts[1] =~ /heads/ && oldrev != Gitlab::Git::BLANK_SHA
ref_parts[1].include?('heads') && oldrev != Gitlab::Git::BLANK_SHA
end
def push_to_new_branch?(ref, oldrev)
ref_parts = ref.split('/')
ref_parts[1] =~ /heads/ && oldrev == Gitlab::Git::BLANK_SHA
ref_parts[1].include?('heads') && oldrev == Gitlab::Git::BLANK_SHA
end
def push_remove_branch?(ref, newrev)
ref_parts = ref.split('/')
ref_parts[1] =~ /heads/ && newrev == Gitlab::Git::BLANK_SHA
ref_parts[1].include?('heads') && newrev == Gitlab::Git::BLANK_SHA
end
def push_to_branch?(ref)
ref =~ /refs\/heads/
ref.include?('refs/heads')
end
def is_default_branch?(ref)

View file

@ -118,7 +118,7 @@ class NotificationService
return true unless note.noteable_type.present?
# ignore gitlab service messages
return true if note.note =~ /\A_Status changed to closed_/
return true if note.note.start_with?('_Status changed to closed_')
return true if note.cross_reference? && note.system == true
opts = { noteable_type: note.noteable_type, project_id: note.project_id }

View file

@ -19,6 +19,7 @@
= csrf_meta_tags
= include_gon
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1.0'}
%meta{name: 'theme-color', content: '#474D57'}
= render 'layouts/google_analytics' if extra_config.has_key?('google_analytics_id')
= render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id')

View file

@ -0,0 +1,15 @@
.file-holder.file
.file-title
%i.icon-file
%span.file_name
%span.monospace.light #{ref}
- if local_assigns[:path]
= ': ' + local_assigns[:path]
.file-content.code
%pre.js-edit-mode-pane#editor
= params[:content] || local_assigns[:blob_data]
- if local_assigns[:path]
.js-edit-mode-pane#preview.hide
.center
%h2
%i.icon-spinner.icon-spin

View file

@ -6,21 +6,7 @@
= link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id)
= form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
.file-holder.file
.file-title
%i.fa.fa-file
%span.file_name
%span.monospace.light #{@ref}:
= @path
%span.options
.btn-group.tree-btn-group
= link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message }
.file-content.code
%pre.js-edit-mode-pane#editor
.js-edit-mode-pane#preview.hide
.center
%h2
%i.fa.fa-spinner.fa-spin
= render 'projects/blob_editor', ref: @ref, path: @path, blob_data: @blob.data
= render 'shared/commit_message_container', params: params,
placeholder: "Update #{@blob.name}"
= hidden_field_tag 'last_commit', @last_commit
@ -34,7 +20,6 @@
ace.config.loadModule("ace/ext/searchbox");
var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor");
editor.setValue("#{escape_javascript(@blob.data)}");
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}

View file

@ -19,12 +19,7 @@
Encoding
.col-sm-10
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
.file-holder
.file-title
%i.fa.fa-file
.file-content.code
%pre#editor= params[:content]
= render 'projects/blob_editor', ref: @ref
= render 'shared/commit_message_container', params: params,
placeholder: 'Add new file'
= hidden_field_tag 'content', '', id: 'file-content'

View file

@ -35,7 +35,7 @@
- if @path.present?
%tr.tree-item
%td.tree-item-file-name
= link_to "..", project_tree_path(@project, up_dir_path(tree)), class: 'prepend-left-10'
= link_to "..", project_tree_path(@project, up_dir_path), class: 'prepend-left-10'
%td
%td.hidden-xs

View file

@ -154,8 +154,8 @@ Gitlab::Application.routes.draw do
end
end
match "/u/:username" => "users#show", as: :user,
constraints: {username: /(?:[^.]|\.(?!atom$))+/, format: /atom/}, via: :get
get '/u/:username' => 'users#show', as: :user,
constraints: { username: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
#
# Dashboard Area

View file

@ -13,11 +13,6 @@ Feature: Project Commits Comments
Scenario: I can't cancel the main form
Then I should not see the cancel comment button
@javascript
Scenario: I can't preview without text
Given I haven't written any comment text
Then The comment preview tab should say there is nothing to do
@javascript
Scenario: I can preview with text
Given I write a comment like ":+1: Nice"

View file

@ -54,12 +54,6 @@ Feature: Project Commits Diff Comments
Given I leave a diff comment like "Typo, please fix"
Then I should see a discussion reply button
@javascript
Scenario: I can't preview without text
Given I open a diff comment form
And I haven't written any diff comment text
Then The diff comment preview tab should say there is nothing to do
@javascript
Scenario: I can preview with text
Given I open a diff comment form

View file

@ -80,7 +80,7 @@ module SharedDiffNote
step 'I should not see the diff comment text field' do
within(diff_file_selector) do
page.should have_css(".js-note-text", visible: false)
expect(find('.js-note-text')).not_to be_visible
end
end
@ -115,7 +115,7 @@ module SharedDiffNote
end
step 'I should see add a diff comment button' do
page.should have_css(".js-add-diff-note-button", visible: false)
page.should have_css('.js-add-diff-note-button', visible: true)
end
step 'I should see an empty diff comment form' do

View file

@ -64,7 +64,7 @@ module SharedNote
step 'I should not see the comment text field' do
within(".js-main-target-form") do
page.should have_css(".js-note-text", visible: false)
expect(find('.js-note-text')).not_to be_visible
end
end

View file

@ -25,8 +25,8 @@ module API
# project. This applies the correct project permissions to
# the wiki repository as well.
access =
if project_path =~ /\.wiki\Z/
project_path.sub!(/\.wiki\Z/, '')
if project_path.end_with?('.wiki')
project_path.chomp!('.wiki')
Gitlab::GitAccessWiki.new
else
Gitlab::GitAccess.new

View file

@ -25,7 +25,7 @@ namespace :gitlab do
puts "Processing #{repo_path}".yellow
if path =~ /\.wiki\Z/
if path.end_with?('.wiki')
puts " * Skipping wiki repo"
next
end