Commit e683d054 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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

parents 3d3c7efa 500dab09
...@@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -15,11 +15,11 @@ class RegistrationsController < Devise::RegistrationsController
super super
end end
def after_sign_up_path_for(resource) def after_sign_up_path_for(_resource)
new_user_session_path new_user_session_path
end end
def after_inactive_sign_up_path_for(resource) def after_inactive_sign_up_path_for(_resource)
new_user_session_path new_user_session_path
end end
......
...@@ -108,7 +108,7 @@ module TreeHelper ...@@ -108,7 +108,7 @@ module TreeHelper
end end
end end
def up_dir_path(tree) def up_dir_path
file = File.join(@path, "..") file = File.join(@path, "..")
tree_join(@ref, file) tree_join(@ref, file)
end end
......
...@@ -75,11 +75,11 @@ class Commit ...@@ -75,11 +75,11 @@ class Commit
return no_commit_message if title.blank? 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) if (!title_end && title.length > 100) || (title_end && title_end > 100)
title[0..79] << "&hellip;".html_safe title[0..79] << "&hellip;".html_safe
else else
title.split(/\n/, 2).first title.split("\n", 2).first
end end
end end
...@@ -87,11 +87,11 @@ class Commit ...@@ -87,11 +87,11 @@ class Commit
# #
# cut off, ellipses (`&hellp;`) are prepended to the commit message. # cut off, ellipses (`&hellp;`) are prepended to the commit message.
def description 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) @description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100)
"&hellip;".html_safe << safe_message[80..-1] "&hellip;".html_safe << safe_message[80..-1]
else else
safe_message.split(/\n/, 2)[1].try(:chomp) safe_message.split("\n", 2)[1].try(:chomp)
end end
end end
......
...@@ -89,7 +89,7 @@ class Key < ActiveRecord::Base ...@@ -89,7 +89,7 @@ class Key < ActiveRecord::Base
end end
if cmd_status.zero? 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 self.fingerprint = match
end end
end end
......
...@@ -60,9 +60,9 @@ class CampfireService < Service ...@@ -60,9 +60,9 @@ class CampfireService < Service
message << "[#{project.name_with_namespace}] " message << "[#{project.name_with_namespace}] "
message << "#{push[:user_name]} " message << "#{push[:user_name]} "
if before =~ /000000/ if before.include?('000000')
message << "pushed new branch #{ref} \n" message << "pushed new branch #{ref} \n"
elsif after =~ /000000/ elsif after.include?('000000')
message << "removed branch #{ref} \n" message << "removed branch #{ref} \n"
else else
message << "pushed #{push[:total_commits_count]} commits to #{ref}. " message << "pushed #{push[:total_commits_count]} commits to #{ref}. "
......
...@@ -58,12 +58,12 @@ class HipchatService < Service ...@@ -58,12 +58,12 @@ class HipchatService < Service
message = "" message = ""
message << "#{push[:user_name]} " message << "#{push[:user_name]} "
if before =~ /000000/ if before.include?('000000')
message << "pushed new branch <a href=\""\ message << "pushed new branch <a href=\""\
"#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\ "#{project.web_url}/commits/#{URI.escape(ref)}\">#{ref}</a>"\
" to <a href=\"#{project.web_url}\">"\ " to <a href=\"#{project.web_url}\">"\
"#{project.name_with_namespace.gsub!(/\s/, "")}</a>\n" "#{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" message << "removed branch #{ref} from <a href=\"#{project.web_url}\">#{project.name_with_namespace.gsub!(/\s/,'')}</a> \n"
else else
message << "pushed to branch <a href=\""\ message << "pushed to branch <a href=\""\
......
...@@ -80,9 +80,9 @@ class PushoverService < Service ...@@ -80,9 +80,9 @@ class PushoverService < Service
before = push_data[:before] before = push_data[:before]
after = push_data[:after] after = push_data[:after]
if before =~ /000000/ if before.include?('000000')
message = "#{push_data[:user_name]} pushed new branch \"#{ref}\"." message = "#{push_data[:user_name]} pushed new branch \"#{ref}\"."
elsif after =~ /000000/ elsif after.include?('000000')
message = "#{push_data[:user_name]} deleted branch \"#{ref}\"." message = "#{push_data[:user_name]} deleted branch \"#{ref}\"."
else else
message = "#{push_data[:user_name]} push to branch \"#{ref}\"." message = "#{push_data[:user_name]} push to branch \"#{ref}\"."
......
...@@ -77,11 +77,11 @@ class SlackMessage ...@@ -77,11 +77,11 @@ class SlackMessage
end end
def new_branch? def new_branch?
before =~ /000000/ before.include?('000000')
end end
def removed_branch? def removed_branch?
after =~ /000000/ after.include?('000000')
end end
def branch_url def branch_url
......
...@@ -488,7 +488,7 @@ class User < ActiveRecord::Base ...@@ -488,7 +488,7 @@ class User < ActiveRecord::Base
end end
def temp_oauth_email? def temp_oauth_email?
email =~ /\Atemp-email-for-oauth/ email.start_with?('temp-email-for-oauth')
end end
def public_profile? def public_profile?
......
...@@ -111,23 +111,23 @@ class GitPushService ...@@ -111,23 +111,23 @@ class GitPushService
ref_parts = ref.split('/') ref_parts = ref.split('/')
# Return if this is not a push to a branch (e.g. new commits) # 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 end
def push_to_new_branch?(ref, oldrev) def push_to_new_branch?(ref, oldrev)
ref_parts = ref.split('/') ref_parts = ref.split('/')
ref_parts[1] =~ /heads/ && oldrev == Gitlab::Git::BLANK_SHA ref_parts[1].include?('heads') && oldrev == Gitlab::Git::BLANK_SHA
end end
def push_remove_branch?(ref, newrev) def push_remove_branch?(ref, newrev)
ref_parts = ref.split('/') ref_parts = ref.split('/')
ref_parts[1] =~ /heads/ && newrev == Gitlab::Git::BLANK_SHA ref_parts[1].include?('heads') && newrev == Gitlab::Git::BLANK_SHA
end end
def push_to_branch?(ref) def push_to_branch?(ref)
ref =~ /refs\/heads/ ref.include?('refs/heads')
end end
def is_default_branch?(ref) def is_default_branch?(ref)
......
...@@ -118,7 +118,7 @@ class NotificationService ...@@ -118,7 +118,7 @@ class NotificationService
return true unless note.noteable_type.present? return true unless note.noteable_type.present?
# ignore gitlab service messages # 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 return true if note.cross_reference? && note.system == true
opts = { noteable_type: note.noteable_type, project_id: note.project_id } opts = { noteable_type: note.noteable_type, project_id: note.project_id }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
= csrf_meta_tags = csrf_meta_tags
= include_gon = include_gon
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1.0'} %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/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') = render 'layouts/piwik' if extra_config.has_key?('piwik_url') && extra_config.has_key?('piwik_site_id')
......
.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
...@@ -6,21 +6,7 @@ ...@@ -6,21 +6,7 @@
= link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) = 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 = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
.file-holder.file = render 'projects/blob_editor', ref: @ref, path: @path, blob_data: @blob.data
.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 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: "Update #{@blob.name}" placeholder: "Update #{@blob.name}"
= hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'last_commit', @last_commit
...@@ -34,7 +20,6 @@ ...@@ -34,7 +20,6 @@
ace.config.loadModule("ace/ext/searchbox"); ace.config.loadModule("ace/ext/searchbox");
var ace_mode = "#{@blob.language.try(:ace_mode)}"; var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.setValue("#{escape_javascript(@blob.data)}");
if (ace_mode) { if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode); editor.getSession().setMode('ace/mode/' + ace_mode);
} }
......
...@@ -19,12 +19,7 @@ ...@@ -19,12 +19,7 @@
Encoding Encoding
.col-sm-10 .col-sm-10
= select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control' = select_tag :encoding, options_for_select([ "base64", "text" ], "text"), class: 'form-control'
.file-holder = render 'projects/blob_editor', ref: @ref
.file-title
%i.fa.fa-file
.file-content.code
%pre#editor= params[:content]
= render 'shared/commit_message_container', params: params, = render 'shared/commit_message_container', params: params,
placeholder: 'Add new file' placeholder: 'Add new file'
= hidden_field_tag 'content', '', id: 'file-content' = hidden_field_tag 'content', '', id: 'file-content'
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
- if @path.present? - if @path.present?
%tr.tree-item %tr.tree-item
%td.tree-item-file-name %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
%td.hidden-xs %td.hidden-xs
......
...@@ -154,8 +154,8 @@ Gitlab::Application.routes.draw do ...@@ -154,8 +154,8 @@ Gitlab::Application.routes.draw do
end end
end end
match "/u/:username" => "users#show", as: :user, get '/u/:username' => 'users#show', as: :user,
constraints: {username: /(?:[^.]|\.(?!atom$))+/, format: /atom/}, via: :get constraints: { username: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
# #
# Dashboard Area # Dashboard Area
......
...@@ -13,11 +13,6 @@ Feature: Project Commits Comments ...@@ -13,11 +13,6 @@ Feature: Project Commits Comments
Scenario: I can't cancel the main form Scenario: I can't cancel the main form
Then I should not see the cancel comment button 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 @javascript
Scenario: I can preview with text Scenario: I can preview with text
Given I write a comment like ":+1: Nice" Given I write a comment like ":+1: Nice"
......
...@@ -54,12 +54,6 @@ Feature: Project Commits Diff Comments ...@@ -54,12 +54,6 @@ Feature: Project Commits Diff Comments
Given I leave a diff comment like "Typo, please fix" Given I leave a diff comment like "Typo, please fix"
Then I should see a discussion reply button 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 @javascript
Scenario: I can preview with text Scenario: I can preview with text
Given I open a diff comment form Given I open a diff comment form
......
...@@ -80,7 +80,7 @@ module SharedDiffNote ...@@ -80,7 +80,7 @@ module SharedDiffNote
step 'I should not see the diff comment text field' do step 'I should not see the diff comment text field' do
within(diff_file_selector) 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
end end
...@@ -115,7 +115,7 @@ module SharedDiffNote ...@@ -115,7 +115,7 @@ module SharedDiffNote
end end
step 'I should see add a diff comment button' do 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 end
step 'I should see an empty diff comment form' do step 'I should see an empty diff comment form' do
......
...@@ -64,7 +64,7 @@ module SharedNote ...@@ -64,7 +64,7 @@ module SharedNote
step 'I should not see the comment text field' do step 'I should not see the comment text field' do
within(".js-main-target-form") 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
end end
......
...@@ -25,8 +25,8 @@ module API ...@@ -25,8 +25,8 @@ module API
# project. This applies the correct project permissions to # project. This applies the correct project permissions to
# the wiki repository as well. # the wiki repository as well.
access = access =
if project_path =~ /\.wiki\Z/ if project_path.end_with?('.wiki')
project_path.sub!(/\.wiki\Z/, '') project_path.chomp!('.wiki')
Gitlab::GitAccessWiki.new Gitlab::GitAccessWiki.new
else else
Gitlab::GitAccess.new Gitlab::GitAccess.new
......
...@@ -25,7 +25,7 @@ namespace :gitlab do ...@@ -25,7 +25,7 @@ namespace :gitlab do
puts "Processing #{repo_path}".yellow puts "Processing #{repo_path}".yellow
if path =~ /\.wiki\Z/ if path.end_with?('.wiki')
puts " * Skipping wiki repo" puts " * Skipping wiki repo"
next next
end end
......
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