Commit 71f61435 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' into new-sidebar

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	app/controllers/snippets_controller.rb
parents 63c59119 aac27550
...@@ -954,7 +954,7 @@ Lint/Void: ...@@ -954,7 +954,7 @@ Lint/Void:
Rails/ActionFilter: Rails/ActionFilter:
Description: 'Enforces consistent use of action filter methods.' Description: 'Enforces consistent use of action filter methods.'
Enabled: false Enabled: true
Rails/DefaultScope: Rails/DefaultScope:
Description: 'Checks if the argument passed to default_scope is a block.' Description: 'Checks if the argument passed to default_scope is a block.'
......
...@@ -3,14 +3,16 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -3,14 +3,16 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.11.0 (unreleased) v 7.11.0 (unreleased)
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky) - Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules - Ignore invalid lines in .gitmodules
- Fix "Cannot move project" error message from popping up after a successful transfer (Stan Hu)
- -
- - Add "Reply quoting selected text" shortcut key (`r`)
- -
- -
- -
- -
- -
- Improve new project command options (Ben Bodenmiller) - Improve new project command options (Ben Bodenmiller)
- Prevent sending empty messages to HipChat (Chulki Lee)
v 7.10.0 (unreleased) v 7.10.0 (unreleased)
- Ignore submodules that are defined in .gitmodules but are checked in as directories. - Ignore submodules that are defined in .gitmodules but are checked in as directories.
...@@ -38,7 +40,6 @@ v 7.10.0 (unreleased) ...@@ -38,7 +40,6 @@ v 7.10.0 (unreleased)
- Allow HTML tags in Markdown input - Allow HTML tags in Markdown input
- Fix code unfold not working on Compare commits page (Stan Hu) - Fix code unfold not working on Compare commits page (Stan Hu)
- Fix generating SSH key fingerprints with OpenSSH 6.8. (Sašo Stanovnik) - Fix generating SSH key fingerprints with OpenSSH 6.8. (Sašo Stanovnik)
- Include missing events and fix save functionality in admin service template settings form (Stan Hu)
- Fix "Import projects from" button to show the correct instructions (Stan Hu) - Fix "Import projects from" button to show the correct instructions (Stan Hu)
- Fix dots in Wiki slugs causing errors (Stan Hu) - Fix dots in Wiki slugs causing errors (Stan Hu)
- Make maximum attachment size configurable via Application Settings (Stan Hu) - Make maximum attachment size configurable via Application Settings (Stan Hu)
......
...@@ -42,7 +42,7 @@ gem "browser" ...@@ -42,7 +42,7 @@ gem "browser"
gem "gitlab_git", '~> 7.1.10' gem "gitlab_git", '~> 7.1.10'
# Ruby/Rack Git Smart-HTTP Server Handler # Ruby/Rack Git Smart-HTTP Server Handler
gem 'gitlab-grack', '~> 2.0.0.rc2', require: 'grack' gem 'gitlab-grack', '~> 2.0.2', require: 'grack'
# LDAP Auth # LDAP Auth
gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap" gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap"
...@@ -88,7 +88,7 @@ gem "six" ...@@ -88,7 +88,7 @@ gem "six"
gem "seed-fu" gem "seed-fu"
# Markup pipeline for GitLab # Markup pipeline for GitLab
gem 'html-pipeline-gitlab', '~> 0.1' gem 'html-pipeline', '~> 1.11.0'
# Markdown to HTML # Markdown to HTML
gem "github-markup" gem "github-markup"
...@@ -143,7 +143,7 @@ gem "redis-rails" ...@@ -143,7 +143,7 @@ gem "redis-rails"
gem 'tinder', '~> 1.9.2' gem 'tinder', '~> 1.9.2'
# HipChat integration # HipChat integration
gem "hipchat", "~> 1.4.0" gem 'hipchat', '~> 1.5.0'
# Flowdock integration # Flowdock integration
gem "gitlab-flowdock-git-hook", "~> 0.4.2" gem "gitlab-flowdock-git-hook", "~> 0.4.2"
...@@ -251,7 +251,8 @@ group :development, :test do ...@@ -251,7 +251,8 @@ group :development, :test do
# PhantomJS driver for Capybara # PhantomJS driver for Capybara
gem 'poltergeist', '~> 1.5.1' gem 'poltergeist', '~> 1.5.1'
gem 'jasmine', '2.0.2' gem 'jasmine', '~> 2.2.0'
gem 'jasmine-rails'
gem "spring", '~> 1.3.1' gem "spring", '~> 1.3.1'
gem "spring-commands-rspec", '1.0.4' gem "spring-commands-rspec", '1.0.4'
......
...@@ -199,7 +199,7 @@ GEM ...@@ -199,7 +199,7 @@ GEM
gitlab-flowdock-git-hook (0.4.2.2) gitlab-flowdock-git-hook (0.4.2.2)
gitlab-grit (>= 2.4.1) gitlab-grit (>= 2.4.1)
multi_json multi_json
gitlab-grack (2.0.0) gitlab-grack (2.0.2)
rack (~> 1.5.1) rack (~> 1.5.1)
gitlab-grit (2.7.2) gitlab-grit (2.7.2)
charlock_holmes (~> 0.6) charlock_holmes (~> 0.6)
...@@ -271,20 +271,15 @@ GEM ...@@ -271,20 +271,15 @@ GEM
hashie (2.1.2) hashie (2.1.2)
highline (1.6.21) highline (1.6.21)
hike (1.2.3) hike (1.2.3)
hipchat (1.4.0) hipchat (1.5.0)
httparty httparty
mimemagic
hitimes (1.2.2) hitimes (1.2.2)
html-pipeline (1.11.0) html-pipeline (1.11.0)
activesupport (>= 2) activesupport (>= 2)
nokogiri (~> 1.4) nokogiri (~> 1.4)
html-pipeline-gitlab (0.2.0)
actionpack (~> 4)
gitlab_emoji (~> 0.1)
html-pipeline (~> 1.11.0)
mime-types
sanitize (~> 2.1)
http_parser.rb (0.5.3) http_parser.rb (0.5.3)
httparty (0.13.0) httparty (0.13.3)
json (~> 1.8) json (~> 1.8)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpauth (0.2.1) httpauth (0.2.1)
...@@ -292,12 +287,17 @@ GEM ...@@ -292,12 +287,17 @@ GEM
i18n (0.7.0) i18n (0.7.0)
ice_cube (0.11.1) ice_cube (0.11.1)
ice_nine (0.10.0) ice_nine (0.10.0)
jasmine (2.0.2) jasmine (2.2.0)
jasmine-core (~> 2.0.0) jasmine-core (~> 2.2)
phantomjs phantomjs
rack (>= 1.2.1) rack (>= 1.2.1)
rake rake
jasmine-core (2.0.0) jasmine-core (2.2.0)
jasmine-rails (0.10.8)
jasmine-core (>= 1.3, < 3.0)
phantomjs (>= 1.9)
railties (>= 3.2.0)
sprockets-rails
jquery-atwho-rails (0.3.3) jquery-atwho-rails (0.3.3)
jquery-rails (3.1.0) jquery-rails (3.1.0)
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
...@@ -329,6 +329,7 @@ GEM ...@@ -329,6 +329,7 @@ GEM
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25.1) mime-types (1.25.1)
mimemagic (0.3.0)
mini_portile (0.6.1) mini_portile (0.6.1)
minitest (5.3.5) minitest (5.3.5)
mousetrap-rails (1.4.6) mousetrap-rails (1.4.6)
...@@ -391,7 +392,7 @@ GEM ...@@ -391,7 +392,7 @@ GEM
parser (2.2.0.2) parser (2.2.0.2)
ast (>= 1.1, < 3.0) ast (>= 1.1, < 3.0)
pg (0.15.1) pg (0.15.1)
phantomjs (1.9.2.0) phantomjs (1.9.8.0)
poltergeist (1.5.1) poltergeist (1.5.1)
capybara (~> 2.1) capybara (~> 2.1)
cliver (~> 0.3.1) cliver (~> 0.3.1)
...@@ -700,7 +701,7 @@ DEPENDENCIES ...@@ -700,7 +701,7 @@ DEPENDENCIES
gemnasium-gitlab-service (~> 0.2) gemnasium-gitlab-service (~> 0.2)
github-markup github-markup
gitlab-flowdock-git-hook (~> 0.4.2) gitlab-flowdock-git-hook (~> 0.4.2)
gitlab-grack (~> 2.0.0.rc2) gitlab-grack (~> 2.0.2)
gitlab-linguist (~> 3.0.1) gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.1) gitlab_emoji (~> 0.1)
gitlab_git (~> 7.1.10) gitlab_git (~> 7.1.10)
...@@ -714,10 +715,11 @@ DEPENDENCIES ...@@ -714,10 +715,11 @@ DEPENDENCIES
guard-rspec guard-rspec
guard-spinach guard-spinach
haml-rails haml-rails
hipchat (~> 1.4.0) hipchat (~> 1.5.0)
html-pipeline-gitlab (~> 0.1) html-pipeline (~> 1.11.0)
httparty httparty
jasmine (= 2.0.2) jasmine (~> 2.2.0)
jasmine-rails
jquery-atwho-rails (~> 0.3.3) jquery-atwho-rails (~> 0.3.3)
jquery-rails jquery-rails
jquery-scrollto-rails jquery-scrollto-rails
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#= require shortcuts #= require shortcuts
#= require shortcuts_navigation #= require shortcuts_navigation
#= require shortcuts_dashboard_navigation #= require shortcuts_dashboard_navigation
#= require shortcuts_issueable #= require shortcuts_issuable
#= require shortcuts_network #= require shortcuts_network
#= require cal-heatmap #= require cal-heatmap
#= require_tree . #= require_tree .
...@@ -173,6 +173,7 @@ $ -> ...@@ -173,6 +173,7 @@ $ ->
$(@).closest(".diff-file").find(".notes_holder").toggle() $(@).closest(".diff-file").find(".notes_holder").toggle()
e.preventDefault() e.preventDefault()
$(document).off "click", '.js-confirm-danger'
$(document).on "click", '.js-confirm-danger', (e) -> $(document).on "click", '.js-confirm-danger', (e) ->
e.preventDefault() e.preventDefault()
btn = $(e.target) btn = $(e.target)
......
...@@ -8,11 +8,13 @@ class @ConfirmDangerModal ...@@ -8,11 +8,13 @@ class @ConfirmDangerModal
submit = $('.js-confirm-danger-submit') submit = $('.js-confirm-danger-submit')
submit.disable() submit.disable()
$('.js-confirm-danger-input').off 'input'
$('.js-confirm-danger-input').on 'input', -> $('.js-confirm-danger-input').on 'input', ->
if rstrip($(@).val()) is project_path if rstrip($(@).val()) is project_path
submit.enable() submit.enable()
else else
submit.disable() submit.disable()
$('.js-confirm-danger-submit').off 'click'
$('.js-confirm-danger-submit').on 'click', => $('.js-confirm-danger-submit').on 'click', =>
@form.submit() @form.submit()
...@@ -22,7 +22,7 @@ class Dispatcher ...@@ -22,7 +22,7 @@ class Dispatcher
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
when 'projects:issues:show' when 'projects:issues:show'
new Issue() new Issue()
shortcut_handler = new ShortcutsIssueable() shortcut_handler = new ShortcutsIssuable()
new ZenMode() new ZenMode()
when 'projects:milestones:show' when 'projects:milestones:show'
new Milestone() new Milestone()
...@@ -47,7 +47,7 @@ class Dispatcher ...@@ -47,7 +47,7 @@ class Dispatcher
new IssuableForm($('.merge-request-form')) new IssuableForm($('.merge-request-form'))
when 'projects:merge_requests:show' when 'projects:merge_requests:show'
new Diff() new Diff()
shortcut_handler = new ShortcutsIssueable() shortcut_handler = new ShortcutsIssuable()
new ZenMode() new ZenMode()
when "projects:merge_requests:diffs" when "projects:merge_requests:diffs"
new Diff() new Diff()
......
#= require jquery
#= require mousetrap
#= require shortcuts_navigation
class @ShortcutsIssuable extends ShortcutsNavigation
constructor: (isMergeRequest) ->
super()
Mousetrap.bind('a', ->
$('.js-assignee').select2('open')
return false
)
Mousetrap.bind('m', ->
$('.js-milestone').select2('open')
return false
)
Mousetrap.bind('r', =>
@replyWithSelectedText()
return false
)
if isMergeRequest
@enabledHelp.push('.hidden-shortcut.merge_requests')
else
@enabledHelp.push('.hidden-shortcut.issues')
replyWithSelectedText: ->
if window.getSelection
selected = window.getSelection().toString()
replyField = $('.js-main-target-form #note_note')
return if selected.trim() == ""
# Put a '>' character before each non-empty line in the selection
quote = _.map selected.split("\n"), (val) ->
"> #{val}\n" if val.trim() != ''
# If replyField already has some content, add a newline before our quote
separator = replyField.val().trim() != "" and "\n" or ''
replyField.val (_, current) ->
current + separator + quote.join('') + "\n"
# Trigger autosave for the added text
replyField.trigger('input')
# Focus the input field
replyField.focus()
#= require shortcuts_navigation
class @ShortcutsIssueable extends ShortcutsNavigation
constructor: (isMergeRequest) ->
super()
Mousetrap.bind('a', ->
$('.js-assignee').select2('open')
return false
)
Mousetrap.bind('m', ->
$('.js-milestone').select2('open')
return false
)
if isMergeRequest
@enabledHelp.push('.hidden-shortcut.merge_reuests')
else
@enabledHelp.push('.hidden-shortcut.issues')
#= require d3
#= require jquery
#= require stat_graph_contributors_util
class @ContributorsStatGraph class @ContributorsStatGraph
init: (log) -> init: (log) ->
@parsed_log = ContributorsStatGraphUtil.parse_log(log) @parsed_log = ContributorsStatGraphUtil.parse_log(log)
......
#= require d3
#= require jquery
#= require underscore
class @ContributorsGraph class @ContributorsGraph
MARGIN: MARGIN:
top: 20 top: 20
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Automatically sets the layout and ensures an administrator is logged in # Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController class Admin::ApplicationController < ApplicationController
layout 'admin' layout 'admin'
before_filter :authenticate_admin! before_action :authenticate_admin!
def authenticate_admin! def authenticate_admin!
return render_404 unless current_user.is_admin? return render_404 unless current_user.is_admin?
......
class Admin::ApplicationSettingsController < Admin::ApplicationController class Admin::ApplicationSettingsController < Admin::ApplicationController
before_filter :set_application_setting before_action :set_application_setting
def show def show
end end
......
class Admin::BroadcastMessagesController < Admin::ApplicationController class Admin::BroadcastMessagesController < Admin::ApplicationController
before_filter :broadcast_messages before_action :broadcast_messages
def index def index
@broadcast_message = BroadcastMessage.new @broadcast_message = BroadcastMessage.new
......
class Admin::DeployKeysController < Admin::ApplicationController class Admin::DeployKeysController < Admin::ApplicationController
before_filter :deploy_keys, only: [:index] before_action :deploy_keys, only: [:index]
before_filter :deploy_key, only: [:show, :destroy] before_action :deploy_key, only: [:show, :destroy]
def index def index
......
class Admin::GroupsController < Admin::ApplicationController class Admin::GroupsController < Admin::ApplicationController
before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update] before_action :group, only: [:edit, :show, :update, :destroy, :project_update, :members_update]
def index def index
@groups = Group.all @groups = Group.all
......
class Admin::KeysController < Admin::ApplicationController class Admin::KeysController < Admin::ApplicationController
before_filter :user, only: [:show, :destroy] before_action :user, only: [:show, :destroy]
def show def show
@key = user.keys.find(params[:id]) @key = user.keys.find(params[:id])
......
class Admin::ProjectsController < Admin::ApplicationController class Admin::ProjectsController < Admin::ApplicationController
before_filter :project, only: [:show, :transfer] before_action :project, only: [:show, :transfer]
before_filter :group, only: [:show, :transfer] before_action :group, only: [:show, :transfer]
before_filter :repository, only: [:show, :transfer] before_action :repository, only: [:show, :transfer]
def index def index
@projects = Project.all @projects = Project.all
......
class Admin::ServicesController < Admin::ApplicationController class Admin::ServicesController < Admin::ApplicationController
before_filter :service, only: [:edit, :update] before_action :service, only: [:edit, :update]
def index def index
@services = services_templates @services = services_templates
......
class Admin::UsersController < Admin::ApplicationController class Admin::UsersController < Admin::ApplicationController
before_filter :user, only: [:show, :edit, :update, :destroy] before_action :user, only: [:show, :edit, :update, :destroy]
def index def index
@users = User.order_name_asc.filter(params[:filter]) @users = User.order_name_asc.filter(params[:filter])
......
...@@ -6,15 +6,15 @@ class ApplicationController < ActionController::Base ...@@ -6,15 +6,15 @@ class ApplicationController < ActionController::Base
PER_PAGE = 20 PER_PAGE = 20
before_filter :authenticate_user_from_token! before_action :authenticate_user_from_token!
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :reject_blocked! before_action :reject_blocked!
before_filter :check_password_expiration before_action :check_password_expiration
before_filter :ldap_security_check before_action :ldap_security_check
before_filter :default_headers before_action :default_headers
before_filter :add_gon_variables before_action :add_gon_variables
before_filter :configure_permitted_parameters, if: :devise_controller? before_action :configure_permitted_parameters, if: :devise_controller?
before_filter :require_email, unless: :devise_controller? before_action :require_email, unless: :devise_controller?
protect_from_forgery with: :exception protect_from_forgery with: :exception
......
class Dashboard::MilestonesController < ApplicationController class Dashboard::MilestonesController < ApplicationController
before_filter :load_projects before_action :load_projects
def index def index
project_milestones = case params[:state] project_milestones = case params[:state]
......
class Dashboard::ProjectsController < ApplicationController class Dashboard::ProjectsController < ApplicationController
before_filter :event_filter before_action :event_filter
def starred def starred
@projects = current_user.starred_projects @projects = current_user.starred_projects
......
class DashboardController < ApplicationController class DashboardController < ApplicationController
respond_to :html respond_to :html
before_filter :load_projects, except: [:projects] before_action :load_projects, except: [:projects]
before_filter :event_filter, only: :show before_action :event_filter, only: :show
def show def show
@projects = @projects.includes(:namespace) @projects = @projects.includes(:namespace)
......
class Explore::GroupsController < ApplicationController class Explore::GroupsController < ApplicationController
skip_before_filter :authenticate_user!, skip_before_action :authenticate_user!,
:reject_blocked, :set_current_user_for_observers :reject_blocked, :set_current_user_for_observers
layout "explore" layout "explore"
......
class Explore::ProjectsController < ApplicationController class Explore::ProjectsController < ApplicationController
skip_before_filter :authenticate_user!, skip_before_action :authenticate_user!,
:reject_blocked :reject_blocked
layout 'explore' layout 'explore'
......
class Groups::GroupMembersController < Groups::ApplicationController class Groups::GroupMembersController < Groups::ApplicationController
skip_before_filter :authenticate_user!, only: [:index] skip_before_action :authenticate_user!, only: [:index]
before_filter :group before_action :group
# Authorize # Authorize
before_filter :authorize_read_group! before_action :authorize_read_group!
before_filter :authorize_admin_group!, except: [:index, :leave] before_action :authorize_admin_group!, except: [:index, :leave]
layout :determine_layout layout :determine_layout
......
class Groups::MilestonesController < ApplicationController class Groups::MilestonesController < ApplicationController
layout 'group' layout 'group'
before_filter :authorize_group_milestone!, only: :update before_action :authorize_group_milestone!, only: :update
def index def index
project_milestones = case params[:state] project_milestones = case params[:state]
......
class GroupsController < Groups::ApplicationController class GroupsController < Groups::ApplicationController
skip_before_filter :authenticate_user!, only: [:show, :issues, :merge_requests] skip_before_action :authenticate_user!, only: [:show, :issues, :merge_requests]
respond_to :html respond_to :html
before_filter :group, except: [:new, :create] before_action :group, except: [:new, :create]
# Authorize # Authorize
before_filter :authorize_read_group!, except: [:new, :create] before_action :authorize_read_group!, except: [:new, :create]
before_filter :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] before_action :authorize_admin_group!, only: [:edit, :update, :destroy, :projects]
before_filter :authorize_create_group!, only: [:new, :create] before_action :authorize_create_group!, only: [:new, :create]
# Load group projects # Load group projects
before_filter :load_projects, except: [:new, :create, :projects, :edit, :update] before_action :load_projects, except: [:new, :create, :projects, :edit, :update]
before_filter :event_filter, only: :show before_action :event_filter, only: :show
before_filter :set_title, only: [:new, :create] before_action :set_title, only: [:new, :create]
layout :determine_layout layout :determine_layout
......
class Import::BitbucketController < Import::BaseController class Import::BitbucketController < Import::BaseController
before_filter :verify_bitbucket_import_enabled before_action :verify_bitbucket_import_enabled
before_filter :bitbucket_auth, except: :callback before_action :bitbucket_auth, except: :callback
rescue_from OAuth::Error, with: :bitbucket_unauthorized rescue_from OAuth::Error, with: :bitbucket_unauthorized
......
class Import::GithubController < Import::BaseController class Import::GithubController < Import::BaseController
before_filter :verify_github_import_enabled before_action :verify_github_import_enabled
before_filter :github_auth, except: :callback before_action :github_auth, except: :callback
rescue_from Octokit::Unauthorized, with: :github_unauthorized rescue_from Octokit::Unauthorized, with: :github_unauthorized
......
class Import::GitlabController < Import::BaseController class Import::GitlabController < Import::BaseController
before_filter :verify_gitlab_import_enabled before_action :verify_gitlab_import_enabled
before_filter :gitlab_auth, except: :callback before_action :gitlab_auth, except: :callback
rescue_from OAuth2::Error, with: :gitlab_unauthorized rescue_from OAuth2::Error, with: :gitlab_unauthorized
......
class Import::GoogleCodeController < Import::BaseController class Import::GoogleCodeController < Import::BaseController
before_filter :user_map, only: [:new_user_map, :create_user_map] before_action :user_map, only: [:new_user_map, :create_user_map]
def new def new
...@@ -68,7 +68,7 @@ class Import::GoogleCodeController < Import::BaseController ...@@ -68,7 +68,7 @@ class Import::GoogleCodeController < Import::BaseController
def status def status
unless client.valid? unless client.valid?
return redirect_to new_import_google_path return redirect_to new_import_google_code_path
end end
@repos = client.repos @repos = client.repos
......
class InvitesController < ApplicationController class InvitesController < ApplicationController
before_filter :member before_action :member
skip_before_filter :authenticate_user!, only: :decline skip_before_action :authenticate_user!, only: :decline
respond_to :html respond_to :html
......
class NamespacesController < ApplicationController class NamespacesController < ApplicationController
skip_before_filter :authenticate_user! skip_before_action :authenticate_user!
def show def show
namespace = Namespace.find_by(path: params[:id]) namespace = Namespace.find_by(path: params[:id])
......
class Oauth::ApplicationsController < Doorkeeper::ApplicationsController class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
before_filter :authenticate_user! before_action :authenticate_user!
layout "profile" layout "profile"
def index def index
......
class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
before_filter :authenticate_resource_owner! before_action :authenticate_resource_owner!
layout "profile" layout "profile"
def new def new
......
class Profiles::KeysController < ApplicationController class Profiles::KeysController < ApplicationController
layout "profile" layout "profile"
skip_before_filter :authenticate_user!, only: [:get_keys] skip_before_action :authenticate_user!, only: [:get_keys]
def index def index
@keys = current_user.keys @keys = current_user.keys
......
class Profiles::PasswordsController < ApplicationController class Profiles::PasswordsController < ApplicationController
layout :determine_layout layout :determine_layout
skip_before_filter :check_password_expiration, only: [:new, :create] skip_before_action :check_password_expiration, only: [:new, :create]
before_filter :set_user before_action :set_user
before_filter :set_title before_action :set_title
before_filter :authorize_change_password! before_action :authorize_change_password!
def new def new
end end
......
class ProfilesController < ApplicationController class ProfilesController < ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
before_filter :user before_action :user
before_filter :authorize_change_username!, only: :update_username before_action :authorize_change_username!, only: :update_username
skip_before_filter :require_email, only: [:show, :update] skip_before_action :require_email, only: [:show, :update]
layout 'profile' layout 'profile'
......
class Projects::ApplicationController < ApplicationController class Projects::ApplicationController < ApplicationController
before_filter :project before_action :project
before_filter :repository before_action :repository
layout :determine_layout layout :determine_layout
def authenticate_user! def authenticate_user!
......
class Projects::AvatarsController < Projects::ApplicationController class Projects::AvatarsController < Projects::ApplicationController
layout 'project' layout 'project'
before_filter :project before_action :project
def show def show
@blob = @project.repository.blob_at_branch('master', @project.avatar_in_git) @blob = @project.repository.blob_at_branch('master', @project.avatar_in_git)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::BlameController < Projects::ApplicationController class Projects::BlameController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
@blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path) @blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
......
...@@ -6,15 +6,15 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -6,15 +6,15 @@ class Projects::BlobController < Projects::ApplicationController
# Raised when given an invalid file path # Raised when given an invalid file path
class InvalidPathError < StandardError; end class InvalidPathError < StandardError; end
before_filter :require_non_empty_project, except: [:new, :create] before_action :require_non_empty_project, except: [:new, :create]
before_filter :authorize_download_code! before_action :authorize_download_code!
before_filter :authorize_push_code!, only: [:destroy] before_action :authorize_push_code!, only: [:destroy]
before_filter :assign_blob_vars before_action :assign_blob_vars
before_filter :commit, except: [:new, :create] before_action :commit, except: [:new, :create]
before_filter :blob, except: [:new, :create] before_action :blob, except: [:new, :create]
before_filter :from_merge_request, only: [:edit, :update] before_action :from_merge_request, only: [:edit, :update]
before_filter :after_edit_path, only: [:edit, :update] before_action :after_edit_path, only: [:edit, :update]
before_filter :require_branch_head, only: [:edit, :update] before_action :require_branch_head, only: [:edit, :update]
def new def new
commit unless @repository.empty? commit unless @repository.empty?
......
class Projects::BranchesController < Projects::ApplicationController class Projects::BranchesController < Projects::ApplicationController
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
before_filter :authorize_push_code!, only: [:create, :destroy] before_action :authorize_push_code!, only: [:create, :destroy]
def index def index
@sort = params[:sort] || 'name' @sort = params[:sort] || 'name'
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
# Not to be confused with CommitsController, plural. # Not to be confused with CommitsController, plural.
class Projects::CommitController < Projects::ApplicationController class Projects::CommitController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
before_filter :commit before_action :commit
def show def show
return git_not_found! unless @commit return git_not_found! unless @commit
......
...@@ -3,9 +3,9 @@ require "base64" ...@@ -3,9 +3,9 @@ require "base64"
class Projects::CommitsController < Projects::ApplicationController class Projects::CommitsController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
@repo = @project.repository @repo = @project.repository
......
class Projects::CompareController < Projects::ApplicationController class Projects::CompareController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
def index def index
end end
......
...@@ -2,7 +2,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -2,7 +2,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
respond_to :html respond_to :html
# Authorize # Authorize
before_filter :authorize_admin_project! before_action :authorize_admin_project!
layout "project_settings" layout "project_settings"
......
class Projects::ForksController < Projects::ApplicationController class Projects::ForksController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
def new def new
@namespaces = current_user.manageable_namespaces @namespaces = current_user.manageable_namespaces
......
class Projects::GraphsController < Projects::ApplicationController class Projects::GraphsController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
respond_to do |format| respond_to do |format|
......
class Projects::HooksController < Projects::ApplicationController class Projects::HooksController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_admin_project! before_action :authorize_admin_project!
respond_to :html respond_to :html
......
class Projects::ImportsController < Projects::ApplicationController class Projects::ImportsController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_admin_project! before_action :authorize_admin_project!
before_filter :require_no_repo before_action :require_no_repo
before_filter :redirect_if_progress, except: :show before_action :redirect_if_progress, except: :show
def new def new
end end
......
class Projects::IssuesController < Projects::ApplicationController class Projects::IssuesController < Projects::ApplicationController
before_filter :module_enabled before_action :module_enabled
before_filter :issue, only: [:edit, :update, :show, :toggle_subscription] before_action :issue, only: [:edit, :update, :show, :toggle_subscription]
# Allow read any issue # Allow read any issue
before_filter :authorize_read_issue! before_action :authorize_read_issue!
# Allow write(create) issue # Allow write(create) issue
before_filter :authorize_write_issue!, only: [:new, :create] before_action :authorize_write_issue!, only: [:new, :create]
# Allow modify issue # Allow modify issue
before_filter :authorize_modify_issue!, only: [:edit, :update] before_action :authorize_modify_issue!, only: [:edit, :update]
# Allow issues bulk update # Allow issues bulk update
before_filter :authorize_admin_issues!, only: [:bulk_update] before_action :authorize_admin_issues!, only: [:bulk_update]
respond_to :html respond_to :html
......
class Projects::LabelsController < Projects::ApplicationController class Projects::LabelsController < Projects::ApplicationController
before_filter :module_enabled before_action :module_enabled
before_filter :label, only: [:edit, :update, :destroy] before_action :label, only: [:edit, :update, :destroy]
before_filter :authorize_labels! before_action :authorize_labels!
before_filter :authorize_admin_labels!, except: [:index] before_action :authorize_admin_labels!, except: [:index]
respond_to :js, :html respond_to :js, :html
......
require 'gitlab/satellite/satellite' require 'gitlab/satellite/satellite'
class Projects::MergeRequestsController < Projects::ApplicationController class Projects::MergeRequestsController < Projects::ApplicationController
before_filter :module_enabled before_action :module_enabled
before_filter :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status, :toggle_subscription] before_action :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status, :toggle_subscription]
before_filter :closes_issues, only: [:edit, :update, :show, :diffs] before_action :closes_issues, only: [:edit, :update, :show, :diffs]
before_filter :validates_merge_request, only: [:show, :diffs] before_action :validates_merge_request, only: [:show, :diffs]
before_filter :define_show_vars, only: [:show, :diffs] before_action :define_show_vars, only: [:show, :diffs]
# Allow read any merge_request # Allow read any merge_request
before_filter :authorize_read_merge_request! before_action :authorize_read_merge_request!
# Allow write(create) merge_request # Allow write(create) merge_request
before_filter :authorize_write_merge_request!, only: [:new, :create] before_action :authorize_write_merge_request!, only: [:new, :create]
# Allow modify merge_request # Allow modify merge_request
before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] before_action :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort]
def index def index
terms = params['issue_search'] terms = params['issue_search']
......
class Projects::MilestonesController < Projects::ApplicationController class Projects::MilestonesController < Projects::ApplicationController
before_filter :module_enabled before_action :module_enabled
before_filter :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests] before_action :milestone, only: [:edit, :update, :destroy, :show, :sort_issues, :sort_merge_requests]
# Allow read any milestone # Allow read any milestone
before_filter :authorize_read_milestone! before_action :authorize_read_milestone!
# Allow admin milestone # Allow admin milestone
before_filter :authorize_admin_milestone!, except: [:index, :show] before_action :authorize_admin_milestone!, except: [:index, :show]
respond_to :html respond_to :html
......
...@@ -2,9 +2,9 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -2,9 +2,9 @@ class Projects::NetworkController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
include ApplicationHelper include ApplicationHelper
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
respond_to do |format| respond_to do |format|
......
class Projects::NotesController < Projects::ApplicationController class Projects::NotesController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_read_note! before_action :authorize_read_note!
before_filter :authorize_write_note!, only: [:create] before_action :authorize_write_note!, only: [:create]
before_filter :authorize_admin_note!, only: [:update, :destroy] before_action :authorize_admin_note!, only: [:update, :destroy]
before_filter :find_current_user_notes, except: [:destroy, :delete_attachment] before_action :find_current_user_notes, except: [:destroy, :delete_attachment]
def index def index
current_fetched_at = Time.now.to_i current_fetched_at = Time.now.to_i
......
class Projects::ProjectMembersController < Projects::ApplicationController class Projects::ProjectMembersController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_admin_project!, except: :leave before_action :authorize_admin_project!, except: :leave
layout "project_settings" layout "project_settings"
......
class Projects::ProtectedBranchesController < Projects::ApplicationController class Projects::ProtectedBranchesController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_admin_project! before_action :authorize_admin_project!
layout "project_settings" layout "project_settings"
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::RawController < Projects::ApplicationController class Projects::RawController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
@blob = @repository.blob_at(@commit.id, @path) @blob = @repository.blob_at(@commit.id, @path)
......
class Projects::RefsController < Projects::ApplicationController class Projects::RefsController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def switch def switch
respond_to do |format| respond_to do |format|
......
class Projects::RepositoriesController < Projects::ApplicationController class Projects::RepositoriesController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project, except: :create before_action :require_non_empty_project, except: :create
before_filter :authorize_download_code! before_action :authorize_download_code!
before_filter :authorize_admin_project!, only: :create before_action :authorize_admin_project!, only: :create
def create def create
@project.create_repository @project.create_repository
......
class Projects::ServicesController < Projects::ApplicationController class Projects::ServicesController < Projects::ApplicationController
# Authorize # Authorize
before_filter :authorize_admin_project! before_action :authorize_admin_project!
before_filter :service, only: [:edit, :update, :test] before_action :service, only: [:edit, :update, :test]
respond_to :html respond_to :html
......
class Projects::SnippetsController < Projects::ApplicationController class Projects::SnippetsController < Projects::ApplicationController
before_filter :module_enabled before_action :module_enabled
before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] before_action :snippet, only: [:show, :edit, :destroy, :update, :raw]
# Allow read any snippet # Allow read any snippet
before_filter :authorize_read_project_snippet! before_action :authorize_read_project_snippet!
# Allow write(create) snippet # Allow write(create) snippet
before_filter :authorize_write_project_snippet!, only: [:new, :create] before_action :authorize_write_project_snippet!, only: [:new, :create]
# Allow modify snippet # Allow modify snippet
before_filter :authorize_modify_project_snippet!, only: [:edit, :update] before_action :authorize_modify_project_snippet!, only: [:edit, :update]
# Allow destroy snippet # Allow destroy snippet
before_filter :authorize_admin_project_snippet!, only: [:destroy] before_action :authorize_admin_project_snippet!, only: [:destroy]
respond_to :html respond_to :html
......
class Projects::TagsController < Projects::ApplicationController class Projects::TagsController < Projects::ApplicationController
# Authorize # Authorize
before_filter :require_non_empty_project before_action :require_non_empty_project
before_filter :authorize_download_code! before_action :authorize_download_code!
before_filter :authorize_push_code!, only: [:create] before_action :authorize_push_code!, only: [:create]
before_filter :authorize_admin_project!, only: [:destroy] before_action :authorize_admin_project!, only: [:destroy]
def index def index
sorted = VersionSorter.rsort(@repository.tag_names) sorted = VersionSorter.rsort(@repository.tag_names)
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
class Projects::TreeController < Projects::ApplicationController class Projects::TreeController < Projects::ApplicationController
include ExtractsPath include ExtractsPath
before_filter :require_non_empty_project, except: [:new, :create] before_action :require_non_empty_project, except: [:new, :create]
before_filter :assign_ref_vars before_action :assign_ref_vars
before_filter :authorize_download_code! before_action :authorize_download_code!
def show def show
if tree.entries.empty? if tree.entries.empty?
......
...@@ -4,8 +4,8 @@ class Projects::UploadsController < Projects::ApplicationController ...@@ -4,8 +4,8 @@ class Projects::UploadsController < Projects::ApplicationController
# We want to skip these filters for only the `show` action if `image?` is true, # We want to skip these filters for only the `show` action if `image?` is true,
# but `skip_before_filter` doesn't work with both `only` and `if`, so we accomplish the same like this. # but `skip_before_filter` doesn't work with both `only` and `if`, so we accomplish the same like this.
skipped_filters = [:authenticate_user!, :reject_blocked!, :project, :repository] skipped_filters = [:authenticate_user!, :reject_blocked!, :project, :repository]
skip_before_filter *skipped_filters, only: [:show] skip_before_action *skipped_filters, only: [:show]
before_filter *skipped_filters, only: [:show], unless: :image? before_action *skipped_filters, only: [:show], unless: :image?
def create def create
link_to_file = ::Projects::UploadService.new(project, params[:file]). link_to_file = ::Projects::UploadService.new(project, params[:file]).
......
require 'project_wiki' require 'project_wiki'
class Projects::WikisController < Projects::ApplicationController class Projects::WikisController < Projects::ApplicationController
before_filter :authorize_read_wiki! before_action :authorize_read_wiki!
before_filter :authorize_write_wiki!, only: [:edit, :create, :history] before_action :authorize_write_wiki!, only: [:edit, :create, :history]
before_filter :authorize_admin_wiki!, only: :destroy before_action :authorize_admin_wiki!, only: :destroy
before_filter :load_project_wiki before_action :load_project_wiki
include WikiHelper include WikiHelper
def pages def pages
......
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
prepend_before_filter :render_go_import, only: [:show] prepend_before_filter :render_go_import, only: [:show]
skip_before_filter :authenticate_user!, only: [:show] skip_before_action :authenticate_user!, only: [:show]
before_filter :project, except: [:new, :create] before_action :project, except: [:new, :create]
before_filter :repository, except: [:new, :create] before_action :repository, except: [:new, :create]
# Authorize # Authorize
before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive] before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
before_filter :set_title, only: [:new, :create] before_action :set_title, only: [:new, :create]
before_filter :event_filter, only: :show before_action :event_filter, only: :show
layout 'navless', only: [:new, :create, :fork] layout 'navless', only: [:new, :create, :fork]
......
class RegistrationsController < Devise::RegistrationsController class RegistrationsController < Devise::RegistrationsController
before_filter :signup_enabled? before_action :signup_enabled?
def new def new
redirect_to(new_user_session_path) redirect_to(new_user_session_path)
......
class SnippetsController < ApplicationController class SnippetsController < ApplicationController
before_filter :snippet, only: [:show, :edit, :destroy, :update, :raw] before_action :snippet, only: [:show, :edit, :destroy, :update, :raw]
before_filter :authorize_modify_snippet!, only: [:edit, :update]
before_filter :authorize_admin_snippet!, only: [:destroy]
before_filter :set_title # Allow modify snippet
before_action :authorize_modify_snippet!, only: [:edit, :update]
skip_before_filter :authenticate_user!, only: [:index, :user_index, :show, :raw] # Allow destroy snippet
before_action :authorize_admin_snippet!, only: [:destroy]
before_action :set_title
skip_before_action :authenticate_user!, only: [:index, :user_index, :show, :raw]
respond_to :html respond_to :html
......
class UploadsController < ApplicationController class UploadsController < ApplicationController
skip_before_filter :authenticate_user! skip_before_action :authenticate_user!
before_filter :find_model, :authorize_access! before_action :find_model, :authorize_access!
def show def show
uploader = @model.send(upload_mount) uploader = @model.send(upload_mount)
......
class UsersController < ApplicationController class UsersController < ApplicationController
skip_before_filter :authenticate_user! skip_before_action :authenticate_user!
before_filter :set_user before_action :set_user
layout :determine_layout layout :determine_layout
def show def show
......
...@@ -255,12 +255,16 @@ module ApplicationHelper ...@@ -255,12 +255,16 @@ module ApplicationHelper
# #
# Returns `html_options`, adding `rel: nofollow` for external links # Returns `html_options`, adding `rel: nofollow` for external links
def add_nofollow(link, html_options = {}) def add_nofollow(link, html_options = {})
begin
uri = URI(link) uri = URI(link)
if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host if uri && uri.absolute? && uri.host != Gitlab.config.gitlab.host
rel = html_options.fetch(:rel, '') rel = html_options.fetch(:rel, '')
html_options[:rel] = (rel + ' nofollow').strip html_options[:rel] = (rel + ' nofollow').strip
end end
rescue URI::Error
# noop
end
html_options html_options
end end
......
...@@ -74,6 +74,7 @@ module GitlabMarkdownHelper ...@@ -74,6 +74,7 @@ module GitlabMarkdownHelper
end end
end end
# TODO (rspeicher): This should be its own filter
def create_relative_links(text) def create_relative_links(text)
paths = extract_paths(text) paths = extract_paths(text)
......
...@@ -108,4 +108,7 @@ module IssuesHelper ...@@ -108,4 +108,7 @@ module IssuesHelper
xml.summary issue.title xml.summary issue.title
end end
end end
# Required for Gitlab::Markdown::IssueReferenceFilter
module_function :url_for_issue, :title_for_issue
end end
module LabelsHelper module LabelsHelper
include ActionView::Helpers::TagHelper
def project_label_names def project_label_names
@project.labels.pluck(:title) @project.labels.pluck(:title)
end end
...@@ -7,9 +9,13 @@ module LabelsHelper ...@@ -7,9 +9,13 @@ module LabelsHelper
label_color = label.color || Label::DEFAULT_COLOR label_color = label.color || Label::DEFAULT_COLOR
text_color = text_color_for_bg(label_color) text_color = text_color_for_bg(label_color)
content_tag :span, class: 'label color-label', style: "background-color:#{label_color};color:#{text_color}" do # Intentionally not using content_tag here so that this method can be called
label.name # by LabelReferenceFilter
end span = %(<span class="label color-label") +
%( style="background-color: #{label_color}; color: #{text_color}">) +
escape_once(label.name) + '</span>'
span.html_safe
end end
def suggested_colors def suggested_colors
...@@ -42,13 +48,16 @@ module LabelsHelper ...@@ -42,13 +48,16 @@ module LabelsHelper
r, g, b = bg_color.slice(1,7).scan(/.{2}/).map(&:hex) r, g, b = bg_color.slice(1,7).scan(/.{2}/).map(&:hex)
if (r + g + b) > 500 if (r + g + b) > 500
"#333" '#333333'
else else
"#FFF" '#FFFFFF'
end end
end end
def project_labels_options(project) def project_labels_options(project)
options_from_collection_for_select(project.labels, 'name', 'name', params[:label_name]) options_from_collection_for_select(project.labels, 'name', 'name', params[:label_name])
end end
# Required for Gitlab::Markdown::LabelReferenceFilter
module_function :render_colored_label, :text_color_for_bg, :escape_once
end end
...@@ -27,7 +27,7 @@ class Label < ActiveRecord::Base ...@@ -27,7 +27,7 @@ class Label < ActiveRecord::Base
# Don't allow '?', '&', and ',' for label titles # Don't allow '?', '&', and ',' for label titles
validates :title, validates :title,
presence: true, presence: true,
format: { with: /\A[^&\?,&]+\z/ }, format: { with: /\A[^&\?,]+\z/ },
uniqueness: { scope: :project_id } uniqueness: { scope: :project_id }
default_scope { order(title: :asc) } default_scope { order(title: :asc) }
......
...@@ -50,8 +50,9 @@ class HipchatService < Service ...@@ -50,8 +50,9 @@ class HipchatService < Service
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
message = create_message(data)
gate[room].send('GitLab', create_message(data)) return unless message.present?
gate[room].send('GitLab', message)
end end
private private
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%p #{@service.description} template %p #{@service.description} template
= form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |f| = form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'form-horizontal fieldset-form' } do |form|
- if @service.errors.any? - if @service.errors.any?
#error_explanation #error_explanation
.alert.alert-danger .alert.alert-danger
...@@ -15,80 +15,68 @@ ...@@ -15,80 +15,68 @@
= markdown @service.help = markdown @service.help
.form-group .form-group
= f.label :active, "Active", class: "control-label" = form.label :active, "Active", class: "control-label"
.col-sm-10 .col-sm-10
= f.check_box :active = form.check_box :active
- if @service.supported_events.length > 1 - if @service.supported_events.length > 1
.form-group .form-group
= f.label :url, "Trigger", class: 'control-label' = form.label :url, "Trigger", class: 'control-label'
.col-sm-10 .col-sm-10
- if @service.supported_events.include?("push") - if @service.supported_events.include?("push")
%div %div
= f.check_box :push_events, class: 'pull-left' = form.check_box :push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :push_events, class: 'list-label' do = form.label :push_events, class: 'list-label' do
%strong Push events %strong Push events
%p.light %p.light
This url will be triggered by a push to the repository This url will be triggered by a push to the repository
- if @service.supported_events.include?("tag_push") - if @service.supported_events.include?("tag_push")
%div %div
= f.check_box :tag_push_events, class: 'pull-left' = form.check_box :tag_push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :tag_push_events, class: 'list-label' do = form.label :tag_push_events, class: 'list-label' do
%strong Tag push events %strong Tag push events
%p.light %p.light
This url will be triggered when a new tag is pushed to the repository This url will be triggered when a new tag is pushed to the repository
- if @service.supported_events.include?("note") - if @service.supported_events.include?("note")
%div %div
= f.check_box :note_events, class: 'pull-left' = form.check_box :note_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :note_events, class: 'list-label' do = form.label :note_events, class: 'list-label' do
%strong Comments %strong Comments
%p.light %p.light
This url will be triggered when someone adds a comment This url will be triggered when someone adds a comment
- if @service.supported_events.include?("issue") - if @service.supported_events.include?("issue")
%div %div
= f.check_box :issues_events, class: 'pull-left' = form.check_box :issues_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :issues_events, class: 'list-label' do = form.label :issues_events, class: 'list-label' do
%strong Issues events %strong Issues events
%p.light %p.light
This url will be triggered when an issue is created This url will be triggered when an issue is created
- if @service.supported_events.include?("merge_request") - if @service.supported_events.include?("merge_request")
%div %div
= f.check_box :merge_requests_events, class: 'pull-left' = form.check_box :merge_requests_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :merge_requests_events, class: 'list-label' do = form.label :merge_requests_events, class: 'list-label' do
%strong Merge Request events %strong Merge Request events
%p.light %p.light
This url will be triggered when a merge request is created This url will be triggered when a merge request is created
- @service.fields.each do |field| - @service.fields.each do |field|
- name = field[:name]
- title = field[:title] || name.humanize
- value = @service.send(name) unless field[:type] == 'password'
- type = field[:type] - type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]
.form-group - if type == 'fieldset'
= f.label name, title, class: "control-label" - fields = field[:fields]
.col-sm-10 - legend = field[:legend]
- if type == 'text'
= f.text_field name, class: "form-control", placeholder: placeholder %fieldset
- elsif type == 'textarea' %legend= legend
= f.text_area name, rows: 5, class: "form-control", placeholder: placeholder - fields.each do |subfield|
- elsif type == 'checkbox' = render 'shared/field', form: form, field: subfield
= f.check_box name - else
- elsif type == 'select' = render 'shared/field', form: form, field: field
= f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
= f.password_field name, class: 'form-control'
- if help
%span.help-block= help
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = form.submit 'Save', class: 'btn btn-save'
...@@ -187,7 +187,11 @@ ...@@ -187,7 +187,11 @@
%td.shortcut %td.shortcut
.key m .key m
%td Change milestone %td Change milestone
%tbody{ class: 'hidden-shortcut merge_reuests', style: 'display:none' } %tr
%td.shortcut
.key r
%td Reply (quoting selected text)
%tbody{ class: 'hidden-shortcut merge_requests', style: 'display:none' }
%tr %tr
%th %th
%th Merge Requests %th Merge Requests
...@@ -199,6 +203,10 @@ ...@@ -199,6 +203,10 @@
%td.shortcut %td.shortcut
.key m .key m
%td Change milestone %td Change milestone
%tr
%td.shortcut
.key r
%td Reply (quoting selected text)
:javascript :javascript
......
...@@ -8,9 +8,31 @@ ...@@ -8,9 +8,31 @@
Customize how Google Code email addresses and usernames are imported into GitLab. Customize how Google Code email addresses and usernames are imported into GitLab.
In the next step, you'll be able to select the projects you want to import. In the next step, you'll be able to select the projects you want to import.
%p %p
The user map is a JSON document mapping Google Code users (as keys) to the way they will be imported into GitLab (as values). By default the username is masked to ensure users' privacy. The user map is a JSON document mapping the Google Code users that participated on your projects to the way their email addresses and usernames will be imported into GitLab. You can change this by changing the value on the right hand side of <code>:</code>. Be sure to preserve the surrounding double quotes, other punctuation and the email address or username on the left hand side.
%ul
%li
%strong Default: Directly import the Google Code email address or username
%p %p
To map a Google Code user to a full name or GitLab user, simply replace the value, e.g. <code>"johnsmith@gmail.com": "John Smith"</code> or <code>"johnsmith@gmail.com": "@johnsmith"</code>. Be sure to preserve the surrounding double quotes and other punctuation. <code>"johnsmith@example.com": "johnsm...@example.com"</code>
will add "By johnsm...@example.com" to all issues and comments originally created by johnsmith@example.com.
The email address or username is masked to ensure the user's privacy.
%li
%strong Map a Google Code user to a GitLab user
%p
<code>"johnsmith@example.com": "@johnsmith"</code>
will add "By <a href="#">@johnsmith</a>" to all issues and comments originally created by johnsmith@example.com,
and will set <a href="#">@johnsmith</a> as the assignee on all issues originally assigned to johnsmith@example.com.
%li
%strong Map a Google Code user to a full name
%p
<code>"johnsmith@example.com": "John Smith"</code>
will add "By John Smith" to all issues and comments originally created by johnsmith@example.com.
%li
%strong Map a Google Code user to a full email address
%p
<code>"johnsmith@example.com": "johnsmith@example.com"</code>
will add "By <a href="#">johnsmith@example.com</a>" to all issues and comments originally created by johnsmith@example.com.
By default, the email address or username is masked to ensure the user's privacy. Use this option if you want to show the full email address.
.form-group .form-group
.col-sm-12 .col-sm-12
......
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
%div %div
.md-write-holder .md-write-holder
= yield = yield
.md-preview-holder.hide .md.md-preview-holder.hide
.js-md-preview{class: (preview_class if defined?(preview_class))} .js-md-preview{class: (preview_class if defined?(preview_class))}
...@@ -82,12 +82,12 @@ ...@@ -82,12 +82,12 @@
.mr-compare.merge-request .mr-compare.merge-request
%ul.nav.nav-tabs.merge-request-tabs %ul.nav.nav-tabs.merge-request-tabs
%li.commits-tab{data: {action: 'commits'}} %li.commits-tab{data: {action: 'commits', toggle: 'tab'}}
= link_to url_for(params) do = link_to url_for(params) do
%i.fa.fa-history %i.fa.fa-history
Commits Commits
%span.badge= @commits.size %span.badge= @commits.size
%li.diffs-tab{data: {action: 'diffs'}} %li.diffs-tab{data: {action: 'diffs', toggle: 'tab'}}
= link_to url_for(params) do = link_to url_for(params) do
%i.fa.fa-list-alt %i.fa.fa-list-alt
Changes Changes
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
%hr %hr
= form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |f| = form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'form-horizontal' }) do |form|
- if @service.errors.any? - if @service.errors.any?
.alert.alert-danger .alert.alert-danger
%ul %ul
...@@ -23,83 +23,71 @@ ...@@ -23,83 +23,71 @@
= markdown @service.help = markdown @service.help
.form-group .form-group
= f.label :active, "Active", class: "control-label" = form.label :active, "Active", class: "control-label"
.col-sm-10 .col-sm-10
= f.check_box :active = form.check_box :active
- if @service.supported_events.length > 1 - if @service.supported_events.length > 1
.form-group .form-group
= f.label :url, "Trigger", class: 'control-label' = form.label :url, "Trigger", class: 'control-label'
.col-sm-10 .col-sm-10
- if @service.supported_events.include?("push") - if @service.supported_events.include?("push")
%div %div
= f.check_box :push_events, class: 'pull-left' = form.check_box :push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :push_events, class: 'list-label' do = form.label :push_events, class: 'list-label' do
%strong Push events %strong Push events
%p.light %p.light
This url will be triggered by a push to the repository This url will be triggered by a push to the repository
- if @service.supported_events.include?("tag_push") - if @service.supported_events.include?("tag_push")
%div %div
= f.check_box :tag_push_events, class: 'pull-left' = form.check_box :tag_push_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :tag_push_events, class: 'list-label' do = form.label :tag_push_events, class: 'list-label' do
%strong Tag push events %strong Tag push events
%p.light %p.light
This url will be triggered when a new tag is pushed to the repository This url will be triggered when a new tag is pushed to the repository
- if @service.supported_events.include?("note") - if @service.supported_events.include?("note")
%div %div
= f.check_box :note_events, class: 'pull-left' = form.check_box :note_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :note_events, class: 'list-label' do = form.label :note_events, class: 'list-label' do
%strong Comments %strong Comments
%p.light %p.light
This url will be triggered when someone adds a comment This url will be triggered when someone adds a comment
- if @service.supported_events.include?("issue") - if @service.supported_events.include?("issue")
%div %div
= f.check_box :issues_events, class: 'pull-left' = form.check_box :issues_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :issues_events, class: 'list-label' do = form.label :issues_events, class: 'list-label' do
%strong Issues events %strong Issues events
%p.light %p.light
This url will be triggered when an issue is created This url will be triggered when an issue is created
- if @service.supported_events.include?("merge_request") - if @service.supported_events.include?("merge_request")
%div %div
= f.check_box :merge_requests_events, class: 'pull-left' = form.check_box :merge_requests_events, class: 'pull-left'
.prepend-left-20 .prepend-left-20
= f.label :merge_requests_events, class: 'list-label' do = form.label :merge_requests_events, class: 'list-label' do
%strong Merge Request events %strong Merge Request events
%p.light %p.light
This url will be triggered when a merge request is created This url will be triggered when a merge request is created
- @service.fields.each do |field| - @service.fields.each do |field|
- name = field[:name]
- title = field[:title] || name.humanize
- value = service_field_value(field[:type], @service.send(name))
- type = field[:type] - type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]
.form-group - if type == 'fieldset'
= f.label name, title, class: "control-label" - fields = field[:fields]
.col-sm-10 - legend = field[:legend]
- if type == 'text'
= f.text_field name, class: "form-control", placeholder: placeholder %fieldset
- elsif type == 'textarea' %legend= legend
= f.text_area name, rows: 5, class: "form-control", placeholder: placeholder - fields.each do |subfield|
- elsif type == 'checkbox' = render 'shared/field', form: form, field: subfield
= f.check_box name - else
- elsif type == 'select' = render 'shared/field', form: form, field: field
= f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
= f.password_field name, placeholder: value, class: 'form-control'
- if help
%span.help-block= help
.form-actions .form-actions
= f.submit 'Save', class: 'btn btn-save' = form.submit 'Save', class: 'btn btn-save'
&nbsp; &nbsp;
- if @service.valid? && @service.activated? - if @service.valid? && @service.activated?
- disabled = @service.can_test? ? '':'disabled' - disabled = @service.can_test? ? '':'disabled'
......
- name = field[:name]
- title = field[:title] || name.humanize
- value = service_field_value(field[:type], @service.send(name))
- type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
- default_choice = field[:default_choice]
- help = field[:help]
.form-group
= form.label name, title, class: "control-label"
.col-sm-10
- if type == 'text'
= form.text_field name, class: "form-control", placeholder: placeholder
- elsif type == 'textarea'
= form.text_area name, rows: 5, class: "form-control", placeholder: placeholder
- elsif type == 'checkbox'
= form.check_box name
- elsif type == 'select'
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
= form.password_field name, placeholder: value, class: 'form-control'
- if help
%span.help-block= help
...@@ -2,6 +2,7 @@ require 'sidekiq/web' ...@@ -2,6 +2,7 @@ require 'sidekiq/web'
require 'api/api' require 'api/api'
Gitlab::Application.routes.draw do Gitlab::Application.routes.draw do
mount JasmineRails::Engine => '/specs' if defined?(JasmineRails)
use_doorkeeper do use_doorkeeper do
controllers applications: 'oauth/applications', controllers applications: 'oauth/applications',
authorized_applications: 'oauth/authorized_applications', authorized_applications: 'oauth/authorized_applications',
......
...@@ -470,7 +470,6 @@ ActiveRecord::Schema.define(version: 20150417122318) do ...@@ -470,7 +470,6 @@ ActiveRecord::Schema.define(version: 20150417122318) do
t.integer "notification_level", default: 1, null: false t.integer "notification_level", default: 1, null: false
t.datetime "password_expires_at" t.datetime "password_expires_at"
t.integer "created_by_id" t.integer "created_by_id"
t.datetime "last_credential_check_at"
t.string "avatar" t.string "avatar"
t.string "confirmation_token" t.string "confirmation_token"
t.datetime "confirmed_at" t.datetime "confirmed_at"
...@@ -478,6 +477,7 @@ ActiveRecord::Schema.define(version: 20150417122318) do ...@@ -478,6 +477,7 @@ ActiveRecord::Schema.define(version: 20150417122318) do
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.boolean "hide_no_ssh_key", default: false t.boolean "hide_no_ssh_key", default: false
t.string "website_url", default: "", null: false t.string "website_url", default: "", null: false
t.datetime "last_credential_check_at"
t.string "github_access_token" t.string "github_access_token"
t.string "gitlab_access_token" t.string "gitlab_access_token"
t.string "notification_email" t.string "notification_email"
......
...@@ -16,7 +16,7 @@ To enable Slack integration you must create an Incoming WebHooks integration on ...@@ -16,7 +16,7 @@ To enable Slack integration you must create an Incoming WebHooks integration on
1. Choose the channel name you want to send notifications to 1. Choose the channel name you want to send notifications to
1. Click **Add Incoming WebHooks Integration**Add Integrations. 1. Click **Add Incoming WebHooks Integration**
- Optional step; You can change bot's name and avatar by clicking modifying the bot name or avatar under **Integration Settings**. - Optional step; You can change bot's name and avatar by clicking modifying the bot name or avatar under **Integration Settings**.
1. Copy the **Webhook URL**, we'll need this later for GitLab. 1. Copy the **Webhook URL**, we'll need this later for GitLab.
...@@ -32,10 +32,15 @@ After Slack is ready we need to setup GitLab. Here are the steps to achieve this ...@@ -32,10 +32,15 @@ After Slack is ready we need to setup GitLab. Here are the steps to achieve this
1. Navigate to Settings -> Services -> Slack 1. Navigate to Settings -> Services -> Slack
1. Fill in your Slack details 1. Pick the triggers you want to activate
1. Fill in your Slack details
- Webhook: Paste the Webhook URL from the step above
- Username: Fill this in if you want to change the username of the bot
- Channel: Fill this in if you want to change the channel where the messages will be posted
- Mark it as active - Mark it as active
- Paste in the webhook URL you got from Slack
1. Save your settings
Have fun :) Have fun :)
......
...@@ -163,7 +163,7 @@ Consult the [Emoji Cheat Sheet](http://emoji.codes) for a list of all supported ...@@ -163,7 +163,7 @@ Consult the [Emoji Cheat Sheet](http://emoji.codes) for a list of all supported
## Special GitLab References ## Special GitLab References
GFM recognized special references. GFM recognizes special references.
You can easily reference e.g. an issue, a commit, a team member or even the whole team within a project. You can easily reference e.g. an issue, a commit, a team member or even the whole team within a project.
...@@ -171,19 +171,30 @@ GFM will turn that reference into a link so you can navigate between them easily ...@@ -171,19 +171,30 @@ GFM will turn that reference into a link so you can navigate between them easily
GFM will recognize the following: GFM will recognize the following:
- @foo : for specific team members or groups | input | references |
- @all : for the whole team |-----------------------:|:---------------------------|
- #123 : for issues | `@user_name` | specific user |
- !123 : for merge requests | `@group_name` | specific group |
- $123 : for snippets | `@all` | entire team |
- 1234567 : for commits | `#123` | issue |
- \[file\](path/to/file) : for file references | `!123` | merge request |
| `$123` | snippet |
GFM also recognizes references to commits, issues, and merge requests in other projects: | `~123` | label by ID |
| `~bug` | one-word label by name |
- namespace/project#123 : for issues | `~"feature request"` | multi-word label by name |
- namespace/project!123 : for merge requests | `9ba12248` | specific commit |
- namespace/project@1234567 : for commits | `9ba12248...b19a04f5` | commit range comparison |
| `[README](doc/README)` | repository file references |
GFM also recognizes certain cross-project references:
| input | references |
|----------------------------------------:|:------------------------|
| `namespace/project#123` | issue |
| `namespace/project!123` | merge request |
| `namespace/project$123` | snippet |
| `namespace/project@9ba12248` | specific commit |
| `namespace/project@9ba12248...b19a04f5` | commit range comparison |
## Task Lists ## Task Lists
......
...@@ -162,6 +162,7 @@ Options: ...@@ -162,6 +162,7 @@ Options:
``` ```
BACKUP=timestamp_of_backup (required if more than one backup exists) BACKUP=timestamp_of_backup (required if more than one backup exists)
force=yes (do not ask if the authorized_keys file should get regenerated)
``` ```
Example output: Example output:
......
...@@ -126,7 +126,7 @@ sudo apt-get install nodejs ...@@ -126,7 +126,7 @@ sudo apt-get install nodejs
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch sudo -u git -H git fetch
sudo -u git -H git checkout v2.6.0 sudo -u git -H git checkout v2.6.2
``` ```
## 7. Install libs, migrations, etc. ## 7. Install libs, migrations, etc.
......
...@@ -42,6 +42,8 @@ sudo -u git -H git checkout v2.6.0 ...@@ -42,6 +42,8 @@ sudo -u git -H git checkout v2.6.0
### 4. Install libs, migrations, etc. ### 4. Install libs, migrations, etc.
Please refer to the [Node.js setup documentation](https://github.com/joyent/node/wiki/installing-node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions) if you aren't running default GitLab server setup.
```bash ```bash
sudo apt-get install nodejs sudo apt-get install nodejs
......
# From 7.9 to 7.10
### 0. Stop server
sudo service gitlab stop
### 1. Backup
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
### 2. Get latest code
```bash
sudo -u git -H git fetch --all
sudo -u git -H git checkout -- db/schema.rb # local changes will be restored automatically
```
For GitLab Community Edition:
```bash
sudo -u git -H git checkout 7-10-stable
```
OR
For GitLab Enterprise Edition:
```bash
sudo -u git -H git checkout 7-10-stable-ee
```
### 3. Update gitlab-shell
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
sudo -u git -H git checkout v2.6.2
```
### 4. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
# MySQL installations (note: the line below states '--without ... postgres')
sudo -u git -H bundle install --without development test postgres --deployment
# PostgreSQL installations (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
# Clean up assets and cache
sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
### 5. Update config files
#### New configuration options for `gitlab.yml`
There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them to your current `gitlab.yml`.
```
git diff origin/7-9-stable:config/gitlab.yml.example origin/7-10-stable:config/gitlab.yml.example
```
#### Change Nginx settings
* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as [`lib/support/nginx/gitlab`](/lib/support/nginx/gitlab) but with your settings.
* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as [`lib/support/nginx/gitlab-ssl`](/lib/support/nginx/gitlab-ssl) but with your settings.
* A new `location /uploads/` section has been added that needs to have the same content as the existing `location @gitlab` section.
#### Setup time zone (optional)
Consider setting the time zone in `gitlab.yml` otherwise GitLab will default to UTC. If you set a time zone previously in [`application.rb`](config/application.rb) (unlikely), unset it.
### 6. Start application
sudo service gitlab start
sudo service nginx restart
### 7. Check application status
Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
To make sure you didn't miss anything run a more thorough check with:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
If all items are green, then congratulations upgrade is complete!
### 8. GitHub settings (if applicable)
If you are using GitHub as an OAuth provider for authentication, you should change the callback URL so that it
only contains a root URL (ex. `https://gitlab.example.com/`)
## Things went south? Revert to previous version (7.9)
### 1. Revert the code to the previous version
Follow the [upgrade guide from 7.8 to 7.8](7.8-to-7.9.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
\ No newline at end of file
...@@ -26,12 +26,11 @@ If you have local changes to your GitLab repository the script will stash them a ...@@ -26,12 +26,11 @@ If you have local changes to your GitLab repository the script will stash them a
Note: GitLab 7.9 adds `nodejs` as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies) Note: GitLab 7.9 adds `nodejs` as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
# Starting with GitLab version 7.0 upgrader script has been moved to bin directory
cd /home/git/gitlab cd /home/git/gitlab
if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb; else sudo -u git -H ruby script/upgrade.rb; fi sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"v7.10.0"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute'
# to perform a non-interactive install (no user input required) you can add -y # to perform a non-interactive install (no user input required) you can add -y
# if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb -y; else sudo -u git -H ruby script/upgrade.rb -y; fi # sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"v7.10.0"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute' -- -y
## 3. Start application ## 3. Start application
...@@ -66,11 +65,12 @@ Here is a one line command with step 1 to 5 for the next time you upgrade: ...@@ -66,11 +65,12 @@ Here is a one line command with step 1 to 5 for the next time you upgrade:
cd /home/git/gitlab; \ cd /home/git/gitlab; \
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \
sudo service gitlab stop; \ sudo service gitlab stop; \
if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb -y; else sudo -u git -H ruby script/upgrade.rb -y; fi; \ sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"v7.10.0"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute' -- -y; \
cd /home/git/gitlab-shell; \ cd /home/git/gitlab-shell; \
sudo -u git -H git fetch; \ sudo -u git -H git fetch; \
sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`; \ sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`; \
cd /home/git/gitlab; \ cd /home/git/gitlab; \
sudo service gitlab start; \ sudo service gitlab start; \
sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production sudo service nginx restart; \
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
``` ```
...@@ -30,7 +30,10 @@ module Gitlab ...@@ -30,7 +30,10 @@ module Gitlab
def user_map def user_map
@user_map ||= begin @user_map ||= begin
user_map = Hash.new { |hash, user| Client.mask_email(user) } user_map = Hash.new do |hash, user|
# Replace ... by \.\.\., so `johnsm...@gmail.com` isn't autolinked.
Client.mask_email(user).sub("...", "\\.\\.\\.")
end
import_data = project.import_data.try(:data) import_data = project.import_data.try(:data)
stored_user_map = import_data["user_map"] if import_data stored_user_map = import_data["user_map"] if import_data
...@@ -203,25 +206,25 @@ module Gitlab ...@@ -203,25 +206,25 @@ module Gitlab
end end
def linkify_issues(s) def linkify_issues(s)
s.gsub(/([Ii]ssue) ([0-9]+)/, '\1 #\2') s = s.gsub(/([Ii]ssue) ([0-9]+)/, '\1 #\2')
s = s.gsub(/([Cc]omment) #([0-9]+)/, '\1 \2')
s
end end
def escape_for_markdown(s) def escape_for_markdown(s)
s = s.gsub("*", "\\*") # No headings and lists
s = s.gsub("#", "\\#") s = s.gsub(/^#/, "\\#")
s = s.gsub(/^-/, "\\-")
# No inline code
s = s.gsub("`", "\\`") s = s.gsub("`", "\\`")
s = s.gsub(":", "\\:")
s = s.gsub("-", "\\-") # Carriage returns make me sad
s = s.gsub("+", "\\+")
s = s.gsub("_", "\\_")
s = s.gsub("(", "\\(")
s = s.gsub(")", "\\)")
s = s.gsub("[", "\\[")
s = s.gsub("]", "\\]")
s = s.gsub("<", "\\<")
s = s.gsub(">", "\\>")
s = s.gsub("\r", "") s = s.gsub("\r", "")
# Markdown ignores single newlines, but we need them as <br />.
s = s.gsub("\n", " \n") s = s.gsub("\n", " \n")
s s
end end
...@@ -276,11 +279,18 @@ module Gitlab ...@@ -276,11 +279,18 @@ module Gitlab
if raw_updates.has_key?("blockedOn") if raw_updates.has_key?("blockedOn")
blocked_ons = raw_updates["blockedOn"].map do |raw_blocked_on| blocked_ons = raw_updates["blockedOn"].map do |raw_blocked_on|
name, id = raw_blocked_on.split(":", 2) name, id = raw_blocked_on.split(":", 2)
deleted = name.start_with?("-")
name = name[1..-1] if deleted
text =
if name == project.import_source if name == project.import_source
"##{id}" "##{id}"
else else
"#{project.namespace.path}/#{name}##{id}" "#{project.namespace.path}/#{name}##{id}"
end end
text = "~~#{text}~~" if deleted
text
end end
updates << "*Blocked on: #{blocked_ons.join(", ")}*" updates << "*Blocked on: #{blocked_ons.join(", ")}*"
end end
...@@ -288,11 +298,18 @@ module Gitlab ...@@ -288,11 +298,18 @@ module Gitlab
if raw_updates.has_key?("blocking") if raw_updates.has_key?("blocking")
blockings = raw_updates["blocking"].map do |raw_blocked_on| blockings = raw_updates["blocking"].map do |raw_blocked_on|
name, id = raw_blocked_on.split(":", 2) name, id = raw_blocked_on.split(":", 2)
deleted = name.start_with?("-")
name = name[1..-1] if deleted
text =
if name == project.import_source if name == project.import_source
"##{id}" "##{id}"
else else
"#{project.namespace.path}/#{name}##{id}" "#{project.namespace.path}/#{name}##{id}"
end end
text = "~~#{text}~~" if deleted
text
end end
updates << "*Blocking: #{blockings.join(", ")}*" updates << "*Blocking: #{blockings.join(", ")}*"
end end
...@@ -340,7 +357,7 @@ module Gitlab ...@@ -340,7 +357,7 @@ module Gitlab
def format_issue_body(author, date, content, attachments) def format_issue_body(author, date, content, attachments)
body = [] body = []
body << "*By #{author} on #{date}*" body << "*By #{author} on #{date} (imported from Google Code)*"
body << "---" body << "---"
if content.blank? if content.blank?
......
This diff is collapsed.
module Gitlab
module Markdown
# HTML filter that replaces commit range references with links.
#
# This filter supports cross-project references.
class CommitRangeReferenceFilter < ReferenceFilter
include CrossProjectReference
# Public: Find commit range references in text
#
# CommitRangeReferenceFilter.references_in(text) do |match, commit_range, project_ref|
# "<a href=...>#{commit_range}</a>"
# end
#
# text - String text to search.
#
# Yields the String match, the String commit range, and an optional String
# of the external project reference.
#
# Returns a String replaced with the return of the block.
def self.references_in(text)
text.gsub(COMMIT_RANGE_PATTERN) do |match|
yield match, $~[:commit_range], $~[:project]
end
end
def initialize(*args)
super
@commit_map = {}
end
# Pattern used to extract commit range references from text
#
# The beginning and ending SHA1 sums can be between 6 and 40 hex
# characters, and the range selection can be double- or triple-dot.
#
# This pattern supports cross-project references.
COMMIT_RANGE_PATTERN = /(#{PROJECT_PATTERN}@)?(?<commit_range>\h{6,40}\.{2,3}\h{6,40})/
def call
replace_text_nodes_matching(COMMIT_RANGE_PATTERN) do |content|
commit_range_link_filter(content)
end
end
# Replace commit range references in text with links to compare the commit
# ranges.
#
# text - String text to replace references in.
#
# Returns a String with commit range references replaced with links. All
# links have `gfm` and `gfm-commit_range` class names attached for
# styling.
def commit_range_link_filter(text)
self.class.references_in(text) do |match, commit_range, project_ref|
project = self.project_from_ref(project_ref)
from_id, to_id = split_commit_range(commit_range)
if valid_range?(project, from_id, to_id)
url = url_for_commit_range(project, from_id, to_id)
title = "Commits #{from_id} through #{to_id}"
klass = reference_class(:commit_range)
project_ref += '@' if project_ref
%(<a href="#{url}"
title="#{title}"
class="#{klass}">#{project_ref}#{commit_range}</a>)
else
match
end
end
end
def split_commit_range(range)
from_id, to_id = range.split(/\.{2,3}/, 2)
from_id << "^" if range !~ /\.{3}/
[from_id, to_id]
end
def commit(id)
unless @commit_map[id]
@commit_map[id] = project.repository.commit(id)
end
@commit_map[id]
end
def valid_range?(project, from_id, to_id)
project && project.valid_repo? && commit(from_id) && commit(to_id)
end
def url_for_commit_range(project, from_id, to_id)
h = Rails.application.routes.url_helpers
h.namespace_project_compare_url(project.namespace, project,
from: from_id, to: to_id,
only_path: context[:only_path])
end
end
end
end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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