'
@@ -38,25 +42,7 @@ module TabHelper
#
# Returns a list item element String
def nav_link(options = {}, &block)
- if path = options.delete(:path)
- if path.respond_to?(:each)
- c = path.map { |p| p.split('#').first }
- a = path.map { |p| p.split('#').last }
- else
- c, a, _ = path.split('#')
- end
- else
- c = options.delete(:controller)
- a = options.delete(:action)
- end
-
- if c && a
- # When given both options, make sure BOTH are active
- klass = current_controller?(*c) && current_action?(*a) ? 'active' : ''
- else
- # Otherwise check EITHER option
- klass = current_controller?(*c) || current_action?(*a) ? 'active' : ''
- end
+ klass = active_nav_link?(options) ? 'active' : ''
# Add our custom class into the html_options, which may or may not exist
# and which may or may not already have a :class key
@@ -72,6 +58,34 @@ module TabHelper
end
end
+ def active_nav_link?(options)
+ if path = options.delete(:path)
+ unless path.respond_to?(:each)
+ path = [path]
+ end
+
+ path.any? do |single_path|
+ current_path?(single_path)
+ end
+ else
+ c = options.delete(:controller)
+ a = options.delete(:action)
+
+ if c && a
+ # When given both options, make sure BOTH are true
+ current_controller?(*c) && current_action?(*a)
+ else
+ # Otherwise check EITHER option
+ current_controller?(*c) || current_action?(*a)
+ end
+ end
+ end
+
+ def current_path?(path)
+ c, a, _ = path.split('#')
+ current_controller?(c) && current_action?(a)
+ end
+
def project_tab_class
return "active" if current_page?(controller: "/projects", action: :edit, id: @project)
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 8e2094983231c4c9bd2b2ac0fc6eb4e6c1e7cc3e..5a96a208e930f4d44124b2068d5b8647c20816a1 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -53,13 +53,41 @@ module TreeHelper
File.join(*args)
end
- def allowed_tree_edit?
- return false unless @repository.branch_names.include?(@ref)
+ def allowed_tree_edit?(project = nil, ref = nil)
+ project ||= @project
+ ref ||= @ref
+ return false unless project.repository.branch_names.include?(ref)
- if @project.protected_branch? @ref
- can?(current_user, :push_code_to_protected_branches, @project)
+ if project.protected_branch? ref
+ can?(current_user, :push_code_to_protected_branches, project)
else
- can?(current_user, :push_code, @project)
+ can?(current_user, :push_code, project)
+ end
+ end
+
+ def edit_blob_link(project, ref, path, options = {})
+ blob =
+ begin
+ project.repository.blob_at(ref, path)
+ rescue
+ nil
+ end
+
+ if blob && blob.text?
+ text = 'Edit'
+ after = options[:after] || ''
+ from_mr = options[:from_merge_request_id]
+ link_opts = {}
+ link_opts[:from_merge_request_id] = from_mr if from_mr
+ cls = 'btn btn-small'
+ if allowed_tree_edit?(project, ref)
+ link_to text, project_edit_tree_path(project, tree_join(ref, path),
+ link_opts), class: cls
+ else
+ content_tag :span, text, class: cls + ' disabled'
+ end + after.html_safe
+ else
+ ''
end
end
@@ -85,6 +113,16 @@ module TreeHelper
tree_join(@ref, file)
end
+ # returns the relative path of the first subdir that doesn't have only one directory descendand
+ def flatten_tree(tree)
+ subtree = Gitlab::Git::Tree.where(@repository, @commit.id, tree.path)
+ if subtree.count == 1 && subtree.first.dir?
+ return tree_join(tree.name, flatten_tree(subtree.first))
+ else
+ return tree.name
+ end
+ end
+
def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost."
end
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
new file mode 100644
index 0000000000000000000000000000000000000000..aed4068f309e09a2419929ef874d5eac94d51aa0
--- /dev/null
+++ b/app/models/application_setting.rb
@@ -0,0 +1,23 @@
+class ApplicationSetting < ActiveRecord::Base
+ validates :home_page_url, allow_blank: true,
+ format: { with: URI::regexp(%w(http https)), message: "should be a valid url" },
+ if: :home_page_url_column_exist
+
+ def self.current
+ ApplicationSetting.last
+ end
+
+ def self.create_from_defaults
+ create(
+ default_projects_limit: Settings.gitlab['default_projects_limit'],
+ signup_enabled: Settings.gitlab['signup_enabled'],
+ signin_enabled: Settings.gitlab['signin_enabled'],
+ gravatar_enabled: Settings.gravatar['enabled'],
+ sign_in_text: Settings.extra['sign_in_text'],
+ )
+ end
+
+ def home_page_url_column_exist
+ ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url)
+ end
+end
diff --git a/app/models/event.rb b/app/models/event.rb
index 65b4c2edfee043d343707218f95b2e9993805850..2a6c690ab912c558a5707e9885685c268e5bccc4 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -174,7 +174,7 @@ class Event < ActiveRecord::Base
def valid_push?
data[:ref] && ref_name.present?
- rescue => ex
+ rescue
false
end
diff --git a/app/models/group.rb b/app/models/group.rb
index b8ed3b8ac73bffb61499d65098da8dc6c4ddaa31..733afa2fc075c38ea0848b8b6f14583e55518aa3 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -21,7 +21,7 @@ class Group < Namespace
has_many :users, through: :group_members
validate :avatar_type, if: ->(user) { user.avatar_changed? }
- validates :avatar, file_size: { maximum: 100.kilobytes.to_i }
+ validates :avatar, file_size: { maximum: 200.kilobytes.to_i }
mount_uploader :avatar, AttachmentUploader
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 8479d4aecf6950ebd31c2d6a7d3730a819edf615..d1d522be19404f291a02c18cc519a5e3ba0d61cb 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -48,7 +48,7 @@ class WebHook < ActiveRecord::Base
verify: false,
basic_auth: auth)
end
- rescue SocketError, Errno::ECONNREFUSED => e
+ rescue SocketError, Errno::ECONNREFUSED, Net::OpenTimeout => e
logger.error("WebHook Error => #{e}")
false
end
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 2cc427d35c23e65b195d058aba46264d26b2737a..de0ee0e2c5a93d205bf7de82401deac8e3119eb0 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -189,7 +189,9 @@ class MergeRequest < ActiveRecord::Base
end
def automerge!(current_user, commit_message = nil)
- MergeRequests::AutoMergeService.new.execute(self, current_user, commit_message)
+ MergeRequests::AutoMergeService.
+ new(target_project, current_user).
+ execute(self, commit_message)
end
def open?
diff --git a/app/models/note.rb b/app/models/note.rb
index 5996298be22727dbc7397dea3b1bc8aa0399b423..e99bc2668d616b04763d5b3753a9950f8090d2df 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -296,6 +296,7 @@ class Note < ActiveRecord::Base
# If not - its outdated diff
def active?
return true unless self.diff
+ return false unless noteable
noteable.diffs.each do |mr_diff|
next unless mr_diff.new_path == self.diff.new_path
diff --git a/app/models/notification.rb b/app/models/notification.rb
index b0f8ed6a4ecdaa2856a12d2c67d964c4c7a8568f..1395274173d4d18609167b6b9f6ed12abc133076 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -6,12 +6,13 @@ class Notification
N_PARTICIPATING = 1
N_WATCH = 2
N_GLOBAL = 3
+ N_MENTION = 4
attr_accessor :target
class << self
def notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH]
+ [N_DISABLED, N_PARTICIPATING, N_WATCH, N_MENTION]
end
def options_with_labels
@@ -19,12 +20,13 @@ class Notification
disabled: N_DISABLED,
participating: N_PARTICIPATING,
watch: N_WATCH,
+ mention: N_MENTION,
global: N_GLOBAL
}
end
def project_notification_levels
- [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL]
+ [N_DISABLED, N_PARTICIPATING, N_WATCH, N_GLOBAL, N_MENTION]
end
end
@@ -48,6 +50,10 @@ class Notification
target.notification_level == N_GLOBAL
end
+ def mention?
+ target.notification_level == N_MENTION
+ end
+
def level
target.notification_level
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 32b0145ca24df983129242ebf5a5102faa85bf2d..b0c379e6157374bbef63c7593ee33aec1359104f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -66,6 +66,7 @@ class Project < ActiveRecord::Base
has_one :slack_service, dependent: :destroy
has_one :buildbox_service, dependent: :destroy
has_one :bamboo_service, dependent: :destroy
+ has_one :teamcity_service, dependent: :destroy
has_one :pushover_service, dependent: :destroy
has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id"
has_one :forked_from_project, through: :forked_project_link
@@ -314,7 +315,8 @@ class Project < ActiveRecord::Base
end
def available_services_names
- %w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla emails_on_push gemnasium slack pushover buildbox bamboo)
+ %w(gitlab_ci campfire hipchat pivotaltracker flowdock assembla
+ emails_on_push gemnasium slack pushover buildbox bamboo teamcity)
end
def gitlab_ci?
@@ -329,11 +331,6 @@ class Project < ActiveRecord::Base
@ci_service ||= ci_services.select(&:activated?).first
end
- # For compatibility with old code
- def code
- path
- end
-
def items_for(entity)
case entity
when 'issue' then
@@ -470,6 +467,10 @@ class Project < ActiveRecord::Base
protected_branches_names.include?(branch_name)
end
+ def developers_can_push_to_protected_branch?(branch_name)
+ protected_branches.any? { |pb| pb.name == branch_name && pb.developers_can_push }
+ end
+
def forked?
!(forked_project_link.nil? || forked_project_link.forked_from_project.nil?)
end
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index a848d74044cb05ca8eba8aa0ea2722fd4da4814a..6ef4b210c563c0d52a5911fb7073c6498cc4cb19 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -35,7 +35,7 @@ class HipchatService < Service
{ type: 'text', name: 'token', placeholder: '' },
{ type: 'text', name: 'room', placeholder: '' },
{ type: 'text', name: 'server',
- placeholder: 'Leave blank for default. https://chat.hipchat.com' }
+ placeholder: 'Leave blank for default. https://hipchat.example.com' }
]
end
@@ -47,7 +47,7 @@ class HipchatService < Service
def gate
options = { api_version: 'v2' }
- options[:server_url] = server unless server.nil?
+ options[:server_url] = server unless server.blank?
@gate ||= HipChat::Client.new(token, options)
end
diff --git a/app/models/project_services/slack_message.rb b/app/models/project_services/slack_message.rb
index 28204e5ea60e6f2694296a9004df287449a459e1..d0ddb1f162c78f7610350e3effc929c002280a36 100644
--- a/app/models/project_services/slack_message.rb
+++ b/app/models/project_services/slack_message.rb
@@ -1,6 +1,14 @@
require 'slack-notifier'
class SlackMessage
+ attr_reader :after
+ attr_reader :before
+ attr_reader :commits
+ attr_reader :project_name
+ attr_reader :project_url
+ attr_reader :ref
+ attr_reader :username
+
def initialize(params)
@after = params.fetch(:after)
@before = params.fetch(:before)
@@ -23,14 +31,6 @@ class SlackMessage
private
- attr_reader :after
- attr_reader :before
- attr_reader :commits
- attr_reader :project_name
- attr_reader :project_url
- attr_reader :ref
- attr_reader :username
-
def message
if new_branch?
new_branch_message
diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb
new file mode 100644
index 0000000000000000000000000000000000000000..52b5862e4d124ad6ed43f68bbfe2f58698cab394
--- /dev/null
+++ b/app/models/project_services/teamcity_service.rb
@@ -0,0 +1,116 @@
+class TeamcityService < CiService
+ include HTTParty
+
+ prop_accessor :teamcity_url, :build_type, :username, :password
+
+ validates :teamcity_url, presence: true,
+ format: { with: URI::regexp }, if: :activated?
+ validates :build_type, presence: true, if: :activated?
+ validates :username, presence: true,
+ if: ->(service) { service.password? }, if: :activated?
+ validates :password, presence: true,
+ if: ->(service) { service.username? }, if: :activated?
+
+ attr_accessor :response
+
+ after_save :compose_service_hook, if: :activated?
+
+ def compose_service_hook
+ hook = service_hook || build_service_hook
+ hook.save
+ end
+
+ def title
+ 'JetBrains TeamCity CI'
+ end
+
+ def description
+ 'A continuous integration and build server'
+ end
+
+ def help
+ 'The build configuration in Teamcity must use the build format '\
+ 'number %build.vcs.number% '\
+ 'you will also want to configure monitoring of all branches so merge '\
+ 'requests build, that setting is in the vsc root advanced settings.'
+ end
+
+ def to_param
+ 'teamcity'
+ end
+
+ def fields
+ [
+ { type: 'text', name: 'teamcity_url',
+ placeholder: 'TeamCity root URL like https://teamcity.example.com' },
+ { type: 'text', name: 'build_type',
+ placeholder: 'Build configuration ID' },
+ { type: 'text', name: 'username',
+ placeholder: 'A user with permissions to trigger a manual build' },
+ { type: 'password', name: 'password' },
+ ]
+ end
+
+ def build_info(sha)
+ url = URI.parse("#{teamcity_url}/httpAuth/app/rest/builds/"\
+ "branch:unspecified:any,number:#{sha}")
+ auth = {
+ username: username,
+ password: password,
+ }
+ @response = HTTParty.get("#{url}", verify: false, basic_auth: auth)
+ end
+
+ def build_page(sha)
+ build_info(sha) if @response.nil? || !@response.code
+
+ if @response.code != 200
+ # If actual build link can't be determined,
+ # send user to build summary page.
+ "#{teamcity_url}/viewLog.html?buildTypeId=#{build_type}"
+ else
+ # If actual build link is available, go to build result page.
+ built_id = @response['build']['id']
+ "#{teamcity_url}/viewLog.html?buildId=#{built_id}"\
+ "&buildTypeId=#{build_type}"
+ end
+ end
+
+ def commit_status(sha)
+ build_info(sha) if @response.nil? || !@response.code
+ return :error unless @response.code == 200 || @response.code == 404
+
+ status = if @response.code == 404
+ 'Pending'
+ else
+ @response['build']['status']
+ end
+
+ if status.include?('SUCCESS')
+ 'success'
+ elsif status.include?('FAILURE')
+ 'failed'
+ elsif status.include?('Pending')
+ 'pending'
+ else
+ :error
+ end
+ end
+
+ def execute(data)
+ auth = {
+ username: username,
+ password: password,
+ }
+
+ branch = data[:ref]
+
+ self.class.post("#{teamcity_url}/httpAuth/app/rest/buildQueue",
+ body: ""\
+ ""\
+ '',
+ headers: { 'Content-type' => 'application/xml' },
+ basic_auth: auth
+ )
+ end
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index 7faeef1b5b0ab83b92bcee1fe8d53753951eb4c8..6e5ac9b39c839210083a06e2053091da963e326d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -51,14 +51,15 @@ require 'file_size_validator'
class User < ActiveRecord::Base
include Gitlab::ConfigHelper
- extend Gitlab::ConfigHelper
include TokenAuthenticatable
+ extend Gitlab::ConfigHelper
+ extend Gitlab::CurrentSettings
default_value_for :admin, false
default_value_for :can_create_group, gitlab_config.default_can_create_group
default_value_for :can_create_team, false
default_value_for :hide_no_ssh_key, false
- default_value_for :projects_limit, gitlab_config.default_projects_limit
+ default_value_for :projects_limit, current_application_settings.default_projects_limit
default_value_for :theme_id, gitlab_config.default_theme
devise :database_authenticatable, :lockable, :async,
@@ -106,6 +107,7 @@ class User < ActiveRecord::Base
has_many :recent_events, -> { order "id DESC" }, foreign_key: :author_id, class_name: "Event"
has_many :assigned_issues, dependent: :destroy, foreign_key: :assignee_id, class_name: "Issue"
has_many :assigned_merge_requests, dependent: :destroy, foreign_key: :assignee_id, class_name: "MergeRequest"
+ has_many :oauth_applications, class_name: 'Doorkeeper::Application', as: :owner, dependent: :destroy
#
@@ -564,4 +566,8 @@ class User < ActiveRecord::Base
namespaces += masters_groups
end
end
+
+ def oauth_authorized_tokens
+ Doorkeeper::AccessToken.where(resource_owner_id: self.id, revoked_at: nil)
+ end
end
diff --git a/app/services/base_service.rb b/app/services/base_service.rb
index 0d46eeaa18f11539eb8018ad47f861b26b7cbd6f..bb51795df7c359c15bc1d1d418db7ea0d0288812 100644
--- a/app/services/base_service.rb
+++ b/app/services/base_service.rb
@@ -1,4 +1,6 @@
class BaseService
+ include Gitlab::CurrentSettings
+
attr_accessor :project, :current_user, :params
def initialize(project, user, params = {})
@@ -29,6 +31,10 @@ class BaseService
SystemHooksService.new
end
+ def current_application_settings
+ ApplicationSetting.current
+ end
+
private
def error(message)
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb
index 9b2a2270233d80129fd2a4e546f7acf0cd65eec0..041c2287c36595aaf555311e4d7a36686694a026 100644
--- a/app/services/create_tag_service.rb
+++ b/app/services/create_tag_service.rb
@@ -21,10 +21,15 @@ class CreateTagService < BaseService
new_tag = repository.find_tag(tag_name)
if new_tag
+ if project.gitlab_ci?
+ push_data = create_push_data(project, current_user, new_tag)
+ project.gitlab_ci_service.async_execute(push_data)
+ end
+
Event.create_ref_event(project, current_user, new_tag, 'add', 'refs/tags')
- return success(new_tag)
+ success(new_tag)
else
- return error('Invalid reference name')
+ error('Invalid reference name')
end
end
@@ -33,4 +38,9 @@ class CreateTagService < BaseService
out[:tag] = branch
out
end
+
+ def create_push_data(project, user, tag)
+ Gitlab::PushDataBuilder.
+ build(project, user, Gitlab::Git::BLANK_SHA, tag.target, 'refs/tags/' + tag.name, [])
+ end
end
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 529af1970f6626651940a1af63644d5eccc0dbe2..a9ea7daabc8ec58cb5ff5451b7cd9bd6707f54b5 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -52,16 +52,6 @@ class GitPushService
end
end
- # This method provide a sample data
- # generated with post_receive_data method
- # for given project
- #
- def sample_data(project, user)
- @project, @user = project, user
- @push_commits = project.repository.commits(project.default_branch, nil, 3)
- post_receive_data(@push_commits.last.id, @push_commits.first.id, "refs/heads/#{project.default_branch}")
- end
-
protected
def create_push_event(push_data)
@@ -112,58 +102,9 @@ class GitPushService
end
end
- # Produce a hash of post-receive data
- #
- # data = {
- # before: String,
- # after: String,
- # ref: String,
- # user_id: String,
- # user_name: String,
- # project_id: String,
- # repository: {
- # name: String,
- # url: String,
- # description: String,
- # homepage: String,
- # },
- # commits: Array,
- # total_commits_count: Fixnum
- # }
- #
def post_receive_data(oldrev, newrev, ref)
- # Total commits count
- push_commits_count = push_commits.size
-
- # Get latest 20 commits ASC
- push_commits_limited = push_commits.last(20)
-
- # Hash to be passed as post_receive_data
- data = {
- before: oldrev,
- after: newrev,
- ref: ref,
- user_id: user.id,
- user_name: user.name,
- project_id: project.id,
- repository: {
- name: project.name,
- url: project.url_to_repo,
- description: project.description,
- homepage: project.web_url,
- },
- commits: [],
- total_commits_count: push_commits_count
- }
-
- # For performance purposes maximum 20 latest commits
- # will be passed as post receive hook data.
- #
- push_commits_limited.each do |commit|
- data[:commits] << commit.hook_attrs(project)
- end
-
- data
+ Gitlab::PushDataBuilder.
+ build(project, user, oldrev, newrev, ref, push_commits)
end
def push_to_existing_branch?(ref, oldrev)
diff --git a/app/services/git_tag_push_service.rb b/app/services/git_tag_push_service.rb
index 62eaf9b4f51ea591c7d1a6b3199b6ae6382aab81..c24809ad60796ed551d9b4d18339cd71a0803f89 100644
--- a/app/services/git_tag_push_service.rb
+++ b/app/services/git_tag_push_service.rb
@@ -8,25 +8,19 @@ class GitTagPushService
create_push_event
project.repository.expire_cache
project.execute_hooks(@push_data.dup, :tag_push_hooks)
+
+ if project.gitlab_ci?
+ project.gitlab_ci_service.async_execute(@push_data)
+ end
+
+ true
end
private
def create_push_data(oldrev, newrev, ref)
- data = {
- ref: ref,
- before: oldrev,
- after: newrev,
- user_id: user.id,
- user_name: user.name,
- project_id: project.id,
- repository: {
- name: project.name,
- url: project.url_to_repo,
- description: project.description,
- homepage: project.web_url
- }
- }
+ Gitlab::PushDataBuilder.
+ build(project, user, oldrev, newrev, ref, [])
end
def create_push_event
diff --git a/app/services/gravatar_service.rb b/app/services/gravatar_service.rb
index a69c7c78377e13739a68ae45533c51699259cf49..4bee0c26a68e1e7c32c2ea91946ac8ee0c79e65a 100644
--- a/app/services/gravatar_service.rb
+++ b/app/services/gravatar_service.rb
@@ -1,6 +1,8 @@
class GravatarService
+ include Gitlab::CurrentSettings
+
def execute(email, size = nil)
- if gravatar_config.enabled && email.present?
+ if current_application_settings.gravatar_enabled? && email.present?
size = 40 if size.nil? || size <= 0
sprintf gravatar_url,
diff --git a/app/services/merge_requests/auto_merge_service.rb b/app/services/merge_requests/auto_merge_service.rb
index 20b88d1510cfe6a1213ba73b00b01659e064755b..b5d90a74e155680c8ce627731f96106504ddfee7 100644
--- a/app/services/merge_requests/auto_merge_service.rb
+++ b/app/services/merge_requests/auto_merge_service.rb
@@ -5,15 +5,16 @@ module MergeRequests
# mark merge request as merged and execute all hooks and notifications
# Called when you do merge via GitLab UI
class AutoMergeService < BaseMergeService
- def execute(merge_request, current_user, commit_message)
+ def execute(merge_request, commit_message)
merge_request.lock_mr
if Gitlab::Satellite::MergeAction.new(current_user, merge_request).merge!(commit_message)
merge_request.merge
- notification.merge_mr(merge_request, current_user)
+ notification_service.merge_mr(merge_request, current_user)
create_merge_event(merge_request, current_user)
- execute_project_hooks(merge_request)
+ create_note(merge_request)
+ execute_hooks(merge_request)
true
else
diff --git a/app/services/merge_requests/base_merge_service.rb b/app/services/merge_requests/base_merge_service.rb
index 700a21ca01150eda33681ae25a1c21adfd0f1458..9579573adf9fb9ff34c1b59f08668b46b11b04b2 100644
--- a/app/services/merge_requests/base_merge_service.rb
+++ b/app/services/merge_requests/base_merge_service.rb
@@ -1,21 +1,10 @@
module MergeRequests
- class BaseMergeService
+ class BaseMergeService < MergeRequests::BaseService
private
- def notification
- NotificationService.new
- end
-
def create_merge_event(merge_request, current_user)
EventCreateService.new.merge_mr(merge_request, current_user)
end
-
- def execute_project_hooks(merge_request)
- if merge_request.project
- hook_data = merge_request.to_hook_data(current_user)
- merge_request.project.execute_hooks(hook_data, :merge_request_hooks)
- end
- end
end
end
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index 1475973e543acfe78a64ecfdcbaaa76e5d0a81ed..859c3f56b2b943fcc7b3ec679677f86ab37249bb 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -13,7 +13,7 @@ module MergeRequests
merge_request.target_branch ||= merge_request.target_project.default_branch
unless merge_request.target_branch && merge_request.source_branch
- return build_failed(merge_request, "You must select source and target branches")
+ return build_failed(merge_request, nil)
end
# Generate suggested MR title based on source branch name
@@ -59,7 +59,7 @@ module MergeRequests
end
def build_failed(merge_request, message)
- merge_request.errors.add(:base, message)
+ merge_request.errors.add(:base, message) unless message.nil?
merge_request.compare_commits = []
merge_request.can_be_created = false
merge_request
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index 680766140bdf2ede94077110dfce5b0e7154871d..5de7247d617ae6024517f9c2c0e2e8bee0b2c9b4 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -6,12 +6,13 @@ module MergeRequests
# Called when you do merge via command line and push code
# to target branch
class MergeService < BaseMergeService
- def execute(merge_request, current_user, commit_message)
+ def execute(merge_request, commit_message)
merge_request.merge
- notification.merge_mr(merge_request, current_user)
+ notification_service.merge_mr(merge_request, current_user)
create_merge_event(merge_request, current_user)
- execute_project_hooks(merge_request)
+ create_note(merge_request)
+ execute_hooks(merge_request)
true
rescue
diff --git a/app/services/merge_requests/refresh_service.rb b/app/services/merge_requests/refresh_service.rb
index baf0936cc3d77942cddb8a8da4d5f0a6281f3abd..a6705de61f2fc3a6181f9ed04ea127a430cacd2d 100644
--- a/app/services/merge_requests/refresh_service.rb
+++ b/app/services/merge_requests/refresh_service.rb
@@ -32,7 +32,9 @@ module MergeRequests
merge_requests.uniq.select(&:source_project).each do |merge_request|
- MergeRequests::MergeService.new.execute(merge_request, @current_user, nil)
+ MergeRequests::MergeService.
+ new(merge_request.target_project, @current_user).
+ execute(merge_request, nil)
end
end
diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb
new file mode 100644
index 0000000000000000000000000000000000000000..63431b82471ee5e16a9b1d1283dccc85d6ac957a
--- /dev/null
+++ b/app/services/notes/update_service.rb
@@ -0,0 +1,25 @@
+module Notes
+ class UpdateService < BaseService
+ def execute
+ note = project.notes.find(params[:note_id])
+ note.note = params[:note]
+ if note.save
+ notification_service.new_note(note)
+
+ # Skip system notes, like status changes and cross-references.
+ unless note.system
+ event_service.leave_note(note, note.author)
+
+ # Create a cross-reference note if this Note contains GFM that
+ # names an issue, merge request, or commit.
+ note.references.each do |mentioned|
+ Note.create_cross_reference_note(mentioned, note.noteable,
+ note.author, note.project)
+ end
+ end
+ end
+
+ note
+ end
+ end
+end
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index d1aadd741e1fa7052e69b64aa6bc8172456bed87..fb8f812dad84133d6cb1ed4d572145f180670311 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -144,6 +144,10 @@ class NotificationService
# Merge project watchers
recipients = recipients.concat(project_watchers(note.project)).compact.uniq
+ # Reject mention users unless mentioned in comment
+ recipients = reject_mention_users(recipients - note.mentioned_users, note.project)
+ recipients = recipients + note.mentioned_users
+
# Reject mutes users
recipients = reject_muted_users(recipients, note.project)
@@ -285,13 +289,39 @@ class NotificationService
end
end
+ # Remove users with notification level 'Mentioned'
+ def reject_mention_users(users, project = nil)
+ users = users.to_a.compact.uniq
+
+ users.reject do |user|
+ next user.notification.mention? unless project
+
+ tm = project.project_members.find_by(user_id: user.id)
+
+ if !tm && project.group
+ tm = project.group.group_members.find_by(user_id: user.id)
+ end
+
+ # reject users who globally set mention notification and has no membership
+ next user.notification.mention? unless tm
+
+ # reject users who set mention notification in project
+ next true if tm.notification.mention?
+
+ # reject users who have N_MENTION in project and disabled in global settings
+ tm.notification.global? && user.notification.mention?
+ end
+ end
+
def new_resource_email(target, project, method)
if target.respond_to?(:participants)
recipients = target.participants
else
recipients = []
end
+
recipients = reject_muted_users(recipients, project)
+ recipients = reject_mention_users(recipients, project)
recipients = recipients.concat(project_watchers(project)).uniq
recipients.delete(target.author)
@@ -302,6 +332,7 @@ class NotificationService
def close_resource_email(target, project, current_user, method)
recipients = reject_muted_users([target.author, target.assignee], project)
+ recipients = reject_mention_users(recipients, project)
recipients = recipients.concat(project_watchers(project)).uniq
recipients.delete(current_user)
@@ -320,6 +351,7 @@ class NotificationService
# reject users with disabled notifications
recipients = reject_muted_users(recipients, project)
+ recipients = reject_mention_users(recipients, project)
# Reject me from recipients if I reassign an item
recipients.delete(current_user)
@@ -331,6 +363,7 @@ class NotificationService
def reopen_resource_email(target, project, current_user, method, status)
recipients = reject_muted_users([target.author, target.assignee], project)
+ recipients = reject_mention_users(recipients, project)
recipients = recipients.concat(project_watchers(project)).uniq
recipients.delete(current_user)
diff --git a/app/services/oauth2/access_token_validation_service.rb b/app/services/oauth2/access_token_validation_service.rb
new file mode 100644
index 0000000000000000000000000000000000000000..95283489753ff9bf32e42862df1196488809a10d
--- /dev/null
+++ b/app/services/oauth2/access_token_validation_service.rb
@@ -0,0 +1,41 @@
+module Oauth2::AccessTokenValidationService
+ # Results:
+ VALID = :valid
+ EXPIRED = :expired
+ REVOKED = :revoked
+ INSUFFICIENT_SCOPE = :insufficient_scope
+
+ class << self
+ def validate(token, scopes: [])
+ if token.expired?
+ return EXPIRED
+
+ elsif token.revoked?
+ return REVOKED
+
+ elsif !self.sufficent_scope?(token, scopes)
+ return INSUFFICIENT_SCOPE
+
+ else
+ return VALID
+ end
+ end
+
+ protected
+ # True if the token's scope is a superset of required scopes,
+ # or the required scopes is empty.
+ def sufficent_scope?(token, scopes)
+ if scopes.blank?
+ # if no any scopes required, the scopes of token is sufficient.
+ return true
+ else
+ # If there are scopes required, then check whether
+ # the set of authorized scopes is a superset of the set of required scopes
+ required_scopes = Set.new(scopes)
+ authorized_scopes = Set.new(token.scopes)
+
+ return authorized_scopes >= required_scopes
+ end
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb
new file mode 100644
index 0000000000000000000000000000000000000000..09fc25cc1b30aaaeacface2c9948e6b69502ba96
--- /dev/null
+++ b/app/services/projects/autocomplete_service.rb
@@ -0,0 +1,15 @@
+module Projects
+ class AutocompleteService < BaseService
+ def initialize(project)
+ @project = project
+ end
+
+ def issues
+ @project.issues.opened.select([:iid, :title, :description])
+ end
+
+ def merge_requests
+ @project.merge_requests.opened.select([:iid, :title, :description])
+ end
+ end
+end
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index 3672b6238069ad9d1318a3eb91baa8390ed115d0..31226b7504b5a88468f596b7b733c5c1d090ce1e 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -12,12 +12,17 @@ module Projects
@project.visibility_level = default_features.visibility_level
end
- # Parametrize path for project
- #
- # Ex.
- # 'GitLab HQ'.parameterize => "gitlab-hq"
- #
- @project.path = @project.name.dup.parameterize unless @project.path.present?
+ # Set project name from path
+ if @project.name.present? && @project.path.present?
+ # if both name and path set - everything is ok
+ elsif @project.path.present?
+ # Set project name from path
+ @project.name = @project.path.dup
+ elsif @project.name.present?
+ # For compatibility - set path from name
+ # TODO: remove this in 8.0
+ @project.path = @project.name.dup.parameterize
+ end
# get namespace id
namespace_id = params[:namespace_id]
diff --git a/app/services/test_hook_service.rb b/app/services/test_hook_service.rb
index 17d86a7a274d2b4d44212e5e8c73b1f4a29d05c1..21ec2c01cb86a43c6223a41f95bf87c540a713aa 100644
--- a/app/services/test_hook_service.rb
+++ b/app/services/test_hook_service.rb
@@ -1,6 +1,6 @@
class TestHookService
def execute(hook, current_user)
- data = GitPushService.new.sample_data(hook.project, current_user)
+ data = Gitlab::PushDataBuilder.build_sample(hook.project, current_user)
hook.execute(data)
end
end
diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..9423a207068aaef4df53333278a57d10fde7becf
--- /dev/null
+++ b/app/views/admin/application_settings/_form.html.haml
@@ -0,0 +1,38 @@
+= form_for @application_setting, url: admin_application_settings_path, html: { class: 'form-horizontal fieldset-form' } do |f|
+ - if @application_setting.errors.any?
+ #error_explanation
+ .alert.alert-danger
+ - @application_setting.errors.full_messages.each do |msg|
+ %p= msg
+
+ %fieldset
+ %legend Features
+ .form-group
+ = f.label :signup_enabled, class: 'control-label'
+ .col-sm-10
+ = f.check_box :signup_enabled, class: 'checkbox'
+ .form-group
+ = f.label :signin_enabled, class: 'control-label'
+ .col-sm-10
+ = f.check_box :signin_enabled, class: 'checkbox'
+ .form-group
+ = f.label :gravatar_enabled, class: 'control-label'
+ .col-sm-10
+ = f.check_box :gravatar_enabled, class: 'checkbox'
+ %fieldset
+ %legend Misc
+ .form-group
+ = f.label :default_projects_limit, class: 'control-label'
+ .col-sm-10
+ = f.number_field :default_projects_limit, class: 'form-control'
+ .form-group
+ = f.label :home_page_url, class: 'control-label'
+ .col-sm-10
+ = f.text_field :home_page_url, class: 'form-control', placeholder: 'http://company.example.com'
+ %span.help-block We will redirect non-logged in users to this page
+ .form-group
+ = f.label :sign_in_text, class: 'control-label'
+ .col-sm-10
+ = f.text_area :sign_in_text, class: 'form-control'
+ .form-actions
+ = f.submit 'Save', class: 'btn btn-primary'
diff --git a/app/views/admin/application_settings/show.html.haml b/app/views/admin/application_settings/show.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..39b66647a5a878754f9afc1ac642ab387d9c91db
--- /dev/null
+++ b/app/views/admin/application_settings/show.html.haml
@@ -0,0 +1,3 @@
+%h3.page-title Application settings
+%hr
+= render 'form'
diff --git a/app/views/admin/applications/_delete_form.html.haml b/app/views/admin/applications/_delete_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..371ac55209f5849582d6fe172017837926765b11
--- /dev/null
+++ b/app/views/admin/applications/_delete_form.html.haml
@@ -0,0 +1,4 @@
+- submit_btn_css ||= 'btn btn-link btn-remove btn-small'
+= form_tag admin_application_path(application) do
+ %input{:name => "_method", :type => "hidden", :value => "delete"}/
+ = submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css
\ No newline at end of file
diff --git a/app/views/admin/applications/_form.html.haml b/app/views/admin/applications/_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..b77d188a38d5053062d7fda5eab4dd4e601a09bb
--- /dev/null
+++ b/app/views/admin/applications/_form.html.haml
@@ -0,0 +1,24 @@
+= form_for [:admin, @application], url: @url, html: {class: 'form-horizontal', role: 'form'} do |f|
+ - if application.errors.any?
+ .alert.alert-danger{"data-alert" => ""}
+ %p Whoops! Check your form for possible errors
+ = content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do
+ = f.label :name, class: 'col-sm-2 control-label'
+ .col-sm-10
+ = f.text_field :name, class: 'form-control'
+ = doorkeeper_errors_for application, :name
+ = content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do
+ = f.label :redirect_uri, class: 'col-sm-2 control-label'
+ .col-sm-10
+ = f.text_area :redirect_uri, class: 'form-control'
+ = doorkeeper_errors_for application, :redirect_uri
+ %span.help-block
+ Use one line per URI
+ - if Doorkeeper.configuration.native_redirect_uri
+ %span.help-block
+ Use
+ %code= Doorkeeper.configuration.native_redirect_uri
+ for local tests
+ .form-actions
+ = f.submit 'Submit', class: "btn btn-primary wide"
+ = link_to "Cancel", admin_applications_path, class: "btn btn-default"
diff --git a/app/views/admin/applications/edit.html.haml b/app/views/admin/applications/edit.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..e408ae2f29d0647bae76bf1c039e33ec525ff34a
--- /dev/null
+++ b/app/views/admin/applications/edit.html.haml
@@ -0,0 +1,3 @@
+%h3.page-title Edit application
+- @url = admin_application_path(@application)
+= render 'form', application: @application
\ No newline at end of file
diff --git a/app/views/admin/applications/index.html.haml b/app/views/admin/applications/index.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..97991ca13e65c828b5a4c3084882f8671ae016e5
--- /dev/null
+++ b/app/views/admin/applications/index.html.haml
@@ -0,0 +1,22 @@
+%h3.page-title
+ System OAuth applications
+%p.light
+ System OAuth application does not belong to certain user and can be managed only by admins
+%hr
+%p= link_to 'New Application', new_admin_application_path, class: 'btn btn-success'
+%table.table.table-striped
+ %thead
+ %tr
+ %th Name
+ %th Callback URL
+ %th Clients
+ %th
+ %th
+ %tbody
+ - @applications.each do |application|
+ %tr{:id => "application_#{application.id}"}
+ %td= link_to application.name, admin_application_path(application)
+ %td= application.redirect_uri
+ %td= application.access_tokens.count
+ %td= link_to 'Edit', edit_admin_application_path(application), class: 'btn btn-link'
+ %td= render 'delete_form', application: application
diff --git a/app/views/admin/applications/new.html.haml b/app/views/admin/applications/new.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..7c62425f19c94bd3bee5c05d9ed9a944b0a2b1a4
--- /dev/null
+++ b/app/views/admin/applications/new.html.haml
@@ -0,0 +1,3 @@
+%h3.page-title New application
+- @url = admin_applications_path
+= render 'form', application: @application
\ No newline at end of file
diff --git a/app/views/admin/applications/show.html.haml b/app/views/admin/applications/show.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..2abe390ce13e7b853e11d7c6f28766375dd2c1d6
--- /dev/null
+++ b/app/views/admin/applications/show.html.haml
@@ -0,0 +1,26 @@
+%h3.page-title
+ Application: #{@application.name}
+
+
+%table.table
+ %tr
+ %td
+ Application Id
+ %td
+ %code#application_id= @application.uid
+ %tr
+ %td
+ Secret:
+ %td
+ %code#secret= @application.secret
+
+ %tr
+ %td
+ Callback url
+ %td
+ - @application.redirect_uri.split.each do |uri|
+ %div
+ %span.monospace= uri
+.form-actions
+ = link_to 'Edit', edit_admin_application_path(@application), class: 'btn btn-primary wide pull-left'
+ = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10'
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 4ea28cff8d188a0d3ce1521e2b807c54635bde1b..8fb5c68d25e526bd2920681116cc85e12c8d59dd 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -104,7 +104,7 @@
%p
Sign up
%span.light.pull-right
- = boolean_to_icon gitlab_config.signup_enabled
+ = boolean_to_icon signup_enabled?
%p
LDAP
%span.light.pull-right
@@ -112,7 +112,7 @@
%p
Gravatar
%span.light.pull-right
- = boolean_to_icon Gitlab.config.gravatar.enabled
+ = boolean_to_icon gravatar_enabled?
%p
OmniAuth
%span.light.pull-right
diff --git a/app/views/admin/groups/_form.html.haml b/app/views/admin/groups/_form.html.haml
index d20a1b34d4ee5a90f8c59f182820da4371907132..86a732006095183368af1bbf5c5541caee302bfb 100644
--- a/app/views/admin/groups/_form.html.haml
+++ b/app/views/admin/groups/_form.html.haml
@@ -21,17 +21,6 @@
= link_to 'Cancel', admin_groups_path, class: "btn btn-cancel"
- else
- .form-group.group_name_holder
- = f.label :path, class: 'control-label' do
- %span Group path
- .col-sm-10
- = f.text_field :path, placeholder: "example-group", class: "form-control danger", dir: :auto
- .bs-callout.bs-callout-danger
- %ul
- %li Changing group path can have unintended side effects.
- %li Renaming group path will rename directory for all related projects
- %li It will change web url for access group and group projects.
- %li It will change the git path to repositories under this group.
.form-actions
= f.submit 'Save changes', class: "btn btn-primary"
= link_to 'Cancel', admin_group_path(@group), class: "btn btn-cancel"
diff --git a/app/views/admin/keys/show.html.haml b/app/views/admin/keys/show.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..5b23027b3abdbee6c68b0589bf846054c37a5b5e
--- /dev/null
+++ b/app/views/admin/keys/show.html.haml
@@ -0,0 +1 @@
+= render "profiles/keys/key_details", admin: true
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 867660d0abc9a07dd8eda8a6145fda0a56c593a3..c75915b641bca53d05477f7d02358afe94a605ae 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -20,6 +20,8 @@
%a{"data-toggle" => "tab", href: "#groups"} Groups
%li
%a{"data-toggle" => "tab", href: "#projects"} Projects
+ %li
+ %a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
.tab-content
#account.tab-pane.active
@@ -217,3 +219,5 @@
- if tm.respond_to? :project
= link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do
%i.fa.fa-times
+ #ssh-keys.tab-pane
+ = render 'profiles/keys/key_table', admin: true
diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml
index 8d1f6cccb8c0383790248a608e7816c1d7158297..9ee8257ea7486ec0b5926852e72b7340ad402b43 100644
--- a/app/views/dashboard/_groups.html.haml
+++ b/app/views/dashboard/_groups.html.haml
@@ -1,10 +1,11 @@
.panel.panel-default
.panel-heading.clearfix
- = search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control', dir:'auto'
- - if current_user.can_create_group?
- = link_to new_group_path, class: "btn btn-new pull-right" do
- %i.fa.fa-plus
- New group
+ .input-group
+ = search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control', dir: :auto
+ - if current_user.can_create_group?
+ .input-group-addon
+ = link_to new_group_path, class: "" do
+ %strong New group
%ul.well-list.dash-list
- groups.each do |group|
%li.group-row
diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml
index f6f3f4db702dbb9f3faeb92a38dc358c29dc449f..50d6ee505976de0546198d0b56a13c41fba7da4b 100644
--- a/app/views/dashboard/_projects.html.haml
+++ b/app/views/dashboard/_projects.html.haml
@@ -1,10 +1,11 @@
.panel.panel-default
.panel-heading.clearfix
- = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter form-control', dir:'auto'
- - if current_user.can_create_project?
- = link_to new_project_path, class: "btn btn-new pull-right" do
- %i.fa.fa-plus
- New project
+ .input-group
+ = search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter form-control', dir: :auto
+ - if current_user.can_create_project?
+ .input-group-addon
+ = link_to new_project_path, class: "" do
+ %strong New project
%ul.well-list.dash-list
- projects.each do |project|
diff --git a/app/views/dashboard/_projects_filter.html.haml b/app/views/dashboard/_projects_filter.html.haml
index b65e882e6935654ec16b580cd71c9b27e3322d3b..0e990ccfab44017549a6e9c2fd4b77e48e9cecc5 100644
--- a/app/views/dashboard/_projects_filter.html.haml
+++ b/app/views/dashboard/_projects_filter.html.haml
@@ -1,55 +1,100 @@
-%fieldset
- %ul.nav.nav-pills.nav-stacked
- = nav_tab :scope, nil do
- = link_to projects_dashboard_filter_path(scope: nil) do
- All
- %span.pull-right
- = current_user.authorized_projects.count
- = nav_tab :scope, 'personal' do
- = link_to projects_dashboard_filter_path(scope: 'personal') do
- Personal
- %span.pull-right
- = current_user.personal_projects.count
- = nav_tab :scope, 'joined' do
- = link_to projects_dashboard_filter_path(scope: 'joined') do
- Joined
- %span.pull-right
- = current_user.authorized_projects.joined(current_user).count
- = nav_tab :scope, 'owned' do
- = link_to projects_dashboard_filter_path(scope: 'owned') do
- Owned
- %span.pull-right
- = current_user.owned_projects.count
+.dash-projects-filters.append-bottom-20
+ .pull-left.append-right-20
+ %ul.nav.nav-pills.nav-compact
+ = nav_tab :scope, nil do
+ = link_to projects_dashboard_filter_path(scope: nil) do
+ All
+ = nav_tab :scope, 'personal' do
+ = link_to projects_dashboard_filter_path(scope: 'personal') do
+ Personal
+ = nav_tab :scope, 'joined' do
+ = link_to projects_dashboard_filter_path(scope: 'joined') do
+ Joined
+ = nav_tab :scope, 'owned' do
+ = link_to projects_dashboard_filter_path(scope: 'owned') do
+ Owned
-%fieldset
- %legend Visibility
- %ul.nav.nav-pills.nav-stacked.nav-small.visibility-filter
- - Gitlab::VisibilityLevel.values.each do |level|
- %li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
- = link_to projects_dashboard_filter_path(visibility_level: level) do
- = visibility_level_icon(level)
- = visibility_level_label(level)
+ .dropdown.inline.append-right-10
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-globe
+ %span.light Visibility:
+ - if params[:visibility_level].present?
+ = visibility_level_label(params[:visibility_level].to_i)
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to projects_dashboard_filter_path(visibility_level: nil) do
+ Any
+ - Gitlab::VisibilityLevel.values.each do |level|
+ %li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
+ = link_to projects_dashboard_filter_path(visibility_level: level) do
+ = visibility_level_icon(level)
+ = visibility_level_label(level)
-- if @groups.present?
- %fieldset
- %legend Groups
- %ul.nav.nav-pills.nav-stacked.nav-small
- - @groups.each do |group|
- %li{ class: (group.name == params[:group]) ? 'active' : 'light' }
- = link_to projects_dashboard_filter_path(group: group.name) do
- %i.fa.fa-folder-o
- = group.name
- %small.pull-right
- = group.projects.count
+ - if @groups.present?
+ .dropdown.inline.append-right-10
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-group
+ %span.light Group:
+ - if params[:group].present?
+ = Group.find_by(name: params[:group]).name
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to projects_dashboard_filter_path(group: nil) do
+ Any
+ - @groups.each do |group|
+ %li{ class: (group.name == params[:group]) ? 'active' : 'light' }
+ = link_to projects_dashboard_filter_path(group: group.name) do
+ = group.name
+ %small.pull-right
+ = group.projects.count
-- if @tags.present?
- %fieldset
- %legend Tags
- %ul.nav.nav-pills.nav-stacked.nav-small
- - @tags.each do |tag|
- %li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
- = link_to projects_dashboard_filter_path(scope: params[:scope], tag: tag.name) do
- %i.fa.fa-tag
- = tag.name
+ - if @tags.present?
+ .dropdown.inline.append-right-10
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-tags
+ %span.light Tags:
+ - if params[:tag].present?
+ = params[:tag]
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to projects_dashboard_filter_path(tag: nil) do
+ Any
+
+ - @tags.each do |tag|
+ %li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
+ = link_to projects_dashboard_filter_path(tag: tag.name) do
+ %i.fa.fa-tag
+ = tag.name
+
+ .pull-right
+ .dropdown.inline
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %span.light sort:
+ - if @sort.present?
+ = @sort.humanize
+ - else
+ Name
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to projects_dashboard_filter_path(sort: nil) do
+ Name
+ = link_to projects_dashboard_filter_path(sort: 'newest') do
+ = sort_title_recently_created
+ = link_to projects_dashboard_filter_path(sort: 'oldest') do
+ = sort_title_oldest_created
+ = link_to projects_dashboard_filter_path(sort: 'recently_updated') do
+ = sort_title_recently_updated
+ = link_to projects_dashboard_filter_path(sort: 'last_updated') do
+ = sort_title_oldest_updated
diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml
index add9eb7fa29b2c5135fedad70d73b14f7a67a73a..a980f495427be4c70a01acb186211938874314b6 100644
--- a/app/views/dashboard/_sidebar.html.haml
+++ b/app/views/dashboard/_sidebar.html.haml
@@ -15,11 +15,4 @@
= render "groups", groups: @groups
.prepend-top-20
- %span.rss-icon
- = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
- %strong
- %i.fa.fa-rss
- News Feed
-
-%hr
-= render 'shared/promo'
+ = render 'shared/promo'
diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml
index 5d133cd8285b87561e0277591e38514fd7597082..f78ce69ef9ee2434677238cef41036cf214f0fcf 100644
--- a/app/views/dashboard/_zero_authorized_projects.html.haml
+++ b/app/views/dashboard/_zero_authorized_projects.html.haml
@@ -4,7 +4,7 @@
%div
.dashboard-intro-icon
%i.fa.fa-bookmark-o
- %div
+ .dashboard-intro-text
%p.slead
You don't have access to any projects right now.
%br
@@ -24,7 +24,7 @@
%div
.dashboard-intro-icon
%i.fa.fa-users
- %div
+ .dashboard-intro-text
%p.slead
You can create a group for several dependent projects.
%br
@@ -38,7 +38,7 @@
%div
.dashboard-intro-icon
%i.fa.fa-globe
- %div
+ .dashboard-intro-text
%p.slead
There are
%strong= @publicish_project_count
diff --git a/app/views/dashboard/issues.atom.builder b/app/views/dashboard/issues.atom.builder
index 66381310221e021ff84e19003be1de89efbe0f63..72e9e361dc3d4f984b8cae48ff87e34baddf4650 100644
--- a/app/views/dashboard/issues.atom.builder
+++ b/app/views/dashboard/issues.atom.builder
@@ -1,5 +1,5 @@
xml.instruct!
-xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlnsmedia" => "http://search.yahoo.com/mrss/" do
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "#{current_user.name} issues"
xml.link href: issues_dashboard_url(:atom, private_token: current_user.private_token), rel: "self", type: "application/atom+xml"
xml.link href: issues_dashboard_url(private_token: current_user.private_token), rel: "alternate", type: "text/html"
diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml
index 7c1f1ddbb80241e1104316a1cd482ddfe079ecde..db19a46cb263dd075e79dbcd6dc1e62e4396d5a7 100644
--- a/app/views/dashboard/issues.html.haml
+++ b/app/views/dashboard/issues.html.haml
@@ -5,10 +5,6 @@
List all issues from all projects you have access to.
%hr
-.row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'shared/filter', entity: 'issue'
- .col-md-9
- = render 'shared/issues'
+.append-bottom-20
+ = render 'shared/issuable_filter'
+= render 'shared/issues'
diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml
index c96584c7b6bae8b384ae6958960251e680710eec..97a42461b4e0f54d32a91c139bf1ac3818f1f46b 100644
--- a/app/views/dashboard/merge_requests.html.haml
+++ b/app/views/dashboard/merge_requests.html.haml
@@ -5,10 +5,6 @@
%p.light
List all merge requests from all projects you have access to.
%hr
-.row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'shared/filter', entity: 'merge_request'
- .col-md-9
- = render 'shared/merge_requests'
+.append-bottom-20
+ = render 'shared/issuable_filter'
+= render 'shared/merge_requests'
diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml
index d3c51806fabdf62c738d0728b9eb1ff40ecb7b68..944441669e769cc7ed9a823be90ad554d2c60e10 100644
--- a/app/views/dashboard/projects.html.haml
+++ b/app/views/dashboard/projects.html.haml
@@ -1,74 +1,54 @@
%h3.page-title
My Projects
-.pull-right
- .dropdown.inline
- %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
- %span.light sort:
- - if @sort.present?
- = @sort.humanize
- - else
- Name
- %b.caret
- %ul.dropdown-menu
- %li
- = link_to projects_dashboard_filter_path(sort: nil) do
- Name
- = link_to projects_dashboard_filter_path(sort: 'newest') do
- = sort_title_recently_created
- = link_to projects_dashboard_filter_path(sort: 'oldest') do
- = sort_title_oldest_created
- = link_to projects_dashboard_filter_path(sort: 'recently_updated') do
- = sort_title_recently_updated
- = link_to projects_dashboard_filter_path(sort: 'last_updated') do
- = sort_title_oldest_updated
%p.light
All projects you have access to are listed here. Public projects are not included here unless you are a member
%hr
-.row
- .col-md-3.hidden-sm.hidden-xs.side-filters
- = render "projects_filter"
- .col-md-9
- %ul.bordered-list.my-projects.top-list
- - @projects.each do |project|
- %li.my-project-row
- %h4.project-title
- .project-access-icon
- = visibility_level_icon(project.visibility_level)
- = link_to project_path(project), class: dom_class(project) do
- = project.name_with_namespace
+.side-filters
+ = render "projects_filter"
+.dash-projects
+ %ul.bordered-list.my-projects.top-list
+ - @projects.each do |project|
+ %li.my-project-row
+ %h4.project-title
+ .project-access-icon
+ = visibility_level_icon(project.visibility_level)
+ = link_to project_path(project), class: dom_class(project) do
+ = project.name_with_namespace
- - if current_user.can_leave_project?(project)
- .pull-right
- = link_to leave_project_team_members_path(project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
- %i.fa.fa-sign-out
- Leave
+ - if project.forked_from_project
+
+ %small
+ %i.fa.fa-code-fork
+ Forked from:
+ = link_to project.forked_from_project.name_with_namespace, project_path(project.forked_from_project)
- - if project.forked_from_project
- %small.pull-right
- %i.fa.fa-code-fork
- Forked from:
- = link_to project.forked_from_project.name_with_namespace, project_path(project.forked_from_project)
- .project-info
+ - if current_user.can_leave_project?(project)
.pull-right
- - if project.archived?
- %span.label
- %i.fa.fa-archive
- Archived
- - project.tags.each do |tag|
- %span.label.label-info
- %i.fa.fa-tag
- = tag.name
- - if project.description.present?
- %p{ dir: 'auto' }= truncate project.description, length: 100
- .last-activity
- %span.light Last activity:
- %span.date= project_last_activity(project)
+ = link_to leave_project_team_members_path(project), data: { confirm: "Leave project?"}, method: :delete, remote: true, class: "btn-tiny btn remove-row", title: 'Leave project' do
+ %i.fa.fa-sign-out
+ Leave
+ .project-info
+ .pull-right
+ - if project.archived?
+ %span.label
+ %i.fa.fa-archive
+ Archived
+ - project.tags.each do |tag|
+ %span.label.label-info
+ %i.fa.fa-tag
+ = tag.name
+ - if project.description.present?
+ %p= truncate project.description, length: 100
+ .last-activity
+ %span.light Last activity:
+ %span.date= project_last_activity(project)
- - if @projects.blank?
- %li
- .nothing-here-block There are no projects here.
- .bottom
- = paginate @projects, theme: "gitlab"
+
+ - if @projects.blank?
+ %li
+ .nothing-here-block There are no projects here.
+ .bottom
+ = paginate @projects, theme: "gitlab"
diff --git a/app/views/dashboard/show.atom.builder b/app/views/dashboard/show.atom.builder
index 70ac66f80165fba16c6c69c8ea0dbcc99e75f934..da631ecb33e00f01a6f08002da08d78b8f47464c 100644
--- a/app/views/dashboard/show.atom.builder
+++ b/app/views/dashboard/show.atom.builder
@@ -1,5 +1,5 @@
xml.instruct!
-xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlnsmedia" => "http://search.yahoo.com/mrss/" do
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}"
xml.link href: dashboard_url(:atom), rel: "self", type: "application/atom+xml"
xml.link href: dashboard_url, rel: "alternate", type: "text/html"
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
old mode 100755
new mode 100644
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index f6cbf9b82ba4edfb24486384e1173fb1d76feb12..1326cc0aac9ef167c4d9eb4369569ed368644dc8 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -6,8 +6,8 @@
.devise-errors
= devise_error_messages!
= f.hidden_field :reset_password_token
- .form-group#password-strength
- = f.password_field :password, class: "form-control top", id: "user_password_recover", placeholder: "New password", required: true
+ %div
+ = f.password_field :password, class: "form-control top", placeholder: "New password", required: true
%div
= f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true
.clearfix.append-bottom-10
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
old mode 100755
new mode 100644
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index 6d046c6dd2ad64416e61399cac58249d702f95c0..65cd96d831e2728d1c67932d4541e017792821b3 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -11,8 +11,8 @@
= f.text_field :username, class: "form-control middle", placeholder: "Username", required: true, dir: :auto
%div
= f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
- .form-group#password-strength
- = f.password_field :password, class: "form-control middle", id: "user_password_sign_up", placeholder: "Password", required: true
+ %div
+ = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true
%div
= f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true
%div
diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml
index fb2d6eaca0178be7a3f447944f013437af3dbd48..c6bb3323969209653da108d72feda6673b2e3b0b 100644
--- a/app/views/devise/sessions/_new_base.html.haml
+++ b/app/views/devise/sessions/_new_base.html.haml
@@ -2,7 +2,7 @@
= f.text_field :login, class: "form-control top", placeholder: "Username or Email", autofocus: "autofocus", dir: 'auto'
= f.password_field :password, class: "form-control bottom", placeholder: "Password"
- if devise_mapping.rememberable?
- .clearfix.append-bottom-10
+ .remember-me
%label.checkbox.remember_me{for: "user_remember_me"}
= f.check_box :remember_me
%span Remember me
diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml
index bf8a593c254e65753763ca6e034b2e7e3169da87..e986989a728802eebc1c73c1340d8621b06eb31d 100644
--- a/app/views/devise/sessions/_new_ldap.html.haml
+++ b/app/views/devise/sessions/_new_ldap.html.haml
@@ -1,5 +1,4 @@
= form_tag(user_omniauth_callback_path(provider), id: 'new_ldap_user' ) do
= text_field_tag :username, nil, {class: "form-control top", placeholder: "LDAP Login", autofocus: "autofocus"}
= password_field_tag :password, nil, {class: "form-control bottom", placeholder: "Password"}
- %br/
= button_tag "LDAP Sign in", class: "btn-save btn"
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index ca7e9570b432729f7f49445752a593f7de29b776..6d8415613d1379f8fd0a750a2f95d0b4f02e4d9f 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,43 +1,15 @@
-.login-box
- .login-heading
- %h3 Sign in
- .login-body
- - if ldap_enabled?
- %ul.nav.nav-tabs
- - @ldap_servers.each_with_index do |server, i|
- %li{class: (:active if i.zero?)}
- = link_to server['label'], "#tab-#{server['provider_name']}", 'data-toggle' => 'tab'
- - if gitlab_config.signin_enabled
- %li
- = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab'
- .tab-content
- - @ldap_servers.each_with_index do |server, i|
- %div.tab-pane{id: "tab-#{server['provider_name']}", class: (:active if i.zero?)}
- = render 'devise/sessions/new_ldap', provider: server['provider_name']
- - if gitlab_config.signin_enabled
- %div#tab-signin.tab-pane
- = render 'devise/sessions/new_base'
+%div
+ = render 'devise/shared/signin_box'
- - elsif gitlab_config.signin_enabled
- = render 'devise/sessions/new_base'
- - else
- %div
- No authentication methods configured.
+ - if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
+ .prepend-top-20
+ = render 'devise/shared/oauth_box'
- = render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
+ - if signup_enabled?
+ .prepend-top-20
+ = render 'devise/shared/signup_box'
- .login-footer
- - if gitlab_config.signup_enabled
- %p
- %span.light
- Don't have an account?
- %strong
- = link_to "Sign up", new_registration_path(resource_name)
-
- %p
- %span.light Did not receive confirmation email?
- = link_to "Send again", new_confirmation_path(resource_name)
-
- - if extra_config.has_key?('sign_in_text')
- %hr
- = markdown(extra_config.sign_in_text)
+.clearfix.prepend-top-20
+ %p
+ %span.light Did not receive confirmation email?
+ = link_to "Send again", new_confirmation_path(resource_name)
diff --git a/app/views/devise/sessions/_oauth_providers.html.haml b/app/views/devise/shared/_oauth_box.html.haml
similarity index 77%
rename from app/views/devise/sessions/_oauth_providers.html.haml
rename to app/views/devise/shared/_oauth_box.html.haml
index 8d6aaefb9fffe393ffc98b54079391059250826f..c2e1373de30222978fb2f9888f59d222aef6ab59 100644
--- a/app/views/devise/sessions/_oauth_providers.html.haml
+++ b/app/views/devise/shared/_oauth_box.html.haml
@@ -1,7 +1,7 @@
- providers = additional_providers
- if providers.present?
- .bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'}
- %span Sign in with:
+ .login-box{:'data-no-turbolink' => 'data-no-turbolink'}
+ %span Sign in with
- providers.each do |provider|
%span
- if default_providers.include?(provider)
diff --git a/app/views/devise/shared/_signin_box.html.haml b/app/views/devise/shared/_signin_box.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..705873290338e44beec32289ab80aadf295b3261
--- /dev/null
+++ b/app/views/devise/shared/_signin_box.html.haml
@@ -0,0 +1,25 @@
+.login-box
+ .login-heading
+ %h3 Sign in
+ .login-body
+ - if ldap_enabled?
+ %ul.nav.nav-tabs
+ - @ldap_servers.each_with_index do |server, i|
+ %li{class: (:active if i.zero?)}
+ = link_to server['label'], "#tab-#{server['provider_name']}", 'data-toggle' => 'tab'
+ - if signin_enabled?
+ %li
+ = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab'
+ .tab-content
+ - @ldap_servers.each_with_index do |server, i|
+ %div.tab-pane{id: "tab-#{server['provider_name']}", class: (:active if i.zero?)}
+ = render 'devise/sessions/new_ldap', provider: server['provider_name']
+ - if signin_enabled?
+ %div#tab-signin.tab-pane
+ = render 'devise/sessions/new_base'
+
+ - elsif signin_enabled?
+ = render 'devise/sessions/new_base'
+ - else
+ %div
+ No authentication methods configured.
diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..5709c66128848760792af9834ca37735985e47bb
--- /dev/null
+++ b/app/views/devise/shared/_signup_box.html.haml
@@ -0,0 +1,17 @@
+.login-box
+ .login-heading
+ %h3 Sign up
+ .login-body
+ = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
+ .devise-errors
+ = devise_error_messages!
+ %div
+ = f.text_field :name, class: "form-control top", placeholder: "Name", required: true
+ %div
+ = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true
+ %div
+ = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true
+ .form-group#password-strength
+ = f.password_field :password, class: "form-control bottom", id: "user_password_sign_up", placeholder: "Password", required: true
+ %div
+ = f.submit "Sign up", class: "btn-create btn"
diff --git a/app/views/doorkeeper/applications/_delete_form.html.haml b/app/views/doorkeeper/applications/_delete_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..bf8098f38d06cd8f4d759a5be5336e75573ea800
--- /dev/null
+++ b/app/views/doorkeeper/applications/_delete_form.html.haml
@@ -0,0 +1,4 @@
+- submit_btn_css ||= 'btn btn-link btn-remove btn-small'
+= form_tag oauth_application_path(application) do
+ %input{:name => "_method", :type => "hidden", :value => "delete"}/
+ = submit_tag 'Destroy', onclick: "return confirm('Are you sure?')", class: submit_btn_css
\ No newline at end of file
diff --git a/app/views/doorkeeper/applications/_form.html.haml b/app/views/doorkeeper/applications/_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..a5fec2fabdb400b00c1c3cf02f025e152c37027f
--- /dev/null
+++ b/app/views/doorkeeper/applications/_form.html.haml
@@ -0,0 +1,24 @@
+= form_for application, url: doorkeeper_submit_path(application), html: {class: 'form-horizontal', role: 'form'} do |f|
+ - if application.errors.any?
+ .alert.alert-danger{"data-alert" => ""}
+ %p Whoops! Check your form for possible errors
+ = content_tag :div, class: "form-group#{' has-error' if application.errors[:name].present?}" do
+ = f.label :name, class: 'col-sm-2 control-label'
+ .col-sm-10
+ = f.text_field :name, class: 'form-control'
+ = doorkeeper_errors_for application, :name
+ = content_tag :div, class: "form-group#{' has-error' if application.errors[:redirect_uri].present?}" do
+ = f.label :redirect_uri, class: 'col-sm-2 control-label'
+ .col-sm-10
+ = f.text_area :redirect_uri, class: 'form-control'
+ = doorkeeper_errors_for application, :redirect_uri
+ %span.help-block
+ Use one line per URI
+ - if Doorkeeper.configuration.native_redirect_uri
+ %span.help-block
+ Use
+ %code= Doorkeeper.configuration.native_redirect_uri
+ for local tests
+ .form-actions
+ = f.submit 'Submit', class: "btn btn-primary wide"
+ = link_to "Cancel", applications_profile_path, class: "btn btn-default"
diff --git a/app/views/doorkeeper/applications/edit.html.haml b/app/views/doorkeeper/applications/edit.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..61584eb9c498af026e0e0f97767639830a5c3555
--- /dev/null
+++ b/app/views/doorkeeper/applications/edit.html.haml
@@ -0,0 +1,2 @@
+%h3.page-title Edit application
+= render 'form', application: @application
\ No newline at end of file
diff --git a/app/views/doorkeeper/applications/index.html.haml b/app/views/doorkeeper/applications/index.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..e5be4b4bcac03d41252ecc84df4bc7ee5ce6f577
--- /dev/null
+++ b/app/views/doorkeeper/applications/index.html.haml
@@ -0,0 +1,16 @@
+%h3.page-title Your applications
+%p= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success'
+%table.table.table-striped
+ %thead
+ %tr
+ %th Name
+ %th Callback URL
+ %th
+ %th
+ %tbody
+ - @applications.each do |application|
+ %tr{:id => "application_#{application.id}"}
+ %td= link_to application.name, oauth_application_path(application)
+ %td= application.redirect_uri
+ %td= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link'
+ %td= render 'delete_form', application: application
\ No newline at end of file
diff --git a/app/views/doorkeeper/applications/new.html.haml b/app/views/doorkeeper/applications/new.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..655845e4af55121df2abf04be73e524669f0bfda
--- /dev/null
+++ b/app/views/doorkeeper/applications/new.html.haml
@@ -0,0 +1,2 @@
+%h3.page-title New application
+= render 'form', application: @application
\ No newline at end of file
diff --git a/app/views/doorkeeper/applications/show.html.haml b/app/views/doorkeeper/applications/show.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..82e78b4af132472bfe0ba411d4e67b25b5781baf
--- /dev/null
+++ b/app/views/doorkeeper/applications/show.html.haml
@@ -0,0 +1,26 @@
+%h3.page-title
+ Application: #{@application.name}
+
+
+%table.table
+ %tr
+ %td
+ Application Id
+ %td
+ %code#application_id= @application.uid
+ %tr
+ %td
+ Secret:
+ %td
+ %code#secret= @application.secret
+
+ %tr
+ %td
+ Callback url
+ %td
+ - @application.redirect_uri.split.each do |uri|
+ %div
+ %span.monospace= uri
+.form-actions
+ = link_to 'Edit', edit_oauth_application_path(@application), class: 'btn btn-primary wide pull-left'
+ = render 'delete_form', application: @application, submit_btn_css: 'btn btn-danger prepend-left-10'
diff --git a/app/views/doorkeeper/authorizations/error.html.haml b/app/views/doorkeeper/authorizations/error.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..7561ec85ed9563c07b4f2115872892cea55c8c4c
--- /dev/null
+++ b/app/views/doorkeeper/authorizations/error.html.haml
@@ -0,0 +1,3 @@
+%h3.page-title An error has occurred
+%main{:role => "main"}
+ %pre= @pre_auth.error_response.body[:error_description]
\ No newline at end of file
diff --git a/app/views/doorkeeper/authorizations/new.html.haml b/app/views/doorkeeper/authorizations/new.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..15f9ee266c15a257b806e3997708a42333001df4
--- /dev/null
+++ b/app/views/doorkeeper/authorizations/new.html.haml
@@ -0,0 +1,28 @@
+%h3.page-title Authorize required
+%main{:role => "main"}
+ %p.h4
+ Authorize
+ %strong.text-info= @pre_auth.client.name
+ to use your account?
+ - if @pre_auth.scopes
+ #oauth-permissions
+ %p This application will be able to:
+ %ul.text-info
+ - @pre_auth.scopes.each do |scope|
+ %li= t scope, scope: [:doorkeeper, :scopes]
+ %hr/
+ .actions
+ = form_tag oauth_authorization_path, method: :post do
+ = hidden_field_tag :client_id, @pre_auth.client.uid
+ = hidden_field_tag :redirect_uri, @pre_auth.redirect_uri
+ = hidden_field_tag :state, @pre_auth.state
+ = hidden_field_tag :response_type, @pre_auth.response_type
+ = hidden_field_tag :scope, @pre_auth.scope
+ = submit_tag "Authorize", class: "btn btn-success wide pull-left"
+ = form_tag oauth_authorization_path, method: :delete do
+ = hidden_field_tag :client_id, @pre_auth.client.uid
+ = hidden_field_tag :redirect_uri, @pre_auth.redirect_uri
+ = hidden_field_tag :state, @pre_auth.state
+ = hidden_field_tag :response_type, @pre_auth.response_type
+ = hidden_field_tag :scope, @pre_auth.scope
+ = submit_tag "Deny", class: "btn btn-danger prepend-left-10"
\ No newline at end of file
diff --git a/app/views/doorkeeper/authorizations/show.html.haml b/app/views/doorkeeper/authorizations/show.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..9a402007194b0a898a1088b547cb21f77248ac62
--- /dev/null
+++ b/app/views/doorkeeper/authorizations/show.html.haml
@@ -0,0 +1,3 @@
+%h3.page-title Authorization code:
+%main{:role => "main"}
+ %code#authorization_code= params[:code]
\ No newline at end of file
diff --git a/app/views/doorkeeper/authorized_applications/_delete_form.html.haml b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..5cbb4a70c1923090a4a2edd221c61ed7c19ca38d
--- /dev/null
+++ b/app/views/doorkeeper/authorized_applications/_delete_form.html.haml
@@ -0,0 +1,4 @@
+- submit_btn_css ||= 'btn btn-link btn-remove'
+= form_tag oauth_authorized_application_path(application) do
+ %input{:name => "_method", :type => "hidden", :value => "delete"}/
+ = submit_tag 'Revoke', onclick: "return confirm('Are you sure?')", class: 'btn btn-link btn-remove btn-small'
\ No newline at end of file
diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..814cdc987ef7c466f4dbccab541d16be2845947b
--- /dev/null
+++ b/app/views/doorkeeper/authorized_applications/index.html.haml
@@ -0,0 +1,16 @@
+%header.page-header
+ %h1 Your authorized applications
+%main{:role => "main"}
+ %table.table.table-striped
+ %thead
+ %tr
+ %th Application
+ %th Created At
+ %th
+ %th
+ %tbody
+ - @applications.each do |application|
+ %tr
+ %td= application.name
+ %td= application.created_at.strftime('%Y-%m-%d %H:%M:%S')
+ %td= render 'delete_form', application: application
\ No newline at end of file
diff --git a/app/views/github_imports/create.js.haml b/app/views/github_imports/create.js.haml
new file mode 100644
index 0000000000000000000000000000000000000000..363dfeb4f54e1026727629cfde233540bb267b4f
--- /dev/null
+++ b/app/views/github_imports/create.js.haml
@@ -0,0 +1,16 @@
+- if @already_been_taken
+ :plain
+ target_field = $("tr#repo_#{@repo_id} .import-target")
+ origin_target = target_field.text()
+ project_name = "#{@project_name}"
+ origin_namespace = "#{@target_namespace}"
+ target_field.empty()
+ target_field.append("
This namespace already been taken! Please choose another one
")
+ target_field.append("")
+ target_field.append("/" + project_name)
+ target_field.data("project_name", project_name)
+ target_field.find('input').prop("value", origin_namespace)
+- else
+ :plain
+ $("table.import-jobs tbody").prepend($("tr#repo_#{@repo_id}"))
+ $("tr#repo_#{@repo_id}").addClass("active").find(".import-actions").html(" started")
diff --git a/app/views/github_imports/status.html.haml b/app/views/github_imports/status.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..47c60e4d45f3e7b385d3d9fc259aaacef6990c7f
--- /dev/null
+++ b/app/views/github_imports/status.html.haml
@@ -0,0 +1,48 @@
+%h3.page-title
+ %i.fa.fa-github
+ Import repositories from GitHub.com
+
+%p.light
+ Select projects you want to import.
+ %span.pull-right
+ Reload to see the progress.
+
+%hr
+%table.table.import-jobs
+ %thead
+ %tr
+ %th From GitHub
+ %th To GitLab
+ %th Status
+ %tbody
+ - @already_added_projects.each do |project|
+ %tr{id: "repo_#{project.id}", class: "#{project_status_css_class(project.import_status)}"}
+ %td= project.import_source
+ %td
+ %strong= link_to project.name_with_namespace, project
+ %td
+ - if project.import_status == 'finished'
+ %span.cgreen
+ %i.fa.fa-check
+ done
+ - else
+ = project.human_import_status_name
+
+ - @repos.each do |repo|
+ %tr{id: "repo_#{repo.id}"}
+ %td= repo.full_name
+ %td.import-target
+ = repo.full_name
+ %td.import-actions
+ = button_tag "Add", class: "btn btn-add-to-import"
+
+
+:coffeescript
+ $(".btn-add-to-import").click () ->
+ new_namespace = null
+ tr = $(this).closest("tr")
+ id = tr.attr("id").replace("repo_", "")
+ if tr.find(".import-target input").length > 0
+ new_namespace = tr.find(".import-target input").prop("value")
+ tr.find(".import-target").empty().append(new_namespace + "/" + tr.find(".import-target").data("project_name"))
+ $.post "#{github_import_url}", {repo_id: id, new_namespace: new_namespace}, dataType: 'script'
diff --git a/app/views/groups/_filter.html.haml b/app/views/groups/_filter.html.haml
deleted file mode 100644
index 393be3f1d12e192916d8b8d81c114d92b447a6e9..0000000000000000000000000000000000000000
--- a/app/views/groups/_filter.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-= form_tag group_filter_path(entity), method: 'get' do
- %fieldset
- %ul.nav.nav-pills.nav-stacked
- %li{class: ("active" if (params[:status] == 'active' || !params[:status]))}
- = link_to group_filter_path(entity, status: 'active') do
- Active
- %li{class: ("active" if params[:status] == 'closed')}
- = link_to group_filter_path(entity, status: 'closed') do
- Closed
- %li{class: ("active" if params[:status] == 'all')}
- = link_to group_filter_path(entity, status: 'all') do
- All
diff --git a/app/views/groups/_settings_nav.html.haml b/app/views/groups/_settings_nav.html.haml
index ec1fb4a2c00effb343fa4f88a362c1bd9ee715a1..35180792a0daff4a8e8c1ee9353f3607d81ecd61 100644
--- a/app/views/groups/_settings_nav.html.haml
+++ b/app/views/groups/_settings_nav.html.haml
@@ -1,10 +1,11 @@
-%ul.nav.nav-pills.nav-stacked.nav-stacked-menu
+%ul.sidebar-subnav
= nav_link(path: 'groups#edit') do
= link_to edit_group_path(@group) do
%i.fa.fa-pencil-square-o
- Group
+ %span
+ Group
= nav_link(path: 'groups#projects') do
= link_to projects_group_path(@group) do
%i.fa.fa-folder
- Projects
-
+ %span
+ Projects
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
index eb24fd65d9ee060bba1bfc60d708a910c27c7a65..a963c59586efdbc85b5aa5fe0b0289ccfadbcef3 100644
--- a/app/views/groups/edit.html.haml
+++ b/app/views/groups/edit.html.haml
@@ -1,41 +1,37 @@
-.row
- .col-md-2
- = render 'settings_nav'
- .col-md-10
- .panel.panel-default
- .panel-heading
- %strong= @group.name
- group settings:
- .panel-body
- = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f|
- - if @group.errors.any?
- .alert.alert-danger
- %span= @group.errors.full_messages.first
- = render 'shared/group_form', f: f
+.panel.panel-default
+ .panel-heading
+ %strong= @group.name
+ group settings:
+ .panel-body
+ = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f|
+ - if @group.errors.any?
+ .alert.alert-danger
+ %span= @group.errors.full_messages.first
+ = render 'shared/group_form', f: f
- .form-group
- .col-sm-2
- .col-sm-10
- = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160'
- %p.light
- - if @group.avatar?
- You can change your group avatar here
- - else
- You can upload a group avatar here
- = render 'shared/choose_group_avatar_button', f: f
- - if @group.avatar?
- %hr
- = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar"
+ .form-group
+ .col-sm-2
+ .col-sm-10
+ = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160'
+ %p.light
+ - if @group.avatar?
+ You can change your group avatar here
+ - else
+ You can upload a group avatar here
+ = render 'shared/choose_group_avatar_button', f: f
+ - if @group.avatar?
+ %hr
+ = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar"
- .form-actions
- = f.submit 'Save group', class: "btn btn-save"
+ .form-actions
+ = f.submit 'Save group', class: "btn btn-save"
- .panel.panel-danger
- .panel-heading Remove group
- .panel-body
- %p
- Removing group will cause all child projects and resources to be removed.
- %br
- %strong Removed group can not be restored!
+.panel.panel-danger
+ .panel-heading Remove group
+ .panel-body
+ %p
+ Removing group will cause all child projects and resources to be removed.
+ %br
+ %strong Removed group can not be restored!
- = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove"
+ = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove"
diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml
index 1932ba2f6440e3d5dcf743b8f9f93421b6ac2eb3..6c0d89c4e7cbf7e67aecb1fd8333a7526c50de86 100644
--- a/app/views/groups/issues.html.haml
+++ b/app/views/groups/issues.html.haml
@@ -9,10 +9,6 @@
To see all issues you should visit #{link_to 'dashboard', issues_dashboard_path} page.
%hr
-.row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'shared/filter', entity: 'issue'
- .col-md-9
- = render 'shared/issues'
+.append-bottom-20
+ = render 'shared/issuable_filter'
+= render 'shared/issues'
diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml
index 86d5acdaa320c9c707652afb5d5dfdc273b7ce3a..1ad74905636f7f3b0637696bcaa6262b36ab4766 100644
--- a/app/views/groups/merge_requests.html.haml
+++ b/app/views/groups/merge_requests.html.haml
@@ -8,10 +8,6 @@
- if current_user
To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page.
%hr
-.row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'shared/filter', entity: 'merge_request'
- .col-md-9
- = render 'shared/merge_requests'
+.append-bottom-20
+ = render 'shared/issuable_filter'
+= render 'shared/merge_requests'
diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml
index 1cea85ccea29ecb5c0264c3c6a24e39b1916a889..4ce5dfe4d2abd68a6974f4131b24d35a2213bac8 100644
--- a/app/views/groups/milestones/index.html.haml
+++ b/app/views/groups/milestones/index.html.haml
@@ -9,42 +9,38 @@
%hr
-.row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'groups/filter', entity: 'milestone'
- .col-md-9
- .panel.panel-default
- %ul.well-list
- - if @group_milestones.blank?
- %li
- .nothing-here-block No milestones to show
- - else
- - @group_milestones.each do |milestone|
- %li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) }
- .pull-right
- - if can?(current_user, :manage_group, @group)
- - if milestone.closed?
- = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
- - else
- = link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
- %h4
- %span{ dir: :auto }= link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
+= render 'shared/milestones_filter'
+.milestones
+ .panel.panel-default
+ %ul.well-list
+ - if @group_milestones.blank?
+ %li
+ .nothing-here-block No milestones to show
+ - else
+ - @group_milestones.each do |milestone|
+ %li{class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: dom_id(milestone.milestones.first) }
+ .pull-right
+ - if can?(current_user, :manage_group, @group)
+ - if milestone.closed?
+ = link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
+ - else
+ = link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-close"
+ %h4
+ %span{ dir: :auto }= link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
+ %div
%div
- %div
- = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
- = pluralize milestone.issue_count, 'Issue'
-
- = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
- = pluralize milestone.merge_requests_count, 'Merge Request'
-
- %span.light #{milestone.percent_complete}% complete
- .progress.progress-info
- .progress-bar{style: "width: #{milestone.percent_complete}%;"}
- %div
- %br
- - milestone.projects.each do |project|
- %span.label.label-default
- = project.name
- = paginate @group_milestones, theme: "gitlab"
+ = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
+ = pluralize milestone.issue_count, 'Issue'
+
+ = link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
+ = pluralize milestone.merge_requests_count, 'Merge Request'
+
+ %span.light #{milestone.percent_complete}% complete
+ .progress.progress-info
+ .progress-bar{style: "width: #{milestone.percent_complete}%;"}
+ %div
+ %br
+ - milestone.projects.each do |project|
+ %span.label.label-default
+ = project.name
+ = paginate @group_milestones, theme: "gitlab"
diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml
index 411d1822be0d79ec0f3dd66a1ec66779cb54fd33..7bcac56c37be1fd28705f032e86af7bfa331375f 100644
--- a/app/views/groups/milestones/show.html.haml
+++ b/app/views/groups/milestones/show.html.haml
@@ -1,4 +1,9 @@
-%h3.page-title
+%h4.page-title
+ .issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" }
+ - if @group_milestone.closed?
+ Closed
+ - else
+ Open
Milestone #{@group_milestone.title}
.pull-right
- if can?(current_user, :manage_group, @group)
@@ -7,46 +12,41 @@
- else
= link_to 'Reopen Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped btn-reopen"
+%hr
- if (@group_milestone.total_items_count == @group_milestone.closed_items_count) && @group_milestone.active?
.alert.alert-success
%span All issues for this milestone are closed. You may close the milestone now.
-.back-link
- = link_to group_milestones_path(@group) do
- ← To milestones list
-
-.issue-box{ class: "issue-box-#{@group_milestone.closed? ? 'closed' : 'open'}" }
- .state.clearfix
- .state-label
- - if @group_milestone.closed?
- Closed
- - else
- Open
-
- %h4.title
- = gfm escape_once(@group_milestone.title)
-
- .description
- - @group_milestone.milestones.each do |milestone|
- %hr
- %h4
- = link_to "#{milestone.project.name} - #{milestone.title}", project_milestone_path(milestone.project, milestone)
- %span.pull-right= milestone.expires_at
+.description
+%table.table
+ %thead
+ %tr
+ %th Project
+ %th Open issues
+ %th State
+ %th Due date
+ - @group_milestone.milestones.each do |milestone|
+ %tr
+ %td
+ = link_to "#{milestone.project.name}", project_milestone_path(milestone.project, milestone)
+ %td
+ = milestone.issues.opened.count
+ %td
- if milestone.closed?
- %span.label.label-danger #{milestone.state}
- = preserve do
- - if milestone.description.present?
- = milestone.description
-
- .context
- %p
- Progress:
- #{@group_milestone.closed_items_count} closed
- –
- #{@group_milestone.open_items_count} open
+ Closed
+ - else
+ Open
+ %td
+ = milestone.expires_at
- .progress.progress-info
- .progress-bar{style: "width: #{@group_milestone.percent_complete}%;"}
+.context
+ %p.lead
+ Progress:
+ #{@group_milestone.closed_items_count} closed
+ –
+ #{@group_milestone.open_items_count} open
+ .progress.progress-info
+ .progress-bar{style: "width: #{@group_milestone.percent_complete}%;"}
%ul.nav.nav-tabs
%li.active
diff --git a/app/views/groups/projects.html.haml b/app/views/groups/projects.html.haml
index 65a66355c563a9a98d948c9487f44d8c3ffead1e..40c81e8cd5b1544116cbd21b139e5d3f7d8720ad 100644
--- a/app/views/groups/projects.html.haml
+++ b/app/views/groups/projects.html.haml
@@ -1,29 +1,25 @@
-.row
- .col-md-2
- = render 'settings_nav'
- .col-md-10
- .panel.panel-default
- .panel-heading
- %strong= @group.name
- projects:
- - if can? current_user, :manage_group, @group
- .panel-head-actions
- = link_to new_project_path(namespace_id: @group.id), class: "btn btn-new" do
- %i.fa.fa-plus
- New Project
- %ul.well-list
- - @projects.each do |project|
- %li
- .list-item-name
- = visibility_level_icon(project.visibility_level)
- %strong= link_to project.name_with_namespace, project
- %span.label.label-gray
- = repository_size(project)
- .pull-right
- = link_to 'Members', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
- = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
- = link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove"
- - if @projects.blank?
- .nothing-here-block This group has no projects yet
+.panel.panel-default
+ .panel-heading
+ %strong= @group.name
+ projects:
+ - if can? current_user, :manage_group, @group
+ .panel-head-actions
+ = link_to new_project_path(namespace_id: @group.id), class: "btn btn-new" do
+ %i.fa.fa-plus
+ New Project
+ %ul.well-list
+ - @projects.each do |project|
+ %li
+ .list-item-name
+ = visibility_level_icon(project.visibility_level)
+ %strong= link_to project.name_with_namespace, project
+ %span.label.label-gray
+ = repository_size(project)
+ .pull-right
+ = link_to 'Members', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
+ = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
+ = link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove"
+ - if @projects.blank?
+ .nothing-here-block This group has no projects yet
- = paginate @projects, theme: "gitlab"
+= paginate @projects, theme: "gitlab"
diff --git a/app/views/groups/show.atom.builder b/app/views/groups/show.atom.builder
index e765ea8338d608f310ffbd8d48832d4b94df941c..c78bd1bd2637f2412f6f1f90a346ea86fe495e57 100644
--- a/app/views/groups/show.atom.builder
+++ b/app/views/groups/show.atom.builder
@@ -1,5 +1,5 @@
xml.instruct!
-xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlnsmedia" => "http://search.yahoo.com/mrss/" do
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Group feed - #{@group.name}"
xml.link href: group_path(@group, :atom), rel: "self", type: "application/atom+xml"
xml.link href: group_path(@group), rel: "alternate", type: "text/html"
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml
index 885d43645042ca4aec6cdc5a283710f4bf78924c..a923128fa9f13f38d0978d0f9ebf7daa5a0f1c59 100644
--- a/app/views/groups/show.html.haml
+++ b/app/views/groups/show.html.haml
@@ -1,37 +1,22 @@
.dashboard
- %section.activities.col-md-8.hidden-sm.hidden-xs
- - if current_user
- = render "events/event_last_push", event: @last_push
- = link_to dashboard_path, class: 'btn btn-tiny' do
- ← To dashboard
-
- %span.cgray
- Currently you are only seeing events from the
- = @group.name
- group
- %hr
- = render 'shared/event_filter'
- - if @events.any?
- .content_list
- - else
- .nothing-here-block Project activity will be displayed here
- = spinner
- %aside.side.col-md-4
- .light-well.append-bottom-20
- = image_tag group_icon(@group.path), class: "avatar s90"
- .clearfix.light
- %h3.page-title
- = @group.name
- - if @group.description.present?
- %p{ dir: :auto }
- = escaped_autolink(@group.description)
- = render "projects", projects: @projects
- - if current_user
- .prepend-top-20
- = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed" do
- %strong
- %i.fa.fa-rss
- News Feed
-
- %hr
- = render 'shared/promo'
+ %div
+ = image_tag group_icon(@group.path), class: "avatar s90"
+ .clearfix
+ %h2
+ = @group.name
+ - if @group.description.present?
+ %p{ dir: :auto }
+ = escaped_autolink(@group.description)
+ %hr
+ .row
+ %section.activities.col-md-8.hidden-sm.hidden-xs
+ - if current_user
+ = render "events/event_last_push", event: @last_push
+ = render 'shared/event_filter'
+ - if @events.any?
+ .content_list
+ - else
+ .nothing-here-block Project activity will be displayed here
+ = spinner
+ %aside.side.col-md-4
+ = render "projects", projects: @projects
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index d3253fb76c3c0d1b82cca25c8623537deab67688..04c4497ae07453f1c0582341232c289496912c35 100644
--- a/app/views/layouts/_head_panel.html.haml
+++ b/app/views/layouts/_head_panel.html.haml
@@ -1,12 +1,10 @@
-%header.navbar.navbar-static-top.navbar-gitlab
+%header.navbar.navbar-fixed-top.navbar-gitlab
.navbar-inner
.container
%div.app_logo
- %span.separator
= link_to root_path, class: "home has_bottom_tooltip", title: "Dashboard" do
%h1 GITLAB
- %span.separator
- %h1.title{ dir: 'auto' }= title
+ %h1.title{ dir: :auto }= title
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
@@ -46,3 +44,5 @@
%li.hidden-xs
= link_to current_user, class: "profile-pic", id: 'profile-pic' do
= image_tag avatar_icon(current_user.email, 26), alt: 'User activity'
+
+= render 'shared/outdated_browser'
diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..621365fa6aa1205c06377fd33ed07bd47c70adcc
--- /dev/null
+++ b/app/views/layouts/_page.html.haml
@@ -0,0 +1,16 @@
+- if defined?(sidebar)
+ .page-with-sidebar
+ .sidebar-wrapper
+ = render(sidebar)
+ .content-wrapper
+ .container-fluid
+ .content
+ = render "layouts/flash"
+ .clearfix
+ = yield
+- else
+ .container.navless-container
+ .content
+ = yield
+
+= yield :embedded_scripts
diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml
index 9bfc14d16c1b6ff6dc3546ba89fe729ec5c477dc..e912fea2aee702fe7e8dff279814a1c76001c0f5 100644
--- a/app/views/layouts/_public_head_panel.html.haml
+++ b/app/views/layouts/_public_head_panel.html.haml
@@ -1,4 +1,4 @@
-%header.navbar.navbar-static-top.navbar-gitlab
+%header.navbar.navbar-fixed-top.navbar-gitlab
.navbar-inner
.container
%div.app_logo
@@ -12,11 +12,13 @@
%span.sr-only Toggle navigation
%i.fa.fa-bars
- .pull-right.hidden-xs
- = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-new'
+ - unless current_controller?('sessions')
+ .pull-right.hidden-xs
+ = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'btn btn-sign-in btn-new'
- .navbar-collapse.collapse
- %ul.nav.navbar-nav
- %li.visible-xs
- = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes')
+ .navbar-collapse.collapse
+ %ul.nav.navbar-nav
+ %li.visible-xs
+ = link_to "Sign in", new_session_path(:user, redirect_to_referer: 'yes')
+= render 'shared/outdated_browser'
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
index 207ab22f4c7d529a8a23cbd7bb6c85021569c50c..fb62d5fea0a268fca92bc54da500ffc400688672 100644
--- a/app/views/layouts/admin.html.haml
+++ b/app/views/layouts/admin.html.haml
@@ -1,13 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Admin area"
- %body{class: "#{app_theme} admin", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} admin", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: "Admin area"
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/admin'
- .container
- .content
- = render "layouts/flash"
- = yield
- = yield :embedded_scripts
+ = render 'layouts/page', sidebar: 'layouts/nav/admin'
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 7d0819aa93ef7b1c58f2669120d71b799ceb948b..d40c9753b108c63d27cf3824d0f13bf8c80eb99a 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,12 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Dashboard"
- %body{class: "#{app_theme} application", :'data-page' => body_data_page }
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page }
= render "layouts/broadcast"
= render "layouts/head_panel", title: "Dashboard"
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/dashboard'
- .container
- .content
- = render "layouts/flash"
- = yield
+ = render 'layouts/page', sidebar: 'layouts/nav/dashboard'
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index 06de03eadad967ba3e8047ae12fb58cfdc2a5718..6f805f1c9d1ccba4d3c62dae35b7d0e9e9399abf 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -1,35 +1,32 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head"
- %body.ui_basic.login-page
- .container
- .content
- .login-title
- %h1= brand_title
- %hr
- .container
+ %body.ui_mars.login-page.application
+ = render "layouts/broadcast"
+ = render "layouts/public_head_panel", title: ''
+ .container.navless-container
.content
= render "layouts/flash"
- .row
- .col-md-7.brand-holder
+ .row.prepend-top-20
+ .col-sm-5.pull-right
+ = yield
+ .col-sm-7.brand-holder.pull-left
+ %h1
+ = brand_title
- if brand_item
- .brand-image
- = brand_image
- .brand_text
- = brand_text
+ = brand_image
+ = brand_text
- else
- .brand-image.default-brand-image.hidden-sm.hidden-xs
- = image_tag 'brand_logo.png'
- .brand_text.hidden-xs
- %h2 Open source software to collaborate on code
+ %h3 Open source software to collaborate on code
- %p.lead
- Manage git repositories with fine grained access controls that keep your code secure.
- Perform code reviews and enhance collaboration with merge requests.
- Each project can also have an issue tracker and a wiki.
+ %p
+ Manage git repositories with fine grained access controls that keep your code secure.
+ Perform code reviews and enhance collaboration with merge requests.
+ Each project can also have an issue tracker and a wiki.
+
+ - if extra_sign_in_text.present?
+ = markdown(extra_sign_in_text)
- .col-md-5
- = yield
%hr
.container
.footer-links
diff --git a/app/views/layouts/doorkeeper/admin.html.haml b/app/views/layouts/doorkeeper/admin.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..bd9adfab66d797d83702ddea4e89fc02d2028002
--- /dev/null
+++ b/app/views/layouts/doorkeeper/admin.html.haml
@@ -0,0 +1,22 @@
+!!!
+%html
+ %head
+ %meta{:charset => "utf-8"}
+ %meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}
+ %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
+ %title Doorkeeper
+ = stylesheet_link_tag "doorkeeper/admin/application"
+ = csrf_meta_tags
+ %body
+ .navbar.navbar-inverse.navbar-fixed-top{:role => "navigation"}
+ .container
+ .navbar-header
+ = link_to 'OAuth2 Provider', oauth_applications_path, class: 'navbar-brand'
+ %ul.nav.navbar-nav
+ = content_tag :li, class: "#{'active' if request.path == oauth_applications_path}" do
+ = link_to 'Applications', oauth_applications_path
+ .container
+ - if flash[:notice].present?
+ .alert.alert-info
+ = flash[:notice]
+ = yield
\ No newline at end of file
diff --git a/app/views/layouts/doorkeeper/application.html.haml b/app/views/layouts/doorkeeper/application.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..e5f37fad1f40f2c1714579d46bb6fec06131c5f1
--- /dev/null
+++ b/app/views/layouts/doorkeeper/application.html.haml
@@ -0,0 +1,15 @@
+!!!
+%html
+ %head
+ %title OAuth authorize required
+ %meta{:charset => "utf-8"}
+ %meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}
+ %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
+ = stylesheet_link_tag "doorkeeper/application"
+ = csrf_meta_tags
+ %body
+ #container
+ - if flash[:notice].present?
+ .alert.alert-info
+ = flash[:notice]
+ = yield
\ No newline at end of file
diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml
index 16df9c10fbb0c0c2f6042bbd47196bd699291202..e7d875173e6d503d0446da32a4f1a64fbd832b4c 100644
--- a/app/views/layouts/errors.html.haml
+++ b/app/views/layouts/errors.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Error"
- %body{class: "#{app_theme} application"}
+ %body{class: "#{app_theme} #{theme_type} application"}
= render "layouts/head_panel", title: "" if current_user
.container.navless-container
= render "layouts/flash"
diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml
index d023846c5eb73717304ca765e3f71398f7a3b515..9813d84654273289b032aec40e8c34e48456a95a 100644
--- a/app/views/layouts/explore.html.haml
+++ b/app/views/layouts/explore.html.haml
@@ -2,7 +2,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: page_title
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
- if current_user
= render "layouts/head_panel", title: page_title
diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml
index f22fb236cb5b48d69fcc2a49d13dfe8b38655583..72b0d03908dec99f171518ab70ee13156f41a6c5 100644
--- a/app/views/layouts/group.html.haml
+++ b/app/views/layouts/group.html.haml
@@ -1,12 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: group_head_title
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
- = render "layouts/head_panel", title: "group: #{@group.name}"
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/group'
- .container
- .content
- = render "layouts/flash"
- = yield
+ = render "layouts/head_panel", title: @group.name
+ = render 'layouts/page', sidebar: 'layouts/nav/group'
diff --git a/app/views/layouts/nav/_admin.html.haml b/app/views/layouts/nav/_admin.html.haml
index c57216f01c8bd84685692cb92516e80ce99f5cd4..d9c6670d1bcade610c88dd52bbec18d8e0537faf 100644
--- a/app/views/layouts/nav/_admin.html.haml
+++ b/app/views/layouts/nav/_admin.html.haml
@@ -1,19 +1,53 @@
-%ul
+%ul.nav.nav-sidebar
= nav_link(controller: :dashboard, html_options: {class: 'home'}) do
= link_to admin_root_path, title: "Stats" do
- Overview
+ %i.fa.fa-dashboard
+ %span
+ Overview
= nav_link(controller: :projects) do
- = link_to "Projects", admin_projects_path
+ = link_to admin_projects_path do
+ %i.fa.fa-cube
+ %span
+ Projects
= nav_link(controller: :users) do
- = link_to "Users", admin_users_path
+ = link_to admin_users_path do
+ %i.fa.fa-user
+ %span
+ Users
= nav_link(controller: :groups) do
- = link_to "Groups", admin_groups_path
+ = link_to admin_groups_path do
+ %i.fa.fa-group
+ %span
+ Groups
= nav_link(controller: :logs) do
- = link_to "Logs", admin_logs_path
+ = link_to admin_logs_path do
+ %i.fa.fa-file-text
+ %span
+ Logs
= nav_link(controller: :broadcast_messages) do
- = link_to "Messages", admin_broadcast_messages_path
+ = link_to admin_broadcast_messages_path do
+ %i.fa.fa-bullhorn
+ %span
+ Messages
= nav_link(controller: :hooks) do
- = link_to "Hooks", admin_hooks_path
+ = link_to admin_hooks_path do
+ %i.fa.fa-external-link
+ %span
+ Hooks
= nav_link(controller: :background_jobs) do
- = link_to "Background Jobs", admin_background_jobs_path
+ = link_to admin_background_jobs_path do
+ %i.fa.fa-cog
+ %span
+ Background Jobs
+ = nav_link(controller: :application_settings) do
+ = link_to admin_application_settings_path do
+ %i.fa.fa-cogs
+ %span
+ Settings
+
+ = nav_link(controller: :applications) do
+ = link_to admin_applications_path do
+ %i.fa.fa-cloud
+ %span
+ Applications
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index a6e9772d93f506e01d4ff050b49fff42023ba0b4..a2eaa2d83c51057ef05a8cb7215f06bf6efb7d51 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -1,18 +1,29 @@
-%ul
+%ul.nav.nav-sidebar
= nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
= link_to root_path, title: 'Home', class: 'shortcuts-activity' do
- Activity
+ %i.fa.fa-dashboard
+ %span
+ Activity
= nav_link(path: 'dashboard#projects') do
= link_to projects_dashboard_path, class: 'shortcuts-projects' do
- Projects
+ %i.fa.fa-cube
+ %span
+ Projects
= nav_link(path: 'dashboard#issues') do
- = link_to issues_dashboard_path, class: 'shortcuts-issues' do
- Issues
- %span.count= current_user.assigned_issues.opened.count
+ = link_to assigned_issues_dashboard_path, class: 'shortcuts-issues' do
+ %i.fa.fa-exclamation-circle
+ %span
+ Issues
+ %span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
- = link_to merge_requests_dashboard_path, class: 'shortcuts-merge_requests' do
- Merge Requests
- %span.count= current_user.assigned_merge_requests.opened.count
+ = link_to assigned_mrs_dashboard_path, class: 'shortcuts-merge_requests' do
+ %i.fa.fa-tasks
+ %span
+ Merge Requests
+ %span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :help) do
- = link_to "Help", help_path
+ = link_to help_path do
+ %i.fa.fa-question-circle
+ %span
+ Help
diff --git a/app/views/layouts/nav/_group.html.haml b/app/views/layouts/nav/_group.html.haml
index 9095a843c9ff5c5813aade4e3059d7ac3f191d2d..54468d077ab7aadb41e3422d798156274a8f34df 100644
--- a/app/views/layouts/nav/_group.html.haml
+++ b/app/views/layouts/nav/_group.html.haml
@@ -1,25 +1,42 @@
-%ul
+%ul.nav.nav-sidebar
= nav_link(path: 'groups#show', html_options: {class: 'home'}) do
= link_to group_path(@group), title: "Home" do
- Activity
- = nav_link(controller: [:group, :milestones]) do
- = link_to group_milestones_path(@group) do
- Milestones
+ %i.fa.fa-dashboard
+ %span
+ Activity
+ - if current_user
+ = nav_link(controller: [:group, :milestones]) do
+ = link_to group_milestones_path(@group) do
+ %i.fa.fa-clock-o
+ %span
+ Milestones
= nav_link(path: 'groups#issues') do
= link_to issues_group_path(@group) do
- Issues
- - if current_user
- %span.count= current_user.assigned_issues.opened.of_group(@group).count
+ %i.fa.fa-exclamation-circle
+ %span
+ Issues
+ - if current_user
+ %span.count= Issue.opened.of_group(@group).count
= nav_link(path: 'groups#merge_requests') do
= link_to merge_requests_group_path(@group) do
- Merge Requests
- - if current_user
- %span.count= current_user.cared_merge_requests.opened.of_group(@group).count
+ %i.fa.fa-tasks
+ %span
+ Merge Requests
+ - if current_user
+ %span.count= MergeRequest.opened.of_group(@group).count
= nav_link(path: 'groups#members') do
- = link_to "Members", members_group_path(@group)
+ = link_to members_group_path(@group) do
+ %i.fa.fa-users
+ %span
+ Members
- if can?(current_user, :manage_group, @group)
- = nav_link(path: 'groups#edit') do
- = link_to edit_group_path(@group), class: "tab " do
- Settings
+ = nav_link(html_options: { class: "#{"active" if group_settings_page?} separate-item" }) do
+ = link_to edit_group_path(@group), class: "tab no-highlight" do
+ %i.fa.fa-cogs
+ %span
+ Settings
+ %i.fa.fa-angle-down
+ - if group_settings_page?
+ = render 'groups/settings_nav'
diff --git a/app/views/layouts/nav/_profile.html.haml b/app/views/layouts/nav/_profile.html.haml
index 1de5ee99cf496e60bb4e95239a8bdf98cf4f6aad..cc50b9b570a8a8c36ce0bbfe9c8b07af6223bd9f 100644
--- a/app/views/layouts/nav/_profile.html.haml
+++ b/app/views/layouts/nav/_profile.html.haml
@@ -1,26 +1,56 @@
-%ul
+%ul.nav.nav-sidebar
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: "Profile" do
- Profile
+ %i.fa.fa-user
+ %span
+ Profile
= nav_link(controller: :accounts) do
- = link_to "Account", profile_account_path
+ = link_to profile_account_path do
+ %i.fa.fa-gear
+ %span
+ Account
+ = nav_link(path: ['profiles#applications', 'applications#edit', 'applications#show', 'applications#new']) do
+ = link_to applications_profile_path do
+ %i.fa.fa-cloud
+ %span
+ Applications
= nav_link(controller: :emails) do
= link_to profile_emails_path do
- Emails
- %span.count= current_user.emails.count + 1
+ %i.fa.fa-envelope-o
+ %span
+ Emails
+ %span.count= current_user.emails.count + 1
- unless current_user.ldap_user?
= nav_link(controller: :passwords) do
- = link_to "Password", edit_profile_password_path
+ = link_to edit_profile_password_path do
+ %i.fa.fa-lock
+ %span
+ Password
= nav_link(controller: :notifications) do
- = link_to "Notifications", profile_notifications_path
+ = link_to profile_notifications_path do
+ %i.fa.fa-inbox
+ %span
+ Notifications
+
= nav_link(controller: :keys) do
= link_to profile_keys_path do
- SSH Keys
- %span.count= current_user.keys.count
+ %i.fa.fa-key
+ %span
+ SSH Keys
+ %span.count= current_user.keys.count
= nav_link(path: 'profiles#design') do
- = link_to "Design", design_profile_path
+ = link_to design_profile_path do
+ %i.fa.fa-image
+ %span
+ Design
= nav_link(controller: :groups) do
- = link_to "Groups", profile_groups_path
+ = link_to profile_groups_path do
+ %i.fa.fa-group
+ %span
+ Groups
= nav_link(path: 'profiles#history') do
- = link_to "History", history_profile_path
+ = link_to history_profile_path do
+ %i.fa.fa-history
+ %span
+ History
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index 6cb2a82bac85abe439c1ddb1ea09da665b8262ee..94cee0bd50f34e52d26f37cb7ae9482e59d33ffd 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -1,45 +1,76 @@
-%ul.project-navigation
+%ul.project-navigation.nav.nav-sidebar
= nav_link(path: 'projects#show', html_options: {class: "home"}) do
= link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do
- Project
+ %i.fa.fa-dashboard
+ %span
+ Project
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
- = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref), class: 'shortcuts-tree'
+ = link_to project_tree_path(@project, @ref || @repository.root_ref), class: 'shortcuts-tree' do
+ %i.fa.fa-files-o
+ %span
+ Files
+
- if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do
- = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref), class: 'shortcuts-commits'
+ = link_to project_commits_path(@project, @ref || @repository.root_ref), class: 'shortcuts-commits' do
+ %i.fa.fa-history
+ %span
+ Commits
- if project_nav_tab? :network
= nav_link(controller: %w(network)) do
- = link_to "Network", project_network_path(@project, @ref || @repository.root_ref), class: 'shortcuts-network'
+ = link_to project_network_path(@project, @ref || @repository.root_ref), class: 'shortcuts-network' do
+ %i.fa.fa-code-fork
+ %span
+ Network
- if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do
- = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref), class: 'shortcuts-graphs'
+ = link_to project_graph_path(@project, @ref || @repository.root_ref), class: 'shortcuts-graphs' do
+ %i.fa.fa-area-chart
+ %span
+ Graphs
- if project_nav_tab? :issues
= nav_link(controller: %w(issues milestones labels)) do
= link_to url_for_project_issues, class: 'shortcuts-issues' do
- Issues
- - if @project.used_default_issues_tracker?
- %span.count.issue_counter= @project.issues.opened.count
+ %i.fa.fa-exclamation-circle
+ %span
+ Issues
+ - if @project.used_default_issues_tracker?
+ %span.count.issue_counter= @project.issues.opened.count
- if project_nav_tab? :merge_requests
= nav_link(controller: :merge_requests) do
= link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests' do
- Merge Requests
- %span.count.merge_counter= @project.merge_requests.opened.count
+ %i.fa.fa-tasks
+ %span
+ Merge Requests
+ %span.count.merge_counter= @project.merge_requests.opened.count
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
- = link_to 'Wiki', project_wiki_path(@project, :home), class: 'shortcuts-wiki'
+ = link_to project_wiki_path(@project, :home), class: 'shortcuts-wiki' do
+ %i.fa.fa-book
+ %span
+ Wiki
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
- = link_to 'Snippets', project_snippets_path(@project), class: 'shortcuts-snippets'
+ = link_to project_snippets_path(@project), class: 'shortcuts-snippets' do
+ %i.fa.fa-file-text-o
+ %span
+ Snippets
- if project_nav_tab? :settings
- = nav_link(html_options: {class: "#{project_tab_class}"}) do
- = link_to edit_project_path(@project), class: "stat-tab tab " do
- Settings
+ = nav_link(html_options: {class: "#{project_tab_class} separate-item"}) do
+ = link_to edit_project_path(@project), class: "stat-tab tab no-highlight" do
+ %i.fa.fa-cogs
+ %span
+ Settings
+ %i.fa.fa-angle-down
+
+ - if @project_settings_nav
+ = render 'projects/settings_nav'
diff --git a/app/views/layouts/navless.html.haml b/app/views/layouts/navless.html.haml
index 2c5fffe384f92488f264fa883f5c7a2f3fa5c8d8..730f3d092774a05d2d7540d681eab6bfb45433dc 100644
--- a/app/views/layouts/navless.html.haml
+++ b/app/views/layouts/navless.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @title
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: @title
.container.navless-container
diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml
index da4519613273e5139686c28de0c7e569cdc81661..e81cf9e5bf642a36e24f406be8a3ed4ac9c25e47 100644
--- a/app/views/layouts/notify.html.haml
+++ b/app/views/layouts/notify.html.haml
@@ -24,8 +24,8 @@
%p
\—
%br
- - if @project
- You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, project_url(@project)} project team.
- if @target_url
#{link_to "View it on GitLab", @target_url}
= email_action @target_url
+ - if @project
+ You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, project_url(@project)} project team.
diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml
index 1d0ab84d26fdaca53850065717777c271ffefd94..941084cc4ad2916a3420f08e8bd97d56f2bd32e0 100644
--- a/app/views/layouts/profile.html.haml
+++ b/app/views/layouts/profile.html.haml
@@ -1,12 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Profile"
- %body{class: "#{app_theme} profile", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} profile", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: "Profile"
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/profile'
- .container
- .content
- = render "layouts/flash"
- = yield
+ = render 'layouts/page', sidebar: 'layouts/nav/profile'
diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml
index c8b8f4ba97178d003eb56f9794981f52f6589982..0f20bf38bfd928b25842ce95b97bc0d29b29f702 100644
--- a/app/views/layouts/project_settings.html.haml
+++ b/app/views/layouts/project_settings.html.haml
@@ -1,19 +1,9 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @project.name_with_namespace
- %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
+ %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
= render "layouts/broadcast"
= render "layouts/head_panel", title: project_title(@project)
= render "layouts/init_auto_complete"
- - if can?(current_user, :download_code, @project)
- = render 'shared/no_ssh'
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/project'
- .container
- .content
- = render "layouts/flash"
- .row
- .col-md-2
- = render "projects/settings_nav"
- .col-md-10
- = yield
+ - @project_settings_nav = true
+ = render 'layouts/page', sidebar: 'layouts/nav/project'
diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml
index 8ad2f1659460f9b3994e1f5bc048ff0db01243c0..d4ee53db55c0d5d6cfa914e331a8e0aaec9a3a34 100644
--- a/app/views/layouts/projects.html.haml
+++ b/app/views/layouts/projects.html.haml
@@ -1,16 +1,8 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: project_head_title
- %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
+ %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
= render "layouts/broadcast"
= render "layouts/head_panel", title: project_title(@project)
= render "layouts/init_auto_complete"
- - if can?(current_user, :download_code, @project)
- = render 'shared/no_ssh'
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/project'
- .container
- .content
- = render "layouts/flash"
- = yield
- = yield :embedded_scripts
+ = render 'layouts/page', sidebar: 'layouts/nav/project'
diff --git a/app/views/layouts/public_group.html.haml b/app/views/layouts/public_group.html.haml
index a289b784725315f6e3423396864e3cdde4d55201..64794104ac5c1789726de4fbdcd493fca6998310 100644
--- a/app/views/layouts/public_group.html.haml
+++ b/app/views/layouts/public_group.html.haml
@@ -1,10 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: group_head_title
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/public_head_panel", title: "group: #{@group.name}"
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/group'
- .container
- .content= yield
+ = render 'layouts/page', sidebar: 'layouts/nav/group'
diff --git a/app/views/layouts/public_projects.html.haml b/app/views/layouts/public_projects.html.haml
index 2a9230244f89a38391ccfa4a205f1ff07135f23c..5964a29d5226713b7037a62b0f51998f1a20dcbf 100644
--- a/app/views/layouts/public_projects.html.haml
+++ b/app/views/layouts/public_projects.html.haml
@@ -1,10 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @project.name_with_namespace
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/public_head_panel", title: project_title(@project)
- %nav.main-nav.navbar-collapse.collapse
- .container= render 'layouts/nav/project'
- .container
- .content= yield
+ = render 'layouts/page', sidebar: 'layouts/nav/project'
diff --git a/app/views/layouts/public_users.html.haml b/app/views/layouts/public_users.html.haml
index 4aa258fea0d8d5aa83d65d401a287da3581ced3b..0510ce34a7f673455ec264e8abc5ed2c410d1e49 100644
--- a/app/views/layouts/public_users.html.haml
+++ b/app/views/layouts/public_users.html.haml
@@ -1,8 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @title
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/public_head_panel", title: @title
- .container.navless-container
- .content= yield
+ = render 'layouts/page'
diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml
index 084ff7ec830b9f0a4377c407ed36fa1674672300..6d001e7ee1cd61f1b761a29bc976497364012cd8 100644
--- a/app/views/layouts/search.html.haml
+++ b/app/views/layouts/search.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Search"
- %body{class: "#{app_theme} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: "Search"
.container.navless-container
diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml
index 9e5287c1b33175b99302557e56fb7970b62b0073..feb0e2b4854d087111317a2040c5f681e5f6868d 100644
--- a/app/views/notify/repository_push_email.html.haml
+++ b/app/views/notify/repository_push_email.html.haml
@@ -6,7 +6,9 @@
- @commits.each do |commit|
%li
%strong #{link_to commit.short_id, project_commit_url(@project, commit)}
- %span by #{commit.author_name}
+ %div
+ %span by #{commit.author_name}
+ %i at #{commit.committed_date.strftime("%Y-%m-%dT%H:%M:%SZ")}
%pre #{commit.safe_message}
%h4 Changes:
diff --git a/app/views/profiles/accounts/show.html.haml b/app/views/profiles/accounts/show.html.haml
index a21dcff41c069f92e609bd8465e6aae3235201cf..53a50f6796b8aa123d08d48c35e1c2187610dda9 100644
--- a/app/views/profiles/accounts/show.html.haml
+++ b/app/views/profiles/accounts/show.html.haml
@@ -75,3 +75,4 @@
The following groups will be abandoned. You should transfer or remove them:
%strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
= link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
+
diff --git a/app/views/profiles/applications.html.haml b/app/views/profiles/applications.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..cb24e4a3dde0f8cd581a2ccc4d0e7477a04a3267
--- /dev/null
+++ b/app/views/profiles/applications.html.haml
@@ -0,0 +1,47 @@
+%h3.page-title
+ OAuth2
+
+%fieldset.oauth-applications
+ %legend Your applications
+ %p= link_to 'New Application', new_oauth_application_path, class: 'btn btn-success'
+ - if @applications.any?
+ %table.table.table-striped
+ %thead
+ %tr
+ %th Name
+ %th Callback URL
+ %th Clients
+ %th
+ %th
+ %tbody
+ - @applications.each do |application|
+ %tr{:id => "application_#{application.id}"}
+ %td= link_to application.name, oauth_application_path(application)
+ %td
+ - application.redirect_uri.split.each do |uri|
+ %div= uri
+ %td= application.access_tokens.count
+ %td= link_to 'Edit', edit_oauth_application_path(application), class: 'btn btn-link btn-small'
+ %td= render 'doorkeeper/applications/delete_form', application: application
+
+%fieldset.oauth-authorized-applications.prepend-top-20
+ %legend Authorized applications
+
+ - if @authorized_tokens.any?
+ %table.table.table-striped
+ %thead
+ %tr
+ %th Name
+ %th Authorized At
+ %th Scope
+ %th
+ %tbody
+ - @authorized_tokens.each do |token|
+ - application = token.application
+ %tr{:id => "application_#{application.id}"}
+ %td= application.name
+ %td= token.created_at
+ %td= token.scopes
+ %td= render 'doorkeeper/authorized_applications/delete_form', application: application
+ - else
+ %p.light You dont have any authorized applications
diff --git a/app/views/profiles/keys/_key.html.haml b/app/views/profiles/keys/_key.html.haml
index 757ee4f7e392678eb6c4e9923067cac3125f92b0..5a77bec8c83de836a872d7591ea85ce36ab466d1 100644
--- a/app/views/profiles/keys/_key.html.haml
+++ b/app/views/profiles/keys/_key.html.haml
@@ -1,9 +1,12 @@
-%li
- = link_to profile_key_path(key) do
- %strong{ dir: :auto }= key.title
- %span
- (#{key.fingerprint})
- %span.cgray
- added #{time_ago_with_tooltip(key.created_at)}
-
- = link_to 'Remove', profile_key_path(key), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right"
+%tr
+ %td
+ = link_to path_to_key(key, is_admin) do
+ %strong{ dir: :auto }= key.title
+ %td
+ %span
+ (#{key.fingerprint})
+ %td
+ %span.cgray
+ added #{time_ago_with_tooltip(key.created_at)}
+ %td
+ = link_to 'Remove', path_to_key(key, is_admin), data: { confirm: 'Are you sure?'}, method: :delete, class: "btn btn-small btn-remove delete-key pull-right"
diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..4b4a46992fd607a1eb7ee0726581f825bb19c897
--- /dev/null
+++ b/app/views/profiles/keys/_key_details.html.haml
@@ -0,0 +1,22 @@
+- is_admin = defined?(admin) ? true : false
+.row
+ .col-md-4
+ .panel.panel-default
+ .panel-heading
+ SSH Key
+ %ul.well-list
+ %li
+ %span.light Title:
+ %strong{ dir: :auto }= @key.title
+ %li
+ %span.light Created on:
+ %strong= @key.created_at.stamp("Aug 21, 2011")
+
+ .col-md-8
+ %p
+ %span.light Fingerprint:
+ %strong= @key.fingerprint
+ %pre.well-pre
+ = @key.key
+ .pull-right
+ = link_to 'Remove', path_to_key(@key, is_admin), data: {confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove delete-key"
diff --git a/app/views/profiles/keys/_key_table.html.haml b/app/views/profiles/keys/_key_table.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..ef0075aad3b20598c45a21fed3453a8cd65131b6
--- /dev/null
+++ b/app/views/profiles/keys/_key_table.html.haml
@@ -0,0 +1,19 @@
+- is_admin = defined?(admin) ? true : false
+.panel.panel-default
+ - if @keys.any?
+ %table.table
+ %thead.panel-heading
+ %tr
+ %th Title
+ %th Fingerprint
+ %th Added at
+ %th
+ %tbody
+ - @keys.each do |key|
+ = render 'profiles/keys/key', key: key, is_admin: is_admin
+ - else
+ .nothing-here-block
+ - if is_admin
+ User has no ssh keys
+ - else
+ There are no SSH keys with access to your account.
diff --git a/app/views/profiles/keys/index.html.haml b/app/views/profiles/keys/index.html.haml
index a322f82f2362708410fb72139f86eb590aa4c13b..809953960bb677874a660c05e9904ca32bd8e793 100644
--- a/app/views/profiles/keys/index.html.haml
+++ b/app/views/profiles/keys/index.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- My SSH keys
+ My SSH keys (#{@keys.count})
.pull-right
= link_to "Add SSH Key", new_profile_key_path, class: "btn btn-new"
%p.light
@@ -9,14 +9,4 @@
= link_to "generate it", help_page_path("ssh", "ssh")
%hr
-
-.panel.panel-default
- .panel-heading
- SSH Keys (#{@keys.count})
- %ul.well-list#keys-table
- = render @keys
- - if @keys.blank?
- %li
- .nothing-here-block There are no SSH keys with access to your account.
-
-
+= render 'key_table'
diff --git a/app/views/profiles/keys/show.html.haml b/app/views/profiles/keys/show.html.haml
index 93b1a0ba2dc7a96efdd3030b1d18e489d00e21e0..cfd53298962f50c7b1fd064a3421568ad8084e3d 100644
--- a/app/views/profiles/keys/show.html.haml
+++ b/app/views/profiles/keys/show.html.haml
@@ -1,22 +1 @@
-.row
- .col-md-4
- .panel.panel-default
- .panel-heading
- SSH Key
- %ul.well-list
- %li
- %span.light Title:
- %strong{ dir: :auto }= @key.title
- %li
- %span.light Created on:
- %strong= JalaliDate.new(@key.created_at).strftime("%A %d %b %Y")
-
- .col-md-8
- %p
- %span.light Fingerprint:
- %strong= @key.fingerprint
- %pre.well-pre
- = @key.key
-
-.pull-right
- = link_to 'Remove', profile_key_path(@key), data: {confirm: 'Are you sure?'}, method: :delete, class: "btn btn-remove delete-key"
+= render "key_details"
diff --git a/app/views/profiles/notifications/show.html.haml b/app/views/profiles/notifications/show.html.haml
index a044fad8fa3cd879519707ed485502a1ac571891..96fe91b9b2018781916ae5bf5b52c4976e194f7f 100644
--- a/app/views/profiles/notifications/show.html.haml
+++ b/app/views/profiles/notifications/show.html.haml
@@ -15,6 +15,13 @@
Disabled
%p You will not get any notifications via email
+ .radio
+ = label_tag nil, class: '' do
+ = radio_button_tag :notification_level, Notification::N_MENTION, @notification.mention?, class: 'trigger-submit'
+ .level-title
+ Mention
+ %p You will receive notifications only for comments where you was @mentioned
+
.radio
= label_tag nil, class: '' do
= radio_button_tag :notification_level, Notification::N_PARTICIPATING, @notification.participating?, class: 'trigger-submit'
diff --git a/app/views/profiles/passwords/edit.html.haml b/app/views/profiles/passwords/edit.html.haml
index 425200ff523120d225cc10bb11d6207a4b123092..2a7d317aa3e00eb787b4bde7d00a9fbb3838b413 100644
--- a/app/views/profiles/passwords/edit.html.haml
+++ b/app/views/profiles/passwords/edit.html.haml
@@ -24,7 +24,7 @@
.form-group
= f.label :password, 'New password', class: 'control-label'
.col-sm-10
- = f.password_field :password, required: true, class: 'form-control', id: 'user_password_profile'
+ = f.password_field :password, required: true, class: 'form-control'
.form-group
= f.label :password_confirmation, class: 'control-label'
.col-sm-10
diff --git a/app/views/profiles/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml
index 42d2d0db29c4eac0e9bde4327fa8aceecbf72083..aef7348fd203a8053dcb241cc37af2b09b20b138 100644
--- a/app/views/profiles/passwords/new.html.haml
+++ b/app/views/profiles/passwords/new.html.haml
@@ -16,7 +16,7 @@
.col-sm-10= f.password_field :current_password, required: true, class: 'form-control'
.form-group
= f.label :password, class: 'control-label'
- .col-sm-10= f.password_field :password, required: true, class: 'form-control', id: 'user_password_profile'
+ .col-sm-10= f.password_field :password, required: true, class: 'form-control'
.form-group
= f.label :password_confirmation, class: 'control-label'
.col-sm-10
diff --git a/app/views/profiles/update.js.erb b/app/views/profiles/update.js.erb
index 04b5cf4827de0bd5d07fc077af4ad691bf350dcd..e664ac2a52ab81cd0cb1f128664ff86909bb8ab3 100644
--- a/app/views/profiles/update.js.erb
+++ b/app/views/profiles/update.js.erb
@@ -1,6 +1,6 @@
// Remove body class for any previous theme, re-add current one
-$('body').removeClass('ui_basic ui_mars ui_modern ui_gray ui_color')
-$('body').addClass('<%= app_theme %>')
+$('body').removeClass('ui_basic ui_mars ui_modern ui_gray ui_color light_theme dark_theme')
+$('body').addClass('<%= app_theme %> <%= theme_type %>')
// Re-render the header to reflect the new theme
$('header').html('<%= escape_javascript(render("layouts/head_panel", title: "Profile")) %>')
diff --git a/app/views/projects/_github_import_modal.html.haml b/app/views/projects/_github_import_modal.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..02c9ef45f2b37625909a11b4f0469e232455ca9d
--- /dev/null
+++ b/app/views/projects/_github_import_modal.html.haml
@@ -0,0 +1,22 @@
+%div#github_import_modal.modal.hide
+ .modal-dialog
+ .modal-content
+ .modal-header
+ %a.close{href: "#", "data-dismiss" => "modal"} ×
+ %h3 GitHub OAuth import
+ .modal-body
+ You need to setup integration with GitHub first.
+ = link_to 'How to setup integration with GitHub', 'https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/github.md'
+
+
+:javascript
+ $(function(){
+ var import_modal = $('#github_import_modal').modal({modal: true, show:false});
+ $('.how_to_import_link').bind("click", function(e){
+ e.preventDefault();
+ import_modal.show();
+ });
+ $('.modal-header .close').bind("click", function(){
+ import_modal.hide();
+ })
+ })
diff --git a/app/views/projects/_issuable_filter.html.haml b/app/views/projects/_issuable_filter.html.haml
deleted file mode 100644
index 276af4a27f2c80bf35feca8d81f664d28e4b4bab..0000000000000000000000000000000000000000
--- a/app/views/projects/_issuable_filter.html.haml
+++ /dev/null
@@ -1,72 +0,0 @@
-.issues-filters
- .dropdown.inline
- %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
- %i.fa.fa-user
- %span.light assignee:
- - if @assignee.present?
- %strong= @assignee.name
- - elsif params[:assignee_id] == "0"
- Unassigned
- - else
- Any
- %b.caret
- %ul.dropdown-menu
- %li
- = link_to project_filter_path(assignee_id: nil) do
- Any
- = link_to project_filter_path(assignee_id: 0) do
- Unassigned
- - @assignees.sort_by(&:name).each do |user|
- %li
- = link_to project_filter_path(assignee_id: user.id) do
- = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
- %span{ dir: :auto }= user.name
-
- .dropdown.inline.prepend-left-10
- %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
- %i.fa.fa-user
- %span.light author:
- - if @author.present?
- %strong{ dir: :auto }= @author.name
- - elsif params[:author_id] == "0"
- Unassigned
- - else
- Any
- %b.caret
- %ul.dropdown-menu
- %li
- = link_to project_filter_path(author_id: nil) do
- Any
- = link_to project_filter_path(author_id: 0) do
- Unassigned
- - @authors.sort_by(&:name).each do |user|
- %li
- = link_to project_filter_path(author_id: user.id) do
- = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
- %span{ dir: :auto }= user.name
-
- .dropdown.inline.prepend-left-10
- %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
- %i.fa.fa-clock-o
- %span.light milestone:
- - if @milestone.present?
- %strong{ dir: :auto }= @milestone.title
- - elsif params[:milestone_id] == "0"
- None (backlog)
- - else
- Any
- %b.caret
- %ul.dropdown-menu
- %li
- = link_to project_filter_path(milestone_id: nil) do
- Any
- = link_to project_filter_path(milestone_id: 0) do
- None (backlog)
- - project_active_milestones.each do |milestone|
- %li
- = link_to project_filter_path(milestone_id: milestone.id) do
- %strong{ dir: :auto }= milestone.title
- %small.light{ dir: :auto }= milestone.expires_at
-
- .pull-right
- = render 'shared/sort_dropdown'
diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml
index edb13d5d6d0f0f1055446ec6021c00caea9a25ff..f4a59b2d5c923aae7da5c86e579d0a893d1bbd05 100644
--- a/app/views/projects/_issuable_form.html.haml
+++ b/app/views/projects/_issuable_form.html.haml
@@ -52,10 +52,11 @@
- else
%span.light No open milestones available.
- = link_to 'Create new milestone', new_project_milestone_path(issuable.project), target: :blank
+ - if can? current_user, :admin_milestone, issuable.project
+ = link_to 'Create new milestone', new_project_milestone_path(issuable.project), target: :blank
.form-group
= f.label :label_ids, class: 'control-label' do
- %i.icon-tag
+ %i.fa.fa-tag
Labels
.col-sm-10
- if issuable.project.labels.any?
@@ -64,9 +65,15 @@
- else
%span.light No labels yet.
- = link_to 'Create new label', new_project_label_path(issuable.project), target: :blank
+ - if can? current_user, :admin_label, issuable.project
+ = link_to 'Create new label', new_project_label_path(issuable.project), target: :blank
.form-actions
+ - if !issuable.project.empty_repo? && contribution_guide_url(issuable.project) && !issuable.persisted?
+ %p
+ Please review the
+ %strong #{link_to 'guidelines for contribution', contribution_guide_url(issuable.project)}
+ to this repository.
- if issuable.new_record?
= f.submit "Submit new #{issuable.class.model_name.human.downcase}", class: 'btn btn-create'
- else
diff --git a/app/views/projects/_issues_nav.html.haml b/app/views/projects/_issues_nav.html.haml
index a1db0c1e72cd9e7336dbbe409e247ccf4eebbec4..240a3d6dd3e778f3ed59e2842af3277c806bb7d5 100644
--- a/app/views/projects/_issues_nav.html.haml
+++ b/app/views/projects/_issues_nav.html.haml
@@ -2,15 +2,22 @@
- if project_nav_tab? :issues
= nav_link(controller: :issues) do
= link_to project_issues_path(@project), class: "tab" do
+ %i.fa.fa-exclamation-circle
Issues
- if project_nav_tab? :merge_requests
= nav_link(controller: :merge_requests) do
= link_to project_merge_requests_path(@project), class: "tab" do
+ %i.fa.fa-tasks
Merge Requests
= nav_link(controller: :milestones) do
- = link_to 'Milestones', project_milestones_path(@project), class: "tab"
+ = link_to project_milestones_path(@project), class: "tab" do
+ %i.fa.fa-clock-o
+ Milestones
= nav_link(controller: :labels) do
- = link_to 'Labels', project_labels_path(@project), class: "tab"
+ = link_to project_labels_path(@project), class: "tab" do
+ %i.fa.fa-tags
+ Labels
+
- if current_controller?(:milestones)
%li.pull-right
diff --git a/app/views/projects/_settings_nav.html.haml b/app/views/projects/_settings_nav.html.haml
index 2008f8c558dc1b2878ce0cb70f77ac1fc8c649e0..64eda0bf28652db771de3ca07bb62f9c677def81 100644
--- a/app/views/projects/_settings_nav.html.haml
+++ b/app/views/projects/_settings_nav.html.haml
@@ -1,25 +1,31 @@
-%ul.nav.nav-pills.nav-stacked.nav-stacked-menu.append-bottom-20.project-settings-nav
+%ul.project-settings-nav.sidebar-subnav
= nav_link(path: 'projects#edit') do
= link_to edit_project_path(@project), class: "stat-tab tab " do
%i.fa.fa-pencil-square-o
- Project
+ %span
+ Project
= nav_link(controller: [:team_members, :teams]) do
= link_to project_team_index_path(@project), class: "team-tab tab" do
%i.fa.fa-users
- Members
+ %span
+ Members
= nav_link(controller: :deploy_keys) do
= link_to project_deploy_keys_path(@project) do
%i.fa.fa-key
- Deploy Keys
+ %span
+ Deploy Keys
= nav_link(controller: :hooks) do
= link_to project_hooks_path(@project) do
%i.fa.fa-link
- Web Hooks
+ %span
+ Web Hooks
= nav_link(controller: :services) do
= link_to project_services_path(@project) do
%i.fa.fa-cogs
- Services
+ %span
+ Services
= nav_link(controller: :protected_branches) do
= link_to project_protected_branches_path(@project) do
%i.fa.fa-lock
- Protected branches
+ %span
+ Protected branches
diff --git a/app/views/projects/_zen.html.haml b/app/views/projects/_zen.html.haml
index 7c6396ca077954c6a4886d91ba19fce47c4e42ac..52a2a1515cee0ed7d70b9a333bbba4be48887e04 100644
--- a/app/views/projects/_zen.html.haml
+++ b/app/views/projects/_zen.html.haml
@@ -1,7 +1,10 @@
.zennable
- %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
+ %input#zen-toggle-comment.zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
.zen-backdrop
- classes << ' js-gfm-input markdown-area'
= f.text_area attr, class: classes, placeholder: 'Leave a comment', dir: :auto
- %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen
- %label{ for: 'zen-toggle-comment', class: 'collapse' }
+ = link_to nil, class: 'zen-enter-link', tabindex: '-1' do
+ %i.fa.fa-expand
+ Edit in fullscreen
+ = link_to nil, class: 'zen-leave-link' do
+ %i.fa.fa-compress
diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml
index 812d88a873087ae886b8881642bea8475864c325..f428ae41ef4184ec5a15fb1eb631adc58e055e9b 100644
--- a/app/views/projects/blob/_actions.html.haml
+++ b/app/views/projects/blob/_actions.html.haml
@@ -1,11 +1,5 @@
.btn-group.tree-btn-group
- -# only show edit link for text files
- - if @blob.text?
- - if allowed_tree_edit?
- = link_to 'Edit', project_edit_tree_path(@project, @id),
- class: 'btn btn-small'
- - else
- %span.btn.btn-small.disabled Edit
+ = edit_blob_link(@project, @ref, @path)
= link_to 'Raw', project_raw_path(@project, @id),
class: 'btn btn-small', target: '_blank'
-# only show normal/blame view links for text files
diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml
index 492dff437b5c118ead3f6a178540e1490b28305e..68f3b08b8c8b4a0a43a45dd728c027b9e63daf3e 100644
--- a/app/views/projects/blob/_blob.html.haml
+++ b/app/views/projects/blob/_blob.html.haml
@@ -16,7 +16,7 @@
= link_to title, '#'
%ul.blob-commit-info.bs-callout.bs-callout-info.hidden-xs
- - blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path)
+ - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path)
= render blob_commit, project: @project
%div#tree-content-holder.tree-content-holder
diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml
index 23e94177ccd6809cdc168aadbde1bbeec5924eb3..ceb7e267c892561aed80a2b1eedf21eb5fa2eeab 100644
--- a/app/views/projects/commits/_commits.html.haml
+++ b/app/views/projects/commits/_commits.html.haml
@@ -1,3 +1,6 @@
+- unless defined?(project)
+ - project = @project
+
- @commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits|
.row.commits-row
.col-md-2
@@ -7,5 +10,5 @@
%p= pluralize(commits.count, 'commit')
.col-md-10
%ul.bordered-list
- = render commits, project: @project
+ = render commits, project: project
%hr.lists-separator
diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml
index 5717c24c27442f16aefe6e84bcaf7ff088cf929e..b80639763c8f04707f0b161e7de9a646687722cc 100644
--- a/app/views/projects/commits/show.html.haml
+++ b/app/views/projects/commits/show.html.haml
@@ -11,11 +11,9 @@
%ul.breadcrumb.repo-breadcrumb
= commits_breadcrumbs
- %li.active
- commits
%div{id: dom_id(@project)}
- #commits-list= render "commits"
+ #commits-list= render "commits", project: @project
.clear
= spinner
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml
index 334ea1ba82fa797e3189e0b13eb3ad4a77f6ade0..48d4c33ce8528bb9ab77eaa05976cdc60ef21502 100644
--- a/app/views/projects/diffs/_diffs.html.haml
+++ b/app/views/projects/diffs/_diffs.html.haml
@@ -2,15 +2,9 @@
.col-md-8
= render 'projects/diffs/stats', diffs: diffs
.col-md-4
- %ul.nav.nav-tabs
- %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''}
- - params_copy = params.dup
- - params_copy[:view] = 'parallel'
- = link_to "Side-by-side Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
- %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''}
- - params_copy[:view] = 'inline'
- = link_to "Inline Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
-
+ .btn-group.pull-right
+ = inline_diff_btn
+ = parallel_diff_btn
- if show_diff_size_warning?(diffs)
= render 'projects/diffs/warning', diffs: diffs
diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml
index bf7770ceedf5e0aca531f9ca42ee79d15f5cd189..0c5f2ad1f3a889f20f65623ade36175235b52f07 100644
--- a/app/views/projects/diffs/_file.html.haml
+++ b/app/views/projects/diffs/_file.html.haml
@@ -4,7 +4,7 @@
.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }}
.diff-header{id: "file-path-#{hexdigest(diff_file.new_path || diff_file.old_path)}"}
- if diff_file.deleted_file
- %span= diff_file.old_path
+ %span="#{diff_file.old_path} deleted"
.diff-btn-group
- if @commit.parent_ids.present?
@@ -30,9 +30,9 @@
- if @merge_request && @merge_request.source_project
- = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff_file.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
- Edit
-
+ = edit_blob_link(@merge_request.source_project,
+ @merge_request.source_branch, diff_file.new_path,
+ after: ' ', from_merge_request_id: @merge_request.id)
= view_file_btn(@commit.id, diff_file, project)
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index e7bd831127231efd0a565bfba287a8c30f1ca5b2..a7897fdae18e6258462d1d11a9e92e040781d4e3 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -136,6 +136,8 @@
.col-sm-9
.form-group
.input-group
+ .input-group-addon
+ #{URI.join(root_url, @project.namespace.path)}/
= f.text_field :path, class: 'form-control'
%span.input-group-addon .git
%ul
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..ec03f375d6b69ab05ea8c42cf6cd8471ce1dd287
--- /dev/null
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -0,0 +1,37 @@
+- content_for :note_actions do
+ - if can?(current_user, :modify_issue, @issue)
+ - if @issue.closed?
+ = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue'
+ - else
+ = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
+.row
+ .col-md-9
+ .participants
+ %cite.cgray
+ = pluralize(@issue.participants.count, 'participant')
+ - @issue.participants.each do |participant|
+ = link_to_member(@project, participant, name: false, size: 24)
+
+ .voting_notes#notes= render "projects/notes/notes_with_form"
+ .col-md-3.hidden-sm.hidden-xs
+ %div
+ .clearfix
+ %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'}
+ = cross_project_reference(@project, @issue)
+ %hr
+ .clearfix
+ .votes-holder
+ %h6 Votes
+ #votes= render 'votes/votes_block', votable: @issue
+ %hr
+ .context
+ %cite.cgray
+ = render partial: 'issue_context', locals: { issue: @issue }
+
+ - if @issue.labels.any?
+ %hr
+ %h6 Labels
+ .issue-show-labels
+ - @issue.labels.each do |label|
+ = link_to project_issues_path(@project, label_name: label.name) do
+ %p= render_colored_label(label)
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index 64a28d8da49c025432c6f1253b65da125cb104fd..2a7b44955cd3276da3ac34b297b5eb991a4ca338 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -1,12 +1,6 @@
%div.issue-form-holder
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
%hr
- - if @repository.exists? && !@repository.empty? && @repository.contribution_guide && !@issue.persisted?
- - contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name))
- .row
- .col-sm-10.col-sm-offset-2
- .alert.alert-info
- = "Please review the #{link_to "guidelines for contribution", contribution_guide_url} to this repository.".html_safe
= form_for [@project, @issue], html: { class: 'form-horizontal issue-form gfm-form' } do |f|
= render 'projects/issuable_form', f: f, issuable: @issue
diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml
index 648f459dc9e975b2ca198016e14a8b628eb91ad8..98777a58f9d7e03872f91007775f57849153ea14 100644
--- a/app/views/projects/issues/_issue_context.html.haml
+++ b/app/views/projects/issues/_issue_context.html.haml
@@ -1,25 +1,24 @@
= form_for [@project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f|
- .row
- .col-sm-6
- %strong.append-right-10
- Assignee:
+ %div.prepend-top-20
+ %p
+ Assignee:
- - if can?(current_user, :modify_issue, @issue)
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id)
- - elsif issue.assignee
- = link_to_member(@project, @issue.assignee)
- - else
- None
+ - if can?(current_user, :modify_issue, @issue)
+ = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id)
+ - elsif issue.assignee
+ = link_to_member(@project, @issue.assignee)
+ - else
+ None
- .col-sm-6.text-right
- %strong.append-right-10
- Milestone:
- - if can?(current_user, :modify_issue, @issue)
- = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
- = hidden_field_tag :issue_context
- = f.submit class: 'btn'
- - elsif issue.milestone
- = link_to project_milestone_path(@project, @issue.milestone) do
- = @issue.milestone.title
- - else
- None
+ %div.prepend-top-20
+ %p
+ Milestone:
+ - if can?(current_user, :modify_issue, @issue)
+ = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
+ = hidden_field_tag :issue_context
+ = f.submit class: 'btn'
+ - elsif issue.milestone
+ = link_to project_milestone_path(@project, @issue.milestone) do
+ = @issue.milestone.title
+ - else
+ None
diff --git a/app/views/projects/issues/_issues.html.haml b/app/views/projects/issues/_issues.html.haml
index 15c84c7ced2bf6e567682a0e8ae611ada679b261..010ca3b68b3b7dc9525d840a66e91b5106d44b0e 100644
--- a/app/views/projects/issues/_issues.html.haml
+++ b/app/views/projects/issues/_issues.html.haml
@@ -1,7 +1,7 @@
.append-bottom-10
.check-all-holder
= check_box_tag "check_all_issues", nil, false, class: "check_all_issues left"
- = render 'projects/issuable_filter'
+ = render 'shared/issuable_filter'
.clearfix
.issues_bulk_update.hide
diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml
index 8db6241f21fb8007ced28e6f5a52db17c11a4a77..0d00d6bfdede55b706a6b662c0fa78b4d9d591d0 100644
--- a/app/views/projects/issues/index.html.haml
+++ b/app/views/projects/issues/index.html.haml
@@ -1,9 +1,4 @@
= render "projects/issues_nav"
-.row
- .fixed.fixed.sidebar-expand-button.hidden-lg.hidden-md.hidden-xs
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- = render 'shared/project_filter', project_entities_path: project_issues_path(@project),
- labels: true, redirect: 'issues', entity: 'issue'
- .col-md-9.issues-holder
- = render "issues"
+
+.issues-holder
+ = render "issues"
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index 7d8e349c6716ba4b8ec998ca3e3c7126b846e5a4..550a7159361c038d0541df223efd8f96684e915b 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -1,7 +1,14 @@
-%h3.page-title
+%h4.page-title
+ .issue-box{ class: issue_box_class(@issue) }
+ - if @issue.closed?
+ Closed
+ - else
+ Open
Issue ##{@issue.iid}
+ %small.creator
+ · created by #{link_to_member(@project, @issue.author)} #{issue_timestamp(@issue)}
- %span.pull-right.issue-btn-group
+ .pull-right
- if can?(current_user, :write_issue, @project)
= link_to new_project_issue_path(@project), class: "btn btn-grouped", title: "New Issue", id: "new_issue_link" do
%i.fa.fa-plus
@@ -12,67 +19,18 @@
- else
= link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close", title: "Close Issue"
- = link_to edit_project_issue_path(@project, @issue), class: "btn btn-grouped" do
+ = link_to edit_project_issue_path(@project, @issue), class: "btn btn-grouped issuable-edit" do
%i.fa.fa-pencil-square-o
Edit
-.clearfix
- .votes-holder
- #votes= render 'votes/votes_block', votable: @issue
-
- .back-link
- = link_to project_issues_path(@project) do
- ← To issues list
- %span.milestone-nav-link
- - if @issue.milestone
- |
- %span.light Milestone
- = link_to project_milestone_path(@project, @issue.milestone), dir: :auto do
- = @issue.milestone.title
-
-.issue-box{ class: issue_box_class(@issue) }
- .state.clearfix
- .state-label
- - if @issue.closed?
- Closed
- - else
- Open
-
- .cross-project-ref
- %i.fa.fa-link.has_tooltip{:"data-original-title" => 'Cross-project reference'}
- = cross_project_reference(@project, @issue)
-
- .creator
- Created by #{link_to_member(@project, @issue.author)} #{issue_timestamp(@issue)}
-
- %h4.title{ dir: :auto }= gfm escape_once(@issue.title)
-
+%hr
+%h3.issue-title{ dir: :auto }= gfm escape_once(@issue.title)
+%div
- if @issue.description.present?
.description
.wiki
= preserve do
= markdown(@issue.description, parse_tasks: true)
- .context
- %cite.cgray
- = render partial: 'issue_context', locals: { issue: @issue }
-
-
-- content_for :note_actions do
- - if can?(current_user, :modify_issue, @issue)
- - if @issue.closed?
- = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue'
- - else
- = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
-
-.participants
- %cite.cgray
- = pluralize(@issue.participants.count, 'participant')
- - @issue.participants.each do |participant|
- = link_to_member(@project, participant, name: false, size: 24)
-
- .issue-show-labels.pull-right
- - @issue.labels.each do |label|
- = link_to project_issues_path(@project, label_name: label.name) do
- = render_colored_label(label)
-.voting_notes#notes= render "projects/notes/notes_with_form"
+%hr
+= render "projects/issues/discussion"
diff --git a/app/views/projects/issues/update.js.haml b/app/views/projects/issues/update.js.haml
index 5199e9fc61f3b05eb0a23e0a2cbfe46024c7a92b..6e50667b084b799a16fa87e6eda4064779aa12a0 100644
--- a/app/views/projects/issues/update.js.haml
+++ b/app/views/projects/issues/update.js.haml
@@ -3,7 +3,7 @@
:plain
$("##{dom_id(@issue)}").fadeOut();
- elsif params[:issue_context]
- $('.issue-box .context').effect('highlight');
+ $('.context').effect('highlight');
- if @issue.milestone
$('.milestone-nav-link').replaceWith("| Milestone #{escape_javascript(link_to @issue.milestone.title, project_milestone_path(@issue.project, @issue.milestone))}")
- else
diff --git a/app/views/projects/merge_requests/_discussion.html.haml b/app/views/projects/merge_requests/_discussion.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..6bb5c46559646d61a35a83ca5ebfa5f52945fd97
--- /dev/null
+++ b/app/views/projects/merge_requests/_discussion.html.haml
@@ -0,0 +1,31 @@
+- content_for :note_actions do
+ - if can?(current_user, :modify_merge_request, @merge_request)
+ - if @merge_request.open?
+ = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request"
+ - if @merge_request.closed?
+ = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request"
+
+.row
+ .col-md-9
+ = render "projects/merge_requests/show/participants"
+ = render "projects/notes/notes_with_form"
+ .col-md-3.hidden-sm.hidden-xs
+ .clearfix
+ %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'}
+ = cross_project_reference(@project, @merge_request)
+ %hr
+ .votes-holder.hidden-sm.hidden-xs
+ %h6 Votes
+ #votes= render 'votes/votes_block', votable: @merge_request
+ %hr
+ .context
+ %cite.cgray
+ = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
+
+ - if @merge_request.labels.any?
+ %hr
+ %h6 Labels
+ .merge-request-show-labels
+ - @merge_request.labels.each do |label|
+ = link_to project_merge_requests_path(@project, label_name: label.name) do
+ %p= render_colored_label(label)
diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml
index 57c7ecbb9271503847d1622e1089e6bb1ceec743..cf66b5f5d995a5aa2364ff91d389291b4c496852 100644
--- a/app/views/projects/merge_requests/_new_submit.html.haml
+++ b/app/views/projects/merge_requests/_new_submit.html.haml
@@ -9,74 +9,103 @@
%span.pull-right
= link_to 'Change branches', new_project_merge_request_path(@project)
-= form_for [@project, @merge_request], html: { class: "merge-request-form gfm-form" } do |f|
- .panel.panel-default
-
- .panel-body
- .form-group
- .light
- = f.label :title do
- Title *
- = f.text_field :title, class: "form-control input-lg js-gfm-input", maxlength: 255, rows: 5, required: true, dir: :auto
- .form-group
- .light
- = f.label :description, "Description"
+= form_for [@project, @merge_request], html: { class: "merge-request-form form-horizontal gfm-form" } do |f|
+ .merge-request-form-info
+ .form-group
+ = f.label :title, class: 'control-label' do
+ %strong Title *
+ .col-sm-10
+ = f.text_field :title, maxlength: 255, autofocus: true, class: 'form-control pad js-gfm-input', required: true, dir: :auto
+ .form-group.issuable-description
+ = f.label :description, 'Description', class: 'control-label'
+ .col-sm-10
= render layout: 'projects/md_preview' do
- = render 'projects/zen', f: f, attr: :description,
- classes: 'description form-control'
- .clearfix.hint
- .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
- .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
+ = render 'projects/zen', f: f, attr: :description, classes: 'description form-control'
+
+ .col-sm-12-hint
+ .pull-left
+ Parsed with
+ #{link_to 'Gitlab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
+ .pull-right
+ Attach images (JPG, PNG, GIF) by dragging & dropping
+ or #{link_to 'selecting them', '#', class: 'markdown-selector'}.
+
+ .clearfix
.error-alert
- .form-group
- .issue-assignee
- = f.label :assignee_id do
- %i.fa.fa-user
- Assign to
- %div
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id)
-
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id do
- %i.fa.fa-clock-o
- Milestone
- %div= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
- .form-group
- = f.label :label_ids do
- %i.fa.fa-tag
- Labels
- %div
- = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, { selected: @merge_request.label_ids }, multiple: true, class: 'select2'
+ %hr
+ .form-group
+ .issue-assignee
+ = f.label :assignee_id, class: 'control-label' do
+ %i.fa.fa-user
+ Assign to
+ .col-sm-10
+ = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id)
+
+ = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
+ .form-group
+ .issue-milestone
+ = f.label :milestone_id, class: 'control-label' do
+ %i.fa.fa-clock-o
+ Milestone
+ .col-sm-10
+ - if milestone_options(@merge_request).present?
+ = f.select(:milestone_id, milestone_options(@merge_request), {include_blank: 'Select milestone'}, {class: 'select2'})
+ - else
+ %span.light No open milestones available.
+
+ - if can? current_user, :admin_milestone, @merge_request.target_project
+ = link_to 'Create new milestone', new_project_milestone_path(@merge_request.target_project), target: :blank
+ .form-group
+ = f.label :label_ids, class: 'control-label' do
+ %i.fa.fa-tag
+ Labels
+ .col-sm-10
+ - if @merge_request.target_project.labels.any?
+ = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, {selected: @merge_request.label_ids}, multiple: true, class: 'select2'
+ - else
+ %span.light No labels yet.
+
+ - if can? current_user, :admin_label, @merge_request.target_project
+ = link_to 'Create new label', new_project_label_path(@merge_request.target_project), target: :blank
- .panel-footer
+ .form-actions
- if contribution_guide_url(@target_project)
%p
Please review the
- %strong #{link_to "guidelines for contribution", contribution_guide_url(@target_project)}
+ %strong #{link_to 'guidelines for contribution', contribution_guide_url(@target_project)}
to this repository.
= f.hidden_field :source_project_id
+ = f.hidden_field :source_branch
= f.hidden_field :target_project_id
= f.hidden_field :target_branch
- = f.hidden_field :source_branch
- = f.submit 'Submit merge request', class: "btn btn-create"
+ = f.submit 'Submit merge request', class: 'btn btn-create'
-.mr-compare
- = render "projects/commits/commit_list"
-
- %h4 Changes
- - if @diffs.present?
- = render "projects/diffs/diffs", diffs: @diffs, project: @project
- - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
- .bs-callout.bs-callout-danger
- %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
- %p To preserve performance the line changes are not shown.
- - else
- .bs-callout.bs-callout-danger
- %h4 This comparison includes huge diff.
- %p To preserve performance the line changes are not shown.
+.mr-compare.merge-request
+ %ul.nav.nav-tabs.merge-request-tabs
+ %li.commits-tab{data: {action: 'commits'}}
+ = link_to url_for(params) do
+ %i.fa.fa-history
+ Commits
+ %span.badge= @commits.size
+ %li.diffs-tab{data: {action: 'diffs'}}
+ = link_to url_for(params) do
+ %i.fa.fa-list-alt
+ Changes
+ %span.badge= @diffs.size
+ .commits.tab-content
+ = render "projects/commits/commits", project: @project
+ .diffs.tab-content
+ - if @diffs.present?
+ = render "projects/diffs/diffs", diffs: @diffs, project: @project
+ - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
+ .bs-callout.bs-callout-danger
+ %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
+ %p To preserve performance the line changes are not shown.
+ - else
+ .bs-callout.bs-callout-danger
+ %h4 This comparison includes a huge diff.
+ %p To preserve performance the line changes are not shown.
:javascript
$('.assign-to-me-link').on('click', function(e){
@@ -85,3 +114,9 @@
});
window.project_image_path_upload = "#{upload_image_project_path @project}";
+
+:javascript
+ var merge_request
+ merge_request = new MergeRequest({
+ action: 'commits'
+ });
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 7b28dd5e7da5c5770712786026788cd2de201987..8e31a7e3fe4a0992cf28fa826b594bfd12cf5cc9 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -1,39 +1,68 @@
-.merge-request
+.merge-request{'data-url' => project_merge_request_path(@project, @merge_request)}
= render "projects/merge_requests/show/mr_title"
- = render "projects/merge_requests/show/how_to_merge"
+ %hr
= render "projects/merge_requests/show/mr_box"
+ %hr
+ .append-bottom-20
+ .slead
+ %span From
+ - if @merge_request.for_fork?
+ %strong.label-branch<
+ - if @merge_request.source_project
+ = link_to @merge_request.source_project_namespace, project_path(@merge_request.source_project)
+ - else
+ \ #{@merge_request.source_project_namespace}
+ \:#{@merge_request.source_branch}
+ %span into
+ %strong.label-branch #{@merge_request.target_project_namespace}:#{@merge_request.target_branch}
+ - else
+ %strong.label-branch #{@merge_request.source_branch}
+ %span into
+ %strong.label-branch #{@merge_request.target_branch}
+ - if @merge_request.open?
+ %span.pull-right
+ .btn-group
+ %a.btn.dropdown-toggle{ data: {toggle: :dropdown} }
+ %i.fa.fa-download
+ Download as
+ %span.caret
+ %ul.dropdown-menu
+ %li= link_to "Email Patches", project_merge_request_path(@project, @merge_request, format: :patch)
+ %li= link_to "Plain Diff", project_merge_request_path(@project, @merge_request, format: :diff)
+
+ = render "projects/merge_requests/show/how_to_merge"
= render "projects/merge_requests/show/state_widget"
- = render "projects/merge_requests/show/commits"
- = render "projects/merge_requests/show/participants"
- if @commits.present?
- %ul.nav.nav-pills.merge-request-tabs
+ %ul.nav.nav-tabs.merge-request-tabs
%li.notes-tab{data: {action: 'notes'}}
= link_to project_merge_request_path(@project, @merge_request) do
- %i.fa.fa-comment
+ %i.fa.fa-comments
Discussion
%span.badge= @merge_request.mr_and_commit_notes.count
+ %li.commits-tab{data: {action: 'commits'}}
+ = link_to project_merge_request_path(@project, @merge_request), title: 'Commits' do
+ %i.fa.fa-history
+ Commits
+ %span.badge= @commits.size
%li.diffs-tab{data: {action: 'diffs'}}
= link_to diffs_project_merge_request_path(@project, @merge_request) do
%i.fa.fa-list-alt
Changes
%span.badge= @merge_request.diffs.size
- - content_for :note_actions do
- - if can?(current_user, :modify_merge_request, @merge_request)
- - if @merge_request.open?
- = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request"
- - if @merge_request.closed?
- = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request"
-
+ .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" }
+ = render "projects/merge_requests/discussion"
+ .commits.tab-content
+ = render "projects/merge_requests/show/commits"
.diffs.tab-content
- if current_page?(action: 'diffs')
= render "projects/merge_requests/show/diffs"
- .notes.tab-content.voting_notes#notes{ class: (controller.action_name == 'show') ? "" : "hide" }
- = render "projects/notes/notes_with_form"
+
.mr-loading-status
= spinner
+
:javascript
var merge_request;
diff --git a/app/views/projects/merge_requests/automerge.js.haml b/app/views/projects/merge_requests/automerge.js.haml
index e01ff662e7db95a19aa7f9ec4d043f8d17e903a3..a53cbb150a41fc7f5e3a004c86496127789406da 100644
--- a/app/views/projects/merge_requests/automerge.js.haml
+++ b/app/views/projects/merge_requests/automerge.js.haml
@@ -1,7 +1,6 @@
-if @status
:plain
- location.reload();
+ merge_request.mergeInProgress();
-else
:plain
merge_request.alreadyOrCannotBeMerged()
-
diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml
index b93e0f9da3e424a0962a63cc9d32a7b00e84547f..2654ea709908db89bbc2e9d79348f7b63221f729 100644
--- a/app/views/projects/merge_requests/index.html.haml
+++ b/app/views/projects/merge_requests/index.html.haml
@@ -1,23 +1,19 @@
= render "projects/issues_nav"
-.row
- .col-md-3.responsive-side
- = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project),
- labels: true, redirect: 'merge_requests', entity: 'merge_request'
- .col-md-9
- .append-bottom-10
- = render 'projects/issuable_filter'
- .panel.panel-default
- %ul.well-list.mr-list
- = render @merge_requests
- - if @merge_requests.blank?
- %li
- .nothing-here-block No merge requests to show
- - if @merge_requests.present?
- .pull-right
- %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter
+.merge-requests-holder
+ .append-bottom-10
+ = render 'shared/issuable_filter'
+ .panel.panel-default
+ %ul.well-list.mr-list
+ = render @merge_requests
+ - if @merge_requests.blank?
+ %li
+ .nothing-here-block No merge requests to show
+ - if @merge_requests.present?
+ .pull-right
+ %span.cgray.pull-right #{@merge_requests.total_count} merge requests for this filter
- = paginate @merge_requests, theme: "gitlab"
+ = paginate @merge_requests, theme: "gitlab"
:javascript
$(merge_requestsPage);
diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml
index a658740387114515ed851b1c51e5aa0622b04701..3b7f283daf0468774e60114d0c3490d26c71cefc 100644
--- a/app/views/projects/merge_requests/show/_commits.html.haml
+++ b/app/views/projects/merge_requests/show/_commits.html.haml
@@ -1,30 +1 @@
-- if @commits.present?
- .panel.panel-default
- .panel-heading
- %i.fa.fa-list
- Commits (#{@commits.count})
- .commits.mr-commits
- - if @commits.count > 8
- %ul.first-commits.well-list
- - @commits.first(8).each do |commit|
- = render "projects/commits/commit", commit: commit, project: @merge_request.source_project
- %li.bottom
- 8 of #{@commits.count} commits displayed.
- %strong
- %a.show-all-commits Click here to show all
- - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
- %ul.all-commits.hide.well-list
- - @commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE).each do |commit|
- = render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
- %li
- other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues.
- - else
- %ul.all-commits.hide.well-list
- - @commits.each do |commit|
- = render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
-
- - else
- %ul.well-list
- - @commits.each do |commit|
- = render "projects/commits/commit", commit: commit, project: @merge_request.source_project
-
+= render "projects/commits/commits", project: @merge_request.source_project
diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml
index 089302e358828261cff70975820760bc2c8afb4f..5b6e64f06573bf2a057e04eade0823c98894d3c2 100644
--- a/app/views/projects/merge_requests/show/_context.html.haml
+++ b/app/views/projects/merge_requests/show/_context.html.haml
@@ -1,24 +1,23 @@
= form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f|
- .row
- .col-sm-6
- %strong.append-right-10
- Assignee:
+ %div.prepend-top-20
+ %p
+ Assignee:
- - if can?(current_user, :modify_merge_request, @merge_request)
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id)
- - elsif merge_request.assignee
- = link_to_member(@project, @merge_request.assignee)
- - else
- None
+ - if can?(current_user, :modify_merge_request, @merge_request)
+ = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id)
+ - elsif merge_request.assignee
+ = link_to_member(@project, @merge_request.assignee)
+ - else
+ None
- .col-sm-6.text-right
- %strong.append-right-10
- Milestone:
- - if can?(current_user, :modify_merge_request, @merge_request)
- = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
- = hidden_field_tag :merge_request_context
- = f.submit class: 'btn'
- - elsif merge_request.milestone
- = link_to merge_request.milestone.title, project_milestone_path
- - else
- None
+ %div.prepend-top-20
+ %p
+ Milestone:
+ - if can?(current_user, :modify_merge_request, @merge_request)
+ = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
+ = hidden_field_tag :merge_request_context
+ = f.submit class: 'btn'
+ - elsif merge_request.milestone
+ = link_to merge_request.milestone.title, project_milestone_path
+ - else
+ None
diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml
index 4939ae039944c7cf93f30222721f51fbc4fbcd4f..11a111e5faa4182c0eb1d84759d960c09d6dda08 100644
--- a/app/views/projects/merge_requests/show/_mr_accept.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml
@@ -13,25 +13,22 @@
.automerge_widget.can_be_merged.hide
.clearfix
= form_for [:automerge, @project, @merge_request], remote: true, method: :post do |f|
- %h4
- You can accept this request automatically.
- .accept-merge-holder.clearfix
- .accept-group
- .pull-left
- = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
- - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
- .remove_branch_holder.pull-left
- = label_tag :should_remove_source_branch, class: "checkbox" do
- = check_box_tag :should_remove_source_branch
- Remove source-branch
- .js-toggle-container
- %label
- %i.fa.fa-edit
- = link_to "modify merge commit message", "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message"
- .js-toggle-content.hide
- = render 'shared/commit_message_container', params: params,
- text: @merge_request.merge_commit_message,
- rows: 14, hint: true
+ .accept-merge-holder.clearfix.js-toggle-container
+ .accept-action
+ = f.submit "Accept Merge Request", class: "btn btn-create accept_merge_request"
+ - if can_remove_branch?(@merge_request.source_project, @merge_request.source_branch) && !@merge_request.for_fork?
+ .accept-control
+ = label_tag :should_remove_source_branch, class: "remove_source_checkbox" do
+ = check_box_tag :should_remove_source_branch
+ Remove source-branch
+ .accept-control
+ = link_to "#", class: "modify-merge-commit-link js-toggle-button", title: "Modify merge commit message" do
+ %i.fa.fa-edit
+ Modify commit message
+ .js-toggle-content.hide.prepend-top-20
+ = render 'shared/commit_message_container', params: params,
+ text: @merge_request.merge_commit_message,
+ rows: 14, hint: true
%hr
.light
diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml
index ca3c815635e039d8e80e669daea8e6bc44b4345d..2aca59f7b0bec184ab0878394ba3d9a5eea318c2 100644
--- a/app/views/projects/merge_requests/show/_mr_box.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_box.html.haml
@@ -1,29 +1,9 @@
-.issue-box{ class: issue_box_class(@merge_request) }
- .state.clearfix
- .state-label
- - if @merge_request.merged?
- Merged
- - elsif @merge_request.closed?
- Closed
- - else
- Open
-
- .cross-project-ref
- %i.fa.fa-link.has_tooltip{:"data-original-title" => 'Cross-project reference'}
- = cross_project_reference(@project, @merge_request)
-
- .creator
- Created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)}
-
- %h4.title{ dir: 'auto' }
- = gfm escape_once(@merge_request.title)
+%h3.issue-title{ dir: 'auto' }
+ = gfm escape_once(@merge_request.title)
+%div
- if @merge_request.description.present?
.description
.wiki
= preserve do
%span{ dir: 'auto' }= markdown(@merge_request.description, parse_tasks: true)
-
- .context
- %cite.cgray
- = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml
index 417d082cc58ce06bc6de63b2da9ef575e56e2513..0f20eba382c069caad8d6e0b26937c2286e74327 100644
--- a/app/views/projects/merge_requests/show/_mr_title.html.haml
+++ b/app/views/projects/merge_requests/show/_mr_title.html.haml
@@ -1,45 +1,22 @@
-%h3.page-title
+%h4.page-title
+ .issue-box{ class: issue_box_class(@merge_request) }
+ - if @merge_request.merged?
+ Merged
+ - elsif @merge_request.closed?
+ Closed
+ - else
+ Open
= "Merge Request ##{@merge_request.iid}"
+ %small.creator
+ ·
+ created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)}
- %span.pull-right.issue-btn-group
+ .issue-btn-group.pull-right
- if can?(current_user, :modify_merge_request, @merge_request)
- if @merge_request.open?
- .btn-group.pull-left
- %a.btn.btn-grouped.dropdown-toggle{ data: {toggle: :dropdown} }
- %i.fa.fa-download
- Download as
- %span.caret
- %ul.dropdown-menu
- %li= link_to "Email Patches", project_merge_request_path(@project, @merge_request, format: :patch)
- %li= link_to "Plain Diff", project_merge_request_path(@project, @merge_request, format: :diff)
-
= link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: { state_event: :close }), method: :put, class: "btn btn-grouped btn-close", title: "Close merge request"
-
- = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn btn-grouped", id:"edit_merge_request" do
+ = link_to edit_project_merge_request_path(@project, @merge_request), class: "btn btn-grouped issuable-edit", id: "edit_merge_request" do
%i.fa.fa-pencil-square-o
Edit
- if @merge_request.closed?
= link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link", title: "Close merge request"
-
-.votes-holder.hidden-sm.hidden-xs
- #votes= render 'votes/votes_block', votable: @merge_request
-
-.back-link
- = link_to project_merge_requests_path(@project) do
- ← To merge requests
-
- %span.prepend-left-20
- %span From
- - if @merge_request.for_fork?
- %strong.label-branch{ dir: :auto }<
- - if @merge_request.source_project
- = link_to @merge_request.source_project_namespace, project_path(@merge_request.source_project)
- - else
- \ #{@merge_request.source_project_namespace}
- \:#{@merge_request.source_branch}
- %span into
- %strong.label-branch{ dir: :auto } #{@merge_request.target_project_namespace}:#{@merge_request.target_branch}
- - else
- %strong.label-branch{ dir: :auto } #{@merge_request.source_branch}
- %span into
- %strong.label-branch{ dir: :auto } #{@merge_request.target_branch}
diff --git a/app/views/projects/merge_requests/show/_participants.html.haml b/app/views/projects/merge_requests/show/_participants.html.haml
index b709c89cec255e17e710b5aa1915fad1d3a64b99..15a97404cb0b7bb6fbb6e4bc1cf2ac873bb215c8 100644
--- a/app/views/projects/merge_requests/show/_participants.html.haml
+++ b/app/views/projects/merge_requests/show/_participants.html.haml
@@ -2,8 +2,3 @@
%cite.cgray #{@merge_request.participants.count} participants
- @merge_request.participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24)
-
- .merge-request-show-labels.pull-right
- - @merge_request.labels.each do |label|
- = link_to project_merge_requests_path(@project, label_name: label.name) do
- = render_colored_label(label)
diff --git a/app/views/projects/merge_requests/update.js.haml b/app/views/projects/merge_requests/update.js.haml
index 6452cc6382dbddaf31c9a107037770ab7bfae499..6f4c5dd7a3b2d162d2d4ee4bdc32419c828937c3 100644
--- a/app/views/projects/merge_requests/update.js.haml
+++ b/app/views/projects/merge_requests/update.js.haml
@@ -1,2 +1,2 @@
- if params[:merge_request_context]
- $('.issue-box .context').effect('highlight');
+ $('.context').effect('highlight');
diff --git a/app/views/projects/milestones/index.html.haml b/app/views/projects/milestones/index.html.haml
index 0db0b114d635e7b2e762dddbf252836644b02d8b..04a1b9243d51da5c94ad59c4424c02aa98fd85f2 100644
--- a/app/views/projects/milestones/index.html.haml
+++ b/app/views/projects/milestones/index.html.haml
@@ -7,27 +7,15 @@
%i.fa.fa-plus
New Milestone
- .row
- .fixed.sidebar-expand-button.hidden-lg.hidden-md.hidden-xs
- %i.fa.fa-list.fa-2x
- .col-md-3.responsive-side
- %ul.nav.nav-pills.nav-stacked
- %li{class: ("active" if (params[:f] == "active" || !params[:f]))}
- = link_to project_milestones_path(@project, f: "active") do
- Active
- %li{class: ("active" if params[:f] == "closed")}
- = link_to project_milestones_path(@project, f: "closed") do
- Closed
- %li{class: ("active" if params[:f] == "all")}
- = link_to project_milestones_path(@project, f: "all") do
- All
- .col-md-9
- .panel.panel-default
- %ul.well-list
- = render @milestones
+= render 'shared/milestones_filter'
- - if @milestones.blank?
- %li
- .nothing-here-block No milestones to show
+.milestones
+ .panel.panel-default
+ %ul.well-list
+ = render @milestones
- = paginate @milestones, theme: "gitlab"
+ - if @milestones.blank?
+ %li
+ .nothing-here-block No milestones to show
+
+ = paginate @milestones, theme: "gitlab"
diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml
index 8d923269035c895288190db4349011fbfac62ed7..cbde07f0b8b4d1c5908c1ea31dca09cc1029e11e 100644
--- a/app/views/projects/milestones/show.html.haml
+++ b/app/views/projects/milestones/show.html.haml
@@ -1,6 +1,15 @@
= render "projects/issues_nav"
-%h3.page-title
+%h4.page-title
+ .issue-box{ class: issue_box_class(@milestone) }
+ - if @milestone.closed?
+ Closed
+ - elsif @milestone.expired?
+ Expired
+ - else
+ Open
Milestone ##{@milestone.iid}
+ %small.creator
+ = @milestone.expires_at
.pull-right
- if can?(current_user, :admin_milestone, @project)
= link_to edit_project_milestone_path(@project, @milestone), class: "btn btn-grouped" do
@@ -11,47 +20,32 @@
- else
= link_to 'Reopen Milestone', project_milestone_path(@project, @milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-reopen btn-grouped"
+%hr
- if @milestone.issues.any? && @milestone.can_be_closed?
.alert.alert-success
%span All issues for this milestone are closed. You may close milestone now.
-.back-link
- = link_to project_milestones_path(@project) do
- ← To milestones list
-
-
-.issue-box{ class: issue_box_class(@milestone) }
- .state.clearfix
- .state-label
- - if @milestone.closed?
- Closed
- - elsif @milestone.expired?
- Expired
- - else
- Open
- .creator
- = @milestone.expires_at
-
- %h4.title{ dir: :auto }
- = gfm escape_once(@milestone.title)
-
+%h3.issue-title{ dir: :auto }
+ = gfm escape_once(@milestone.title)
+%div
- if @milestone.description.present?
.description
.wiki
= preserve do
= markdown @milestone.description
- .context
- %p
- Progress:
- #{@milestone.closed_items_count} closed
- –
- #{@milestone.open_items_count} open
-
- %span.light #{@milestone.percent_complete}% complete
- %span.pull-right= @milestone.expires_at
- .progress.progress-info
- .progress-bar{style: "width: #{@milestone.percent_complete}%;"}
+%hr
+.context
+ %p.lead
+ Progress:
+ #{@milestone.closed_items_count} closed
+ –
+ #{@milestone.open_items_count} open
+
+ %span.light #{@milestone.percent_complete}% complete
+ %span.pull-right= @milestone.expires_at
+ .progress.progress-info
+ .progress-bar{style: "width: #{@milestone.percent_complete}%;"}
%ul.nav.nav-tabs
@@ -69,10 +63,10 @@
%span.badge= @users.count
.pull-right
- = link_to new_project_issue_path(@project, issue: { milestone_id: @milestone.id }), class: "btn btn-small btn-grouped", title: "New Issue" do
+ = link_to new_project_issue_path(@project, issue: { milestone_id: @milestone.id }), class: "btn btn-grouped", title: "New Issue" do
%i.fa.fa-plus
New Issue
- = link_to 'Browse Issues', project_issues_path(@milestone.project, milestone_id: @milestone.id), class: "btn btn-small edit-milestone-link btn-grouped"
+ = link_to 'Browse Issues', project_issues_path(@milestone.project, milestone_id: @milestone.id), class: "btn edit-milestone-link btn-grouped"
.tab-content
.tab-pane.active#tab-issues
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index f5110085be2c25d5a2c9b14073479cf087fbd6e2..a70a8fa725430a4774fa512e1a9d0380cc27f63c 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -5,10 +5,13 @@
= form_for @project, html: { class: 'new_project form-horizontal' } do |f|
.form-group.project-name-holder
- = f.label :name, class: 'control-label' do
- %strong Project name
+ = f.label :path, class: 'control-label' do
+ %strong Project path
.col-sm-10
- = f.text_field :name, placeholder: "Example Project", class: "form-control", tabindex: 1, autofocus: true, dir: 'auto'
+ .input-group
+ = f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 1, autofocus: true, dir: :auto
+ .input-group-addon
+ \.git
- if current_user.can_select_namespace?
.form-group
@@ -18,29 +21,13 @@
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2}
%hr
- .js-toggle-container
- .form-group
- .col-sm-2
- .col-sm-10
- = link_to "#", class: 'js-toggle-button' do
- %i.fa.fa-pencil-square-o
- %span Customize repository name?
- .js-toggle-content.hide
- .form-group
- = f.label :path, class: 'control-label' do
- %span Repository name
- .col-sm-10
- .input-group
- = f.text_field :path, class: 'form-control', dir: 'auto'
- %span.input-group-addon .git
-
.js-toggle-container
.form-group
.col-sm-2
.col-sm-10
= link_to "#", class: 'js-toggle-button' do
%i.fa.fa-upload
- %span Import existing repository?
+ %span Import existing repository by URL
.js-toggle-content.hide
.form-group.import-url-data
= f.label :import_url, class: 'control-label' do
@@ -52,7 +39,21 @@
%br
The import will time out after 4 minutes. For big repositories, use a clone/push combination.
For SVN repositories, check #{link_to "this migrating from SVN doc.", "http://doc.gitlab.com/ce/workflow/migrating_from_svn.html"}
- %hr
+
+ .project-import.form-group
+ .col-sm-2
+ .col-sm-10
+ - if github_import_enabled?
+ = link_to status_github_import_path do
+ %i.fa.fa-github
+ Import projects from GitHub
+ - else
+ = link_to '#', class: 'how_to_import_link light' do
+ %i.fa.fa-github
+ Import projects from GitHub
+ = render 'github_import_modal'
+
+ %hr.prepend-botton-10
.form-group
= f.label :description, class: 'control-label' do
diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..59e2b3f1b0bd6026ecbac44b8965ecef0706fc17
--- /dev/null
+++ b/app/views/projects/notes/_edit_form.html.haml
@@ -0,0 +1,22 @@
+.note-edit-form
+ = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
+ = render layout: 'projects/md_preview' do
+ = render 'projects/zen', f: f, attr: :note,
+ classes: 'note_text js-note-text'
+
+ .comment-hints.clearfix
+ .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }}
+ .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }.
+
+ .note-form-actions
+ .buttons
+ = f.submit 'Save Comment', class: "btn btn-primary btn-save btn-grouped js-comment-button"
+ = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
+
+ .note-form-option.hidden-xs
+ %a.choose-btn.btn.js-choose-note-attachment-button
+ %i.fa.fa-paperclip
+ %span Choose File ...
+
+ %span.file_name.js-attachment-filename
+ = f.file_field :attachment, class: "js-note-attachment-input hidden"
diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml
index 5c43b037527b76ce7883ff15f2d8cce4cb60d650..1671c35864e17e81216bf165f1e2f039c5783426 100644
--- a/app/views/projects/notes/_form.html.haml
+++ b/app/views/projects/notes/_form.html.haml
@@ -7,8 +7,9 @@
= render layout: 'projects/md_preview' do
= render 'projects/zen', f: f, attr: :note,
- classes: 'note_text js-note-text', dir: :auto
- .light.clearfix
+ classes: 'note_text js-note-text', dir: :auto
+
+ .comment-hints.clearfix
.pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }}
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }.
@@ -24,7 +25,7 @@
%i.fa.fa-paperclip
%span Choose File ...
- %span.file_name.js-attachment-filename File name...
+ %span.file_name.js-attachment-filename
= f.file_field :attachment, class: "js-note-attachment-input hidden"
:javascript
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index df21242463b64f9ad60be91416c64cb2dc8107e1..8c55fa89de87d4431308748634daae3f2823a460 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -1,7 +1,10 @@
-%li.timeline-entry{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
+%li.timeline-entry{ id: dom_id(note), class: [dom_class(note), "note-row-#{note.id}", ('system-note' if note.system)], data: { discussion: note.discussion_id } }
.timeline-entry-inner
.timeline-icon
- = image_tag avatar_icon(note.author_email), class: "avatar s40"
+ - if note.system
+ %span.fa.fa-circle
+ - else
+ = image_tag avatar_icon(note.author_email), class: "avatar s40"
.timeline-content
.note-header
.note-actions
@@ -17,6 +20,8 @@
= link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
%i.fa.fa-trash-o.cred
Remove
+ - if note.system
+ = image_tag avatar_icon(note.author_email), class: "avatar s16"
= link_to_member(@project, note.author, avatar: false)
%span.author-username
= '@' + note.author.username
@@ -37,25 +42,7 @@
.note-text{ dir: 'auto' }
= preserve do
= markdown(note.note, {no_header_anchors: true})
-
- .note-edit-form
- = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
- = render layout: 'projects/md_preview' do
- = f.text_area :note, class: 'note_text js-note-text markdown-area js-gfm-input turn-on', dir: :auto
-
- .form-actions.clearfix
- = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
-
- .note-form-option
- %a.choose-btn.btn.js-choose-note-attachment-button
- %i.fa.fa-paperclip
- %span Choose File ...
-
- %span.file_name.js-attachment-filename File name...
- = f.file_field :attachment, class: "js-note-attachment-input hidden"
-
- = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
-
+ = render 'projects/notes/edit_form', note: note
- if note.attachment.url
.note-attachment
diff --git a/app/views/projects/protected_branches/_branches_list.html.haml b/app/views/projects/protected_branches/_branches_list.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..e422799f55c4363e4c2f8c7d080522a418eb8046
--- /dev/null
+++ b/app/views/projects/protected_branches/_branches_list.html.haml
@@ -0,0 +1,34 @@
+- unless @branches.empty?
+ %br
+ %h4 Already Protected:
+ %table.table.protected-branches-list
+ %thead
+ %tr.no-border
+ %th Branch
+ %th Developers can push
+ %th Last commit
+ %th
+
+ %tbody
+ - @branches.each do |branch|
+ - @url = project_protected_branch_path(@project, branch)
+ %tr
+ %td
+ = link_to project_commits_path(@project, branch.name) do
+ %strong= branch.name
+ - if @project.root_ref?(branch.name)
+ %span.label.label-info default
+ %td
+ = check_box_tag "developers_can_push", branch.id, branch.developers_can_push, "data-url" => @url
+ %td
+ - if commit = branch.commit
+ = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
+ = commit.short_id
+ ·
+ #{time_ago_with_tooltip(commit.committed_date)}
+ - else
+ (branch was removed from repository)
+ %td
+ .pull-right
+ - if can? current_user, :admin_project, @project
+ = link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small"
diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml
index 227a2f9a0619e4a7983f4d442ad7da80571e65d7..2164c874c74b92a3a5db984e100794d1585f9eb6 100644
--- a/app/views/projects/protected_branches/index.html.haml
+++ b/app/views/projects/protected_branches/index.html.haml
@@ -22,29 +22,14 @@
= f.label :name, "Branch", class: 'control-label'
.col-sm-10
= f.select(:name, @project.open_branches.map { |br| [br.name, br.name] } , {include_blank: "Select branch"}, {class: "select2"})
+ .form-group
+ = f.label :developers_can_push, class: 'control-label' do
+ Developers can push
+ .col-sm-10
+ .checkbox
+ = f.check_box :developers_can_push
+ %span.descr Allow developers to push to this branch
.form-actions
= f.submit 'Protect', class: "btn-create btn"
-- unless @branches.empty?
- %h5 Already Protected:
- %ul.bordered-list.protected-branches-list
- - @branches.each do |branch|
- %li
- %h4
- = link_to project_commits_path(@project, branch.name) do
- %strong= branch.name
- - if @project.root_ref?(branch.name)
- %span.label.label-info default
- %span.label.label-success
- %i.fa.fa-lock
- .pull-right
- - if can? current_user, :admin_project, @project
- = link_to 'Unprotect', [@project, branch], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-remove btn-small"
+= render 'branches_list'
- - if commit = branch.commit
- = link_to project_commit_path(@project, commit.id), class: 'commit_short_id' do
- = commit.short_id
- %span.light
- = gfm escape_once(truncate(commit.title, length: 40))
- #{time_ago_with_tooltip(commit.committed_date)}
- - else
- (branch was removed from repository)
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 1d205e72519de4f7c90cc1471c311dd518c059cc..1f34879acbd8a07f579d3658ff2872c5fc15e6dd 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -1,3 +1,6 @@
+- if current_user && can?(current_user, :download_code, @project)
+ = render 'shared/no_ssh'
+
= render "home_panel"
- readme = @repository.readme
diff --git a/app/views/projects/transfer.js.haml b/app/views/projects/transfer.js.haml
index 10b0de98c041494e71a612aa79396214566b29f9..6d083c5c5169bcacfb847a76bc9ecf9c1334b04b 100644
--- a/app/views/projects/transfer.js.haml
+++ b/app/views/projects/transfer.js.haml
@@ -1,7 +1,2 @@
-- if @project.errors[:namespace_id].present?
- :plain
- $("#tab-transfer .errors-holder").replaceWith(errorMessage('#{escape_javascript(@project.errors[:namespace_id].first)}'));
- $("#tab-transfer .form-actions input").removeAttr('disabled').removeClass('disabled');
-- else
- :plain
+:plain
location.href = "#{edit_project_path(@project)}";
diff --git a/app/views/projects/tree/_tree_item.html.haml b/app/views/projects/tree/_tree_item.html.haml
index f8cecf9be1f14daba52a4c2b708e8410031e4213..5adbf93ff8f6226376130cd39df528cf33cd683b 100644
--- a/app/views/projects/tree/_tree_item.html.haml
+++ b/app/views/projects/tree/_tree_item.html.haml
@@ -2,7 +2,8 @@
%td.tree-item-file-name
= tree_icon(type)
%span.str-truncated
- = link_to tree_item.name, project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
+ - path = flatten_tree(tree_item)
+ = link_to path, project_tree_path(@project, tree_join(@id || @commit.id, path))
%td.tree_time_ago.cgray
= render 'spinner'
%td.hidden-xs.tree_commit
diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml
index f9330ec98ae0b609661a0e3596231c38e93e4036..2cf4ac854f9ac4088aee2f832ba4cc62f69c5c9d 100644
--- a/app/views/projects/wikis/_form.html.haml
+++ b/app/views/projects/wikis/_form.html.haml
@@ -19,13 +19,15 @@
%code [Link Title](page-slug)
\.
- .form-group
+ .form-group.wiki-content
= f.label :content, class: 'control-label'
.col-sm-10
- = render 'projects/zen', f: f, attr: :content, classes: 'description form-control'
- .col-sm-12.hint
- .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
- .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
+ = render layout: 'projects/md_preview' do
+ = render 'projects/zen', f: f, attr: :content, classes: 'description form-control'
+ .col-sm-12.hint
+ .pull-left Wiki content is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}
+ .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
+
.clearfix
.error-alert
.form-group
diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml
index 1668ed423a1c8b720d0e749b07a2e58760b03c84..245e9cbbd830d1ec769bf13f27e185e0a61d470b 100644
--- a/app/views/projects/wikis/history.html.haml
+++ b/app/views/projects/wikis/history.html.haml
@@ -12,11 +12,12 @@
%th Last updated
%th Format
%tbody
- - @page.versions.each do |version|
+ - @page.versions.each_with_index do |version, index|
- commit = version
%tr
%td
- = link_to project_wiki_path(@project, @page, version_id: commit.id) do
+ = link_to project_wiki_path_with_version(@project, @page,
+ commit.id, index == 0) do
= truncate_sha(commit.id)
%td{ dir: :auto }
= commit.author.name
diff --git a/app/views/shared/_event_filter.html.haml b/app/views/shared/_event_filter.html.haml
index ee0b57fbe5afc2f3a7d9eb71cc51e044bfdf1368..d07a9e2b92468860f9b77d3345b27dc6fff5e97c 100644
--- a/app/views/shared/_event_filter.html.haml
+++ b/app/views/shared/_event_filter.html.haml
@@ -1,5 +1,19 @@
-.event_filter
+%ul.nav.nav-pills.event_filter
= event_filter_link EventFilter.push, 'Push events'
= event_filter_link EventFilter.merged, 'Merge events'
= event_filter_link EventFilter.comments, 'Comments'
= event_filter_link EventFilter.team, 'Team'
+
+ - if current_user
+ - if current_controller?(:dashboard)
+ %li.pull-right
+ = link_to dashboard_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do
+ %i.fa.fa-rss
+ News Feed
+
+ - if current_controller?(:groups)
+ %li.pull-right
+ = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed", class: 'rss-btn' do
+ %i.fa.fa-rss
+ News Feed
+%hr
diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml
deleted file mode 100644
index d366dd97a71b4a4cce80977f18e219d1e2ba12e3..0000000000000000000000000000000000000000
--- a/app/views/shared/_filter.html.haml
+++ /dev/null
@@ -1,50 +0,0 @@
-.side-filters
- = form_tag filter_path(entity), method: 'get' do
- - if current_user
- %fieldset.scope-filter
- %ul.nav.nav-pills.nav-stacked
- %li{class: ("active" if params[:scope] == 'assigned-to-me')}
- = link_to filter_path(entity, scope: 'assigned-to-me') do
- Assigned to me
- %span.pull-right
- = assigned_entities_count(current_user, entity, @group)
- %li{class: ("active" if params[:scope] == 'authored')}
- = link_to filter_path(entity, scope: 'authored') do
- Created by me
- %span.pull-right
- = authored_entities_count(current_user, entity, @group)
- %li{class: ("active" if params[:scope] == 'all')}
- = link_to filter_path(entity, scope: 'all') do
- Everyone's
- %span.pull-right
- = authorized_entities_count(current_user, entity, @group)
-
- %fieldset.status-filter
- %legend State
- %ul.nav.nav-pills
- %li{class: ("active" if params[:state] == 'opened')}
- = link_to filter_path(entity, state: 'opened') do
- Open
- %li{class: ("active" if params[:state] == 'closed')}
- = link_to filter_path(entity, state: 'closed') do
- Closed
- %li{class: ("active" if params[:state] == 'all')}
- = link_to filter_path(entity, state: 'all') do
- All
-
- %fieldset
- %legend Projects
- %ul.nav.nav-pills.nav-stacked.nav-small
- - @projects.each do |project|
- - unless entities_per_project(project, entity).zero?
- %li{class: ("active" if params[:project_id] == project.id.to_s)}
- = link_to filter_path(entity, project_id: project.id) do
- = project.name_with_namespace
- %small.pull-right= entities_per_project(project, entity)
-
- %fieldset
- - if params[:state].present? || params[:project_id].present?
- = link_to filter_path(entity, state: nil, project_id: nil), class: 'pull-right cgray' do
- %i.fa.fa-times
- %strong Clear filter
-
diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml
index 1b5bc8ee144b367726eecb5674785a1328238bf6..0cd70c9dbdbb717b0cba2554e4d039c1670f8fb9 100644
--- a/app/views/shared/_group_form.html.haml
+++ b/app/views/shared/_group_form.html.haml
@@ -1,9 +1,26 @@
+- if @group.persisted?
+ .form-group
+ = f.label :name, class: 'control-label' do
+ Group name
+ .col-sm-10
+ = f.text_field :name, placeholder: 'open-source', class: 'form-control'
+
.form-group
- = f.label :name, class: 'control-label' do
- Group name
+ = f.label :path, class: 'control-label' do
+ Group path
.col-sm-10
- = f.text_field :name, placeholder: 'Example Group', class: 'form-control',
- autofocus: local_assigns[:autofocus] || false, dir: :auto
+ .input-group
+ .input-group-addon
+ = root_url
+ = f.text_field :path, placeholder: 'open-source', class: 'form-control',
+ autofocus: local_assigns[:autofocus] || false, dir: :auto
+ - if @group.persisted?
+ .bs-callout.bs-callout-danger
+ %ul
+ %li Changing group path can have unintended side effects.
+ %li Renaming group path will rename directory for all related projects
+ %li It will change web url for access group and group projects.
+ %li It will change the git path to repositories under this group.
.form-group.group-description-holder
= f.label :description, 'Details', class: 'control-label'
diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..4f683258facdfa6e94e208e15ef24a8f8c4e270d
--- /dev/null
+++ b/app/views/shared/_issuable_filter.html.haml
@@ -0,0 +1,112 @@
+.issues-filters
+ .pull-left.append-right-20
+ %ul.nav.nav-pills.nav-compact
+ %li{class: ("active" if params[:state] == 'opened')}
+ = link_to page_filter_path(state: 'opened') do
+ %i.fa.fa-exclamation-circle
+ Open
+ %li{class: ("active" if params[:state] == 'closed')}
+ = link_to page_filter_path(state: 'closed') do
+ %i.fa.fa-check-circle
+ Closed
+ %li{class: ("active" if params[:state] == 'all')}
+ = link_to page_filter_path(state: 'all') do
+ %i.fa.fa-compass
+ All
+
+ .dropdown.inline.assignee-filter
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-user
+ %span.light assignee:
+ - if @assignee.present?
+ %strong= @assignee.name
+ - elsif params[:assignee_id] == "0"
+ Unassigned
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to page_filter_path(assignee_id: nil) do
+ Any
+ = link_to page_filter_path(assignee_id: 0) do
+ Unassigned
+ - @assignees.sort_by(&:name).each do |user|
+ %li
+ = link_to page_filter_path(assignee_id: user.id) do
+ = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
+ = user.name
+
+ .dropdown.inline.prepend-left-10.author-filter
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-user
+ %span.light author:
+ - if @author.present?
+ %strong= @author.name
+ - elsif params[:author_id] == "0"
+ Unassigned
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to page_filter_path(author_id: nil) do
+ Any
+ = link_to page_filter_path(author_id: 0) do
+ Unassigned
+ - @authors.sort_by(&:name).each do |user|
+ %li
+ = link_to page_filter_path(author_id: user.id) do
+ = image_tag avatar_icon(user.email), class: "avatar s16", alt: ''
+ = user.name
+
+ .dropdown.inline.prepend-left-10.milestone-filter
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-clock-o
+ %span.light milestone:
+ - if @milestone.present?
+ %strong= @milestone.title
+ - elsif params[:milestone_id] == "0"
+ None (backlog)
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to page_filter_path(milestone_id: nil) do
+ Any
+ = link_to page_filter_path(milestone_id: 0) do
+ None (backlog)
+ - @milestones.each do |milestone|
+ %li
+ = link_to page_filter_path(milestone_id: milestone.id) do
+ %strong= milestone.title
+ %small.light= milestone.expires_at
+
+ - if @project
+ .dropdown.inline.prepend-left-10.labels-filter
+ %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
+ %i.fa.fa-tags
+ %span.light label:
+ - if params[:label_name].present?
+ %strong= params[:label_name]
+ - else
+ Any
+ %b.caret
+ %ul.dropdown-menu
+ %li
+ = link_to page_filter_path(label_name: nil) do
+ Any
+ - if @project.labels.any?
+ - @project.labels.order_by_name.each do |label|
+ %li
+ = link_to page_filter_path(label_name: label.name) do
+ = render_colored_label(label)
+ - else
+ %li
+ = link_to generate_project_labels_path(@project, redirect: request.original_url), method: :post do
+ %i.fa.fa-plus-circle
+ Create default labels
+
+ .pull-right
+ = render 'shared/sort_dropdown'
diff --git a/app/views/shared/_milestones_filter.html.haml b/app/views/shared/_milestones_filter.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..8c2fd16692258103ee4dcb3ffb8cf4e42398aa87
--- /dev/null
+++ b/app/views/shared/_milestones_filter.html.haml
@@ -0,0 +1,16 @@
+.fixed.sidebar-expand-button.hidden-lg.hidden-md
+ %i.fa.fa-list.fa-2x
+.responsive-side.milestones-filters.append-bottom-10
+ %ul.nav.nav-pills.nav-compact
+ %li{class: ("active" if params[:state].blank? || params[:state] == 'opened')}
+ = link_to milestones_filter_path(state: 'opened') do
+ %i.fa.fa-exclamation-circle
+ Open
+ %li{class: ("active" if params[:state] == 'closed')}
+ = link_to milestones_filter_path(state: 'closed') do
+ %i.fa.fa-check-circle
+ Closed
+ %li{class: ("active" if params[:state] == 'all')}
+ = link_to milestones_filter_path(state: 'all') do
+ %i.fa.fa-compass
+ All
diff --git a/app/views/shared/_no_ssh.html.haml b/app/views/shared/_no_ssh.html.haml
index e70eb4d01b99e7d6b6fb6dfa2194ba9432ea9af0..8e6f802fd3b1a8e0d0a15caf05ab68420156a45c 100644
--- a/app/views/shared/_no_ssh.html.haml
+++ b/app/views/shared/_no_ssh.html.haml
@@ -1,14 +1,8 @@
- if cookies[:hide_no_ssh_message].blank? && current_user.require_ssh_key? && !current_user.hide_no_ssh_key
- .no-ssh-key-message
- .container
- You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_profile_key_path} to your profile
- .pull-right.hidden-xs
- = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put, class: 'hide-no-ssh-message', remote: true
- |
- = link_to 'Remind later', '#', class: 'hide-no-ssh-message'
- .links-xs.visible-xs
- = link_to "Add key", new_profile_key_path
- |
- = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put, class: 'hide-no-ssh-message', remote: true
- |
- = link_to 'Later', '#', class: 'hide-no-ssh-message'
+ .no-ssh-key-message.alert.alert-warning.hidden-xs
+ You won't be able to pull or push project code via SSH until you #{link_to 'add an SSH key', new_profile_key_path} to your profile
+
+ .pull-right
+ = link_to "Don't show again", profile_path(user: {hide_no_ssh_key: true}), method: :put
+ |
+ = link_to 'Remind later', '#', class: 'hide-no-ssh-message'
diff --git a/app/views/shared/_outdated_browser.html.haml b/app/views/shared/_outdated_browser.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..0eba1fe075f35762dbe37f0bae29c77dbfe02db7
--- /dev/null
+++ b/app/views/shared/_outdated_browser.html.haml
@@ -0,0 +1,8 @@
+- if outdated_browser?
+ - link = "https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/requirements.md#supported-web-browsers"
+ .browser-alert
+ GitLab may not work properly because you are using an outdated web browser.
+ %br
+ Please install a
+ = link_to 'supported web browser', link
+ for a better experience.
diff --git a/app/views/shared/_project_filter.html.haml b/app/views/shared/_project_filter.html.haml
deleted file mode 100644
index ea6a49e1501e38b6b3dddb2d6223bcb3034f0a9a..0000000000000000000000000000000000000000
--- a/app/views/shared/_project_filter.html.haml
+++ /dev/null
@@ -1,64 +0,0 @@
-.side-filters
- = form_tag project_entities_path, method: 'get' do
- - if current_user
- %fieldset
- %ul.nav.nav-pills.nav-stacked
- %li{class: ("active" if params[:scope] == 'all')}
- = link_to project_filter_path(scope: 'all') do
- Everyone's
- %span.pull-right
- = authorized_entities_count(current_user, entity, @project)
- %li{class: ("active" if params[:scope] == 'assigned-to-me')}
- = link_to project_filter_path(scope: 'assigned-to-me') do
- Assigned to me
- %span.pull-right
- = assigned_entities_count(current_user, entity, @project)
- %li{class: ("active" if params[:scope] == 'created-by-me')}
- = link_to project_filter_path(scope: 'created-by-me') do
- Created by me
- %span.pull-right
- = authored_entities_count(current_user, entity, @project)
-
- %fieldset
- %legend State
- %ul.nav.nav-pills
- %li{class: ("active" if params[:state] == 'opened')}
- = link_to project_filter_path(state: 'opened') do
- Open
- %li{class: ("active" if params[:state] == 'closed')}
- = link_to project_filter_path(state: 'closed') do
- Closed
- %li{class: ("active" if params[:state] == 'all')}
- = link_to project_filter_path(state: 'all') do
- All
-
- - if defined?(labels)
- %fieldset
- %legend
- Labels
- %small.pull-right
- = link_to project_labels_path(@project), class: 'light' do
- %i.fa.fa-pencil-square-o
- %ul.nav.nav-pills.nav-stacked.nav-small.labels-filter
- - @project.labels.order_by_name.each do |label|
- %li{class: label_filter_class(label.name)}
- = link_to labels_filter_path(label.name) do
- = render_colored_label(label)
- - if selected_label?(label.name)
- .pull-right
- %i.fa.fa-times
-
- - if @project.labels.empty?
- .light-well
- Create first label at
- = link_to 'labels page', project_labels_path(@project)
- %br
- or #{link_to 'generate', generate_project_labels_path(@project, redirect: redirect), method: :post} default set of labels
-
- %fieldset
- - if %w(state scope milestone_id assignee_id label_name).select { |k| params[k].present? }.any?
- = link_to project_entities_path, class: 'cgray pull-right' do
- %i.fa.fa-times
- %strong Clear filter
-
-
diff --git a/app/views/shared/_sort_dropdown.html.haml b/app/views/shared/_sort_dropdown.html.haml
index 54f592456905ebe4851cd359fd11b6015960b7ee..93ed9b67336d1591e03ff816f5f1f253aa19d7e2 100644
--- a/app/views/shared/_sort_dropdown.html.haml
+++ b/app/views/shared/_sort_dropdown.html.haml
@@ -8,15 +8,15 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to project_filter_path(sort: 'newest') do
+ = link_to page_filter_path(sort: 'newest') do
= sort_title_recently_created
- = link_to project_filter_path(sort: 'oldest') do
+ = link_to page_filter_path(sort: 'oldest') do
= sort_title_oldest_created
- = link_to project_filter_path(sort: 'recently_updated') do
+ = link_to page_filter_path(sort: 'recently_updated') do
= sort_title_recently_updated
- = link_to project_filter_path(sort: 'last_updated') do
+ = link_to page_filter_path(sort: 'last_updated') do
= sort_title_oldest_updated
- = link_to project_filter_path(sort: 'milestone_due_soon') do
+ = link_to page_filter_path(sort: 'milestone_due_soon') do
Milestone due soon
- = link_to project_filter_path(sort: 'milestone_due_later') do
+ = link_to page_filter_path(sort: 'milestone_due_later') do
Milestone due later
diff --git a/app/views/users/show.atom.builder b/app/views/users/show.atom.builder
index b7216a88765f4c44a78e1b801274c4bfbcd3c831..8fe30b23635fd58e414485a3a3510c36b135effe 100644
--- a/app/views/users/show.atom.builder
+++ b/app/views/users/show.atom.builder
@@ -1,5 +1,5 @@
xml.instruct!
-xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlnsmedia" => "http://search.yahoo.com/mrss/" do
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Activity feed for #{@user.name}"
xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml"
xml.link href: user_url(@user), rel: "alternate", type: "text/html"
diff --git a/app/workers/auto_merge_worker.rb b/app/workers/auto_merge_worker.rb
new file mode 100644
index 0000000000000000000000000000000000000000..a6dd73eee5f81c8cff509d63b2294c0b05ae26a0
--- /dev/null
+++ b/app/workers/auto_merge_worker.rb
@@ -0,0 +1,13 @@
+class AutoMergeWorker
+ include Sidekiq::Worker
+
+ sidekiq_options queue: :default
+
+ def perform(merge_request_id, current_user_id, params)
+ params = params.with_indifferent_access
+ current_user = User.find(current_user_id)
+ merge_request = MergeRequest.find(merge_request_id)
+ merge_request.should_remove_source_branch = params[:should_remove_source_branch]
+ merge_request.automerge!(current_user, params[:commit_message])
+ end
+end
diff --git a/app/workers/project_service_worker.rb b/app/workers/project_service_worker.rb
index cc0a7f25664ec28fbd017411b498b260932c66a3..64d39c4d3f7ef436cb4ee49e2a2d4d9a5a5ee72a 100644
--- a/app/workers/project_service_worker.rb
+++ b/app/workers/project_service_worker.rb
@@ -4,6 +4,7 @@ class ProjectServiceWorker
sidekiq_options queue: :project_web_hook
def perform(hook_id, data)
+ data = data.with_indifferent_access
Service.find(hook_id).execute(data)
end
end
diff --git a/app/workers/project_web_hook_worker.rb b/app/workers/project_web_hook_worker.rb
index 9f9b9b1df5f672249af8397439d2c3eccc2f25c2..73085c046bd6ab50ab3183a7178ab196939f3ad9 100644
--- a/app/workers/project_web_hook_worker.rb
+++ b/app/workers/project_web_hook_worker.rb
@@ -4,6 +4,7 @@ class ProjectWebHookWorker
sidekiq_options queue: :project_web_hook
def perform(hook_id, data)
- WebHook.find(hook_id).execute data
+ data = data.with_indifferent_access
+ WebHook.find(hook_id).execute(data)
end
end
diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb
index 01586150cd2c2974b0db6a473a0f6c8276dc6be7..0bcc42bc62c8d9781556814b503841552eab4950 100644
--- a/app/workers/repository_import_worker.rb
+++ b/app/workers/repository_import_worker.rb
@@ -10,7 +10,13 @@ class RepositoryImportWorker
project.path_with_namespace,
project.import_url)
- if result
+ if project.import_type == 'github'
+ result_of_data_import = Gitlab::Github::Importer.new(project).execute
+ else
+ result_of_data_import = true
+ end
+
+ if result && result_of_data_import
project.import_finish
project.save
project.satellite.create unless project.satellite.exists?
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index 7b4c180fccc3781633cacaba8ce9d4933d6d730a..5d801b9ae5b566697bf06f49d1e72411773596ba 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -298,6 +298,20 @@ production: &base
# 
# [Learn more about CompanyName](http://www.companydomain.com/)
+ rack_attack:
+ git_basic_auth:
+ # Whitelist requests from 127.0.0.1 for web proxies (NGINX/Apache) with incorrect headers
+ # ip_whitelist: ["127.0.0.1"]
+ #
+ # Limit the number of Git HTTP authentication attempts per IP
+ # maxretry: 10
+ #
+ # Reset the auth attempt counter per IP after 60 seconds
+ # findtime: 60
+ #
+ # Ban an IP for one hour (3600s) after too many auth attempts
+ # bantime: 3600
+
development:
<<: *base
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 27bb83784bab38955381647d98fcc6afdbc3ebf9..cdb958aa6a6de1f6383d83b46777c3625c41e6af 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -105,7 +105,7 @@ rescue ArgumentError # no user configured
'/home/' + Settings.gitlab['user']
end
Settings.gitlab['time_zone'] ||= nil
-Settings.gitlab['signup_enabled'] ||= false
+Settings.gitlab['signup_enabled'] ||= true if Settings.gitlab['signup_enabled'].nil?
Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].nil?
Settings.gitlab['restricted_visibility_levels'] = Settings.send(:verify_constant_array, Gitlab::VisibilityLevel, Settings.gitlab['restricted_visibility_levels'], [])
Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil?
@@ -171,6 +171,16 @@ Settings.satellites['timeout'] ||= 30
#
Settings['extra'] ||= Settingslogic.new({})
+#
+# Rack::Attack settings
+#
+Settings['rack_attack'] ||= Settingslogic.new({})
+Settings.rack_attack['git_basic_auth'] ||= Settingslogic.new({})
+Settings.rack_attack.git_basic_auth['ip_whitelist'] ||= %w{127.0.0.1}
+Settings.rack_attack.git_basic_auth['maxretry'] ||= 10
+Settings.rack_attack.git_basic_auth['findtime'] ||= 1.minute
+Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
+
#
# Testing settings
#
diff --git a/config/initializers/6_rack_profiler.rb b/config/initializers/6_rack_profiler.rb
index a7ee3c59822ea30fe44c47ca0ac211f5b465544b..b634028756925661e59683bd908b5140275504ef 100644
--- a/config/initializers/6_rack_profiler.rb
+++ b/config/initializers/6_rack_profiler.rb
@@ -3,4 +3,6 @@ if Rails.env == 'development'
# initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
+ Rack::MiniProfiler.config.position = 'right'
+ Rack::MiniProfiler.config.start_hidden = true
end
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
new file mode 100644
index 0000000000000000000000000000000000000000..4819ab273dce27e2568a634d19a6acbc3fbe1dec
--- /dev/null
+++ b/config/initializers/doorkeeper.rb
@@ -0,0 +1,102 @@
+Doorkeeper.configure do
+ # Change the ORM that doorkeeper will use.
+ # Currently supported options are :active_record, :mongoid2, :mongoid3, :mongo_mapper
+ orm :active_record
+
+ # This block will be called to check whether the resource owner is authenticated or not.
+ resource_owner_authenticator do
+ # Put your resource owner authentication logic here.
+ # Example implementation:
+ current_user || redirect_to(new_user_session_url)
+ end
+
+ resource_owner_from_credentials do |routes|
+ u = User.find_by(email: params[:username])
+ u if u && u.valid_password?(params[:password])
+ end
+
+ # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
+ # admin_authenticator do
+ # # Put your admin authentication logic here.
+ # # Example implementation:
+ # Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
+ # end
+
+ # Authorization Code expiration time (default 10 minutes).
+ # authorization_code_expires_in 10.minutes
+
+ # Access token expiration time (default 2 hours).
+ # If you want to disable expiration, set this to nil.
+ # access_token_expires_in 2.hours
+
+ # Reuse access token for the same resource owner within an application (disabled by default)
+ # Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
+ # reuse_access_token
+
+ # Issue access tokens with refresh token (disabled by default)
+ use_refresh_token
+
+ # Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
+ # by default in non-development environments). OAuth2 delegates security in
+ # communication to the HTTPS protocol so it is wise to keep this enabled.
+ #
+ force_ssl_in_redirect_uri false
+
+ # Provide support for an owner to be assigned to each registered application (disabled by default)
+ # Optional parameter :confirmation => true (default false) if you want to enforce ownership of
+ # a registered application
+ # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
+ enable_application_owner :confirmation => false
+
+ # Define access token scopes for your provider
+ # For more information go to
+ # https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
+ default_scopes :api
+ #optional_scopes :write, :update
+
+ # Change the way client credentials are retrieved from the request object.
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
+ # falls back to the `:client_id` and `:client_secret` params from the `params` object.
+ # Check out the wiki for more information on customization
+ # client_credentials :from_basic, :from_params
+
+ # Change the way access token is authenticated from the request object.
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
+ # falls back to the `:access_token` or `:bearer_token` params from the `params` object.
+ # Check out the wiki for more information on customization
+ access_token_methods :from_access_token_param, :from_bearer_authorization, :from_bearer_param
+
+ # Change the native redirect uri for client apps
+ # When clients register with the following redirect uri, they won't be redirected to any server and the authorization code will be displayed within the provider
+ # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
+ # (Similar behaviour: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi)
+ #
+ native_redirect_uri nil#'urn:ietf:wg:oauth:2.0:oob'
+
+ # Specify what grant flows are enabled in array of Strings. The valid
+ # strings and the flows they enable are:
+ #
+ # "authorization_code" => Authorization Code Grant Flow
+ # "implicit" => Implicit Grant Flow
+ # "password" => Resource Owner Password Credentials Grant Flow
+ # "client_credentials" => Client Credentials Grant Flow
+ #
+ # If not specified, Doorkeeper enables all the four grant flows.
+ #
+ # grant_flows %w(authorization_code implicit password client_credentials)
+
+ # Under some circumstances you might want to have applications auto-approved,
+ # so that the user skips the authorization step.
+ # For example if dealing with trusted a application.
+ # skip_authorization do |resource_owner, client|
+ # client.superapp? or resource_owner.admin?
+ # end
+
+ # WWW-Authenticate Realm (default "Doorkeeper").
+ # realm "Doorkeeper"
+
+ # Allow dynamic query parameters (disabled by default)
+ # Some applications require dynamic query parameters on their request_uri
+ # set to true if you want this to be allowed
+ # wildcard_redirect_uri false
+end
diff --git a/config/initializers/rack_attack_git_basic_auth.rb b/config/initializers/rack_attack_git_basic_auth.rb
new file mode 100644
index 0000000000000000000000000000000000000000..bbbfed6832923cb41e94d2defe0af74843bf77a4
--- /dev/null
+++ b/config/initializers/rack_attack_git_basic_auth.rb
@@ -0,0 +1,12 @@
+unless Rails.env.test?
+ # Tell the Rack::Attack Rack middleware to maintain an IP blacklist. We will
+ # update the blacklist from Grack::Auth#authenticate_user.
+ Rack::Attack.blacklist('Git HTTP Basic Auth') do |req|
+ Rack::Attack::Allow2Ban.filter(req.ip, Gitlab.config.rack_attack.git_basic_auth) do
+ # This block only gets run if the IP was not already banned.
+ # Return false, meaning that we do not see anything wrong with the
+ # request at this time
+ false
+ end
+ end
+end
diff --git a/config/initializers/redis-store-fix-expiry.rb b/config/initializers/redis-store-fix-expiry.rb
new file mode 100644
index 0000000000000000000000000000000000000000..fce0a13533012e92babfbb1dca780ad3b84932ff
--- /dev/null
+++ b/config/initializers/redis-store-fix-expiry.rb
@@ -0,0 +1,44 @@
+# Monkey-patch Redis::Store to make 'setex' and 'expire' work with namespacing
+
+module Gitlab
+ class Redis
+ class Store
+ module Namespace
+ # Redis::Store#setex in redis-store 1.1.4 does not respect namespaces;
+ # this new method does.
+ def setex(key, expires_in, value, options=nil)
+ namespace(key) { |key| super(key, expires_in, value) }
+ end
+
+ # Redis::Store#expire in redis-store 1.1.4 does not respect namespaces;
+ # this new method does.
+ def expire(key, expires_in)
+ namespace(key) { |key| super(key, expires_in) }
+ end
+
+ private
+
+ # Our new definitions of #setex and #expire above assume that the
+ # #namespace method exists. Because we cannot be sure of that, we
+ # re-implement the #namespace method from Redis::Store::Namespace so
+ # that it is available for all Redis::Store instances, whether they use
+ # namespacing or not.
+ #
+ # Based on lib/redis/store/namespace.rb L49-51 (redis-store 1.1.4)
+ def namespace(key)
+ if @namespace
+ yield interpolate(key)
+ else
+ # This Redis::Store instance does not use a namespace so we should
+ # just pass through the key.
+ yield key
+ end
+ end
+ end
+ end
+ end
+end
+
+Redis::Store.class_eval do
+ include Gitlab::Redis::Store::Namespace
+end
diff --git a/config/locales/doorkeeper.en.yml b/config/locales/doorkeeper.en.yml
new file mode 100644
index 0000000000000000000000000000000000000000..c5b6b75e7f6408f07c0b7cd387dfd0675f29341c
--- /dev/null
+++ b/config/locales/doorkeeper.en.yml
@@ -0,0 +1,73 @@
+en:
+ activerecord:
+ errors:
+ models:
+ application:
+ attributes:
+ redirect_uri:
+ fragment_present: 'cannot contain a fragment.'
+ invalid_uri: 'must be a valid URI.'
+ relative_uri: 'must be an absolute URI.'
+ mongoid:
+ errors:
+ models:
+ application:
+ attributes:
+ redirect_uri:
+ fragment_present: 'cannot contain a fragment.'
+ invalid_uri: 'must be a valid URI.'
+ relative_uri: 'must be an absolute URI.'
+ mongo_mapper:
+ errors:
+ models:
+ application:
+ attributes:
+ redirect_uri:
+ fragment_present: 'cannot contain a fragment.'
+ invalid_uri: 'must be a valid URI.'
+ relative_uri: 'must be an absolute URI.'
+ doorkeeper:
+ errors:
+ messages:
+ # Common error messages
+ invalid_request: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
+ invalid_redirect_uri: 'The redirect uri included is not valid.'
+ unauthorized_client: 'The client is not authorized to perform this request using this method.'
+ access_denied: 'The resource owner or authorization server denied the request.'
+ invalid_scope: 'The requested scope is invalid, unknown, or malformed.'
+ server_error: 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.'
+ temporarily_unavailable: 'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server.'
+
+ #configuration error messages
+ credential_flow_not_configured: 'Resource Owner Password Credentials flow failed due to Doorkeeper.configure.resource_owner_from_credentials being unconfigured.'
+ resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being unconfiged.'
+
+ # Access grant errors
+ unsupported_response_type: 'The authorization server does not support this response type.'
+
+ # Access token errors
+ invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
+ invalid_grant: 'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.'
+ unsupported_grant_type: 'The authorization grant type is not supported by the authorization server.'
+
+ # Password Access token errors
+ invalid_resource_owner: 'The provided resource owner credentials are not valid, or resource owner cannot be found'
+
+ invalid_token:
+ revoked: "The access token was revoked"
+ expired: "The access token expired"
+ unknown: "The access token is invalid"
+ scopes:
+ api: Access your API
+
+ flash:
+ applications:
+ create:
+ notice: 'Application created.'
+ destroy:
+ notice: 'Application deleted.'
+ update:
+ notice: 'Application updated.'
+ authorized_applications:
+ destroy:
+ notice: 'Application revoked.'
diff --git a/config/routes.rb b/config/routes.rb
index 533e044ca4cbd5bc3bc3b85548973efb2f5f16f5..3f561309adb84a10a4b5261a415bc72cd22362ab 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,6 +2,11 @@ require 'sidekiq/web'
require 'api/api'
Gitlab::Application.routes.draw do
+ use_doorkeeper do
+ controllers :applications => 'oauth/applications',
+ :authorized_applications => 'oauth/authorized_applications',
+ :authorizations => 'oauth/authorizations'
+ end
#
# Search
#
@@ -46,6 +51,14 @@ Gitlab::Application.routes.draw do
end
get "/s/:username" => "snippets#user_index", as: :user_snippets, constraints: { username: /.*/ }
+ #
+ # Github importer area
+ #
+ resource :github_import, only: [:create, :new] do
+ get :status
+ get :callback
+ end
+
#
# Explroe area
#
@@ -75,6 +88,7 @@ Gitlab::Application.routes.draw do
#
namespace :admin do
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
+ resources :keys, only: [:show, :destroy]
member do
put :team_update
put :block
@@ -83,6 +97,8 @@ Gitlab::Application.routes.draw do
end
end
+ resources :applications
+
resources :groups, constraints: { id: /[^\/]+/ } do
member do
put :project_teams_update
@@ -103,6 +119,8 @@ Gitlab::Application.routes.draw do
end
end
+ resource :application_settings, only: [:show, :update]
+
root to: "dashboard#index"
end
@@ -113,6 +131,7 @@ Gitlab::Application.routes.draw do
member do
get :history
get :design
+ get :applications
put :reset_private_token
put :update_username
@@ -197,6 +216,7 @@ Gitlab::Application.routes.draw do
resources :raw, only: [:show], constraints: {id: /.+/}
resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
resources :edit_tree, only: [:show, :update], constraints: { id: /.+/ }, path: 'edit' do
+ # Cannot be GET to differentiate from GET paths that end in preview.
post :preview, on: :member
end
resources :new_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'new'
@@ -211,7 +231,8 @@ Gitlab::Application.routes.draw do
end
end
- match "/compare/:from...:to" => "compare#show", as: "compare", via: [:get, :post], constraints: {from: /.+/, to: /.+/}
+ get '/compare/:from...:to' => 'compare#show', :as => 'compare',
+ :constraints => {from: /.+/, to: /.+/}
resources :snippets, constraints: {id: /\d+/} do
member do
@@ -255,7 +276,7 @@ Gitlab::Application.routes.draw do
resources :branches, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
resources :tags, only: [:index, :new, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
- resources :protected_branches, only: [:index, :create, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
+ resources :protected_branches, only: [:index, :create, :update, :destroy], constraints: { id: Gitlab::Regex.git_reference_regex }
resources :refs, only: [] do
collection do
diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/05_users.rb
index c263dd232aff567c190df99999bd71f12bc46bc9..b697f58d4ef2a0524c8aba4de0fa11f92b2746b8 100644
--- a/db/fixtures/development/05_users.rb
+++ b/db/fixtures/development/05_users.rb
@@ -16,14 +16,13 @@ Gitlab::Seeder.quiet do
(1..5).each do |i|
begin
- User.seed(:id, [
- id: i + 10,
- username: "user#{i}",
- name: "User #{i}",
- email: "user#{i}@example.com",
- confirmed_at: DateTime.now,
- password: '12345678'
- ])
+ User.seed do |s|
+ s.username = "user#{i}"
+ s.name = "User #{i}"
+ s.email = "user#{i}@example.com"
+ s.confirmed_at = DateTime.now
+ s.password = '12345678'
+ end
print '.'
rescue ActiveRecord::RecordNotSaved
print 'F'
diff --git a/db/migrate/20141216155758_create_doorkeeper_tables.rb b/db/migrate/20141216155758_create_doorkeeper_tables.rb
new file mode 100644
index 0000000000000000000000000000000000000000..af5aa7d8b734be6a2d240074aefb0d26c54e4203
--- /dev/null
+++ b/db/migrate/20141216155758_create_doorkeeper_tables.rb
@@ -0,0 +1,42 @@
+class CreateDoorkeeperTables < ActiveRecord::Migration
+ def change
+ create_table :oauth_applications do |t|
+ t.string :name, null: false
+ t.string :uid, null: false
+ t.string :secret, null: false
+ t.text :redirect_uri, null: false
+ t.string :scopes, null: false, default: ''
+ t.timestamps
+ end
+
+ add_index :oauth_applications, :uid, unique: true
+
+ create_table :oauth_access_grants do |t|
+ t.integer :resource_owner_id, null: false
+ t.integer :application_id, null: false
+ t.string :token, null: false
+ t.integer :expires_in, null: false
+ t.text :redirect_uri, null: false
+ t.datetime :created_at, null: false
+ t.datetime :revoked_at
+ t.string :scopes
+ end
+
+ add_index :oauth_access_grants, :token, unique: true
+
+ create_table :oauth_access_tokens do |t|
+ t.integer :resource_owner_id
+ t.integer :application_id
+ t.string :token, null: false
+ t.string :refresh_token
+ t.integer :expires_in
+ t.datetime :revoked_at
+ t.datetime :created_at, null: false
+ t.string :scopes
+ end
+
+ add_index :oauth_access_tokens, :token, unique: true
+ add_index :oauth_access_tokens, :resource_owner_id
+ add_index :oauth_access_tokens, :refresh_token, unique: true
+ end
+end
diff --git a/db/migrate/20141217125223_add_owner_to_application.rb b/db/migrate/20141217125223_add_owner_to_application.rb
new file mode 100644
index 0000000000000000000000000000000000000000..7d5e6d07d0f21ae50a08ceb958b2f9ddbb1dc8c5
--- /dev/null
+++ b/db/migrate/20141217125223_add_owner_to_application.rb
@@ -0,0 +1,7 @@
+class AddOwnerToApplication < ActiveRecord::Migration
+ def change
+ add_column :oauth_applications, :owner_id, :integer, null: true
+ add_column :oauth_applications, :owner_type, :string, null: true
+ add_index :oauth_applications, [:owner_id, :owner_type]
+ end
+end
\ No newline at end of file
diff --git a/db/migrate/20141223135007_add_import_data_to_project_table.rb b/db/migrate/20141223135007_add_import_data_to_project_table.rb
new file mode 100644
index 0000000000000000000000000000000000000000..5db78f94cc978c3a06511aa76ff6ccd9339bf58a
--- /dev/null
+++ b/db/migrate/20141223135007_add_import_data_to_project_table.rb
@@ -0,0 +1,8 @@
+class AddImportDataToProjectTable < ActiveRecord::Migration
+ def change
+ add_column :projects, :import_type, :string
+ add_column :projects, :import_source, :string
+
+ add_column :users, :github_access_token, :string
+ end
+end
diff --git a/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb
new file mode 100644
index 0000000000000000000000000000000000000000..70e7272f7f3f8640de1240bfdeb7f4d09133529f
--- /dev/null
+++ b/db/migrate/20141226080412_add_developers_can_push_to_protected_branches.rb
@@ -0,0 +1,5 @@
+class AddDevelopersCanPushToProtectedBranches < ActiveRecord::Migration
+ def change
+ add_column :protected_branches, :developers_can_push, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20150108073740_create_application_settings.rb b/db/migrate/20150108073740_create_application_settings.rb
new file mode 100644
index 0000000000000000000000000000000000000000..651e35fdf7a9eca8021f8c5cf4c6dd442f7058c1
--- /dev/null
+++ b/db/migrate/20150108073740_create_application_settings.rb
@@ -0,0 +1,13 @@
+class CreateApplicationSettings < ActiveRecord::Migration
+ def change
+ create_table :application_settings do |t|
+ t.integer :default_projects_limit
+ t.boolean :signup_enabled
+ t.boolean :signin_enabled
+ t.boolean :gravatar_enabled
+ t.text :sign_in_text
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb
new file mode 100644
index 0000000000000000000000000000000000000000..aa179ce3a4d29ec0ff236cb74a4c219afb47701e
--- /dev/null
+++ b/db/migrate/20150116234544_add_home_page_url_for_application_settings.rb
@@ -0,0 +1,5 @@
+class AddHomePageUrlForApplicationSettings < ActiveRecord::Migration
+ def change
+ add_column :application_settings, :home_page_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 003222bc8757201f2b73333bad47ee3239d38ad6..b453164d712a4bad8ce53b9c619a9a02e97aff05 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,11 +11,22 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20141205134006) do
+ActiveRecord::Schema.define(version: 20150116234544) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
+ create_table "application_settings", force: true do |t|
+ t.integer "default_projects_limit"
+ t.boolean "signup_enabled"
+ t.boolean "signin_enabled"
+ t.boolean "gravatar_enabled"
+ t.text "sign_in_text"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "home_page_url"
+ end
+
create_table "broadcast_messages", force: true do |t|
t.text "message", null: false
t.datetime "starts_at"
@@ -249,6 +260,49 @@ ActiveRecord::Schema.define(version: 20141205134006) do
add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree
add_index "notes", ["updated_at"], name: "index_notes_on_updated_at", using: :btree
+ create_table "oauth_access_grants", force: true do |t|
+ t.integer "resource_owner_id", null: false
+ t.integer "application_id", null: false
+ t.string "token", null: false
+ t.integer "expires_in", null: false
+ t.text "redirect_uri", null: false
+ t.datetime "created_at", null: false
+ t.datetime "revoked_at"
+ t.string "scopes"
+ end
+
+ add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
+
+ create_table "oauth_access_tokens", force: true do |t|
+ t.integer "resource_owner_id"
+ t.integer "application_id"
+ t.string "token", null: false
+ t.string "refresh_token"
+ t.integer "expires_in"
+ t.datetime "revoked_at"
+ t.datetime "created_at", null: false
+ t.string "scopes"
+ end
+
+ add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
+ add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
+ add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
+
+ create_table "oauth_applications", force: true do |t|
+ t.string "name", null: false
+ t.string "uid", null: false
+ t.string "secret", null: false
+ t.text "redirect_uri", null: false
+ t.string "scopes", default: "", null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "owner_id"
+ t.string "owner_type"
+ end
+
+ add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree
+ add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
+
create_table "projects", force: true do |t|
t.string "name"
t.string "path"
@@ -271,6 +325,8 @@ ActiveRecord::Schema.define(version: 20141205134006) do
t.string "import_status"
t.float "repository_size", default: 0.0
t.integer "star_count", default: 0, null: false
+ t.string "import_type"
+ t.string "import_source"
end
add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree
@@ -279,10 +335,11 @@ ActiveRecord::Schema.define(version: 20141205134006) do
add_index "projects", ["star_count"], name: "index_projects_on_star_count", using: :btree
create_table "protected_branches", force: true do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
+ t.integer "project_id", null: false
+ t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
+ t.boolean "developers_can_push", default: false, null: false
end
add_index "protected_branches", ["project_id"], name: "index_protected_branches_on_project_id", using: :btree
@@ -375,6 +432,7 @@ ActiveRecord::Schema.define(version: 20141205134006) do
t.boolean "hide_no_ssh_key", default: false
t.string "website_url", default: "", null: false
t.datetime "last_credential_check_at"
+ t.string "github_access_token"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
diff --git a/doc/api/README.md b/doc/api/README.md
index ffe250df3ff1e8ada04ce112ba1f26e121252976..8f919f5257dffedb0eec78b64e7f4fd546cdcdd0 100644
--- a/doc/api/README.md
+++ b/doc/api/README.md
@@ -51,6 +51,24 @@ curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/p
The API uses JSON to serialize data. You don't need to specify `.json` at the end of API URL.
+## Authentication with OAuth2 token
+
+Instead of the private_token you can transmit the OAuth2 access token as a header or as a parameter.
+
+### OAuth2 token (as a parameter)
+
+```
+curl https://localhost:3000/api/v3/user?access_token=OAUTH-TOKEN
+```
+
+### OAuth2 token (as a header)
+
+```
+curl -H "Authorization: Bearer OAUTH-TOKEN" https://localhost:3000/api/v3/user
+```
+
+Read more about [OAuth2 in GitLab](oauth2.md).
+
## Status codes
The API is designed to return different status codes according to context and action. In this way if a request results in an error the caller is able to get insight into what went wrong, e.g. status code `400 Bad Request` is returned if a required attribute is missing from the request. The following list gives an overview of how the API functions generally behave.
diff --git a/doc/api/groups.md b/doc/api/groups.md
index 6b379b02d28f18d7f4be115216aea2f841d46749..8aae4f6b1bb36d6740849673ce1cf1a963639257 100644
--- a/doc/api/groups.md
+++ b/doc/api/groups.md
@@ -19,6 +19,8 @@ GET /groups
]
```
+You can search for groups by name or path with: `/groups?search=Rails`
+
## Details of a group
Get all details of a group.
diff --git a/doc/api/notes.md b/doc/api/notes.md
index b5256ac803e488fc071fab2aeb81b75683deba1a..c22e493562ab1f0b8df4fbca94582ec3f73419fa 100644
--- a/doc/api/notes.md
+++ b/doc/api/notes.md
@@ -78,6 +78,21 @@ Parameters:
- `issue_id` (required) - The ID of an issue
- `body` (required) - The content of a note
+### Modify existing issue note
+
+Modify existing note of an issue.
+
+```
+PUT /projects/:id/issues/:issue_id/notes/:note_id
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+- `issue_id` (required) - The ID of an issue
+- `note_id` (required) - The ID of a note
+- `body` (required) - The content of a note
+
## Snippets
### List all snippet notes
@@ -137,7 +152,22 @@ POST /projects/:id/snippets/:snippet_id/notes
Parameters:
- `id` (required) - The ID of a project
-- `snippet_id` (required) - The ID of an snippet
+- `snippet_id` (required) - The ID of a snippet
+- `body` (required) - The content of a note
+
+### Modify existing snippet note
+
+Modify existing note of a snippet.
+
+```
+PUT /projects/:id/snippets/:snippet_id/notes/:note_id
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+- `snippet_id` (required) - The ID of a snippet
+- `note_id` (required) - The ID of a note
- `body` (required) - The content of a note
## Merge Requests
@@ -199,3 +229,18 @@ Parameters:
- `id` (required) - The ID of a project
- `merge_request_id` (required) - The ID of a merge request
- `body` (required) - The content of a note
+
+### Modify existing merge request note
+
+Modify existing note of a merge request.
+
+```
+PUT /projects/:id/merge_requests/:merge_request_id/notes/:note_id
+```
+
+Parameters:
+
+- `id` (required) - The ID of a project
+- `merge_request_id` (required) - The ID of a merge request
+- `note_id` (required) - The ID of a note
+- `body` (required) - The content of a note
diff --git a/doc/api/oauth2.md b/doc/api/oauth2.md
new file mode 100644
index 0000000000000000000000000000000000000000..b2dbba9bdeb2716dbffcb1a1d0e3e6d9b1937875
--- /dev/null
+++ b/doc/api/oauth2.md
@@ -0,0 +1,99 @@
+# OAuth2 authentication
+
+OAuth2 is a protocol that enables us to get access to private details of user's account without getting its password.
+
+Before using the OAuth2 you should create an application in user's account. Each application getting unique App ID and App Secret parameters. You should not share them.
+
+This functianolity is based on [doorkeeper gem](https://github.com/doorkeeper-gem/doorkeeper)
+
+## Web Application Flow
+
+This flow is using for authentication from third-party web sites and probably is most used.
+It basically consists of an exchange of an authorization token for an access token. For more detailed info, check out the [RFC spec here](http://tools.ietf.org/html/rfc6749#section-4.1)
+
+This flow consists from 3 steps.
+
+### 1. Registering the client
+
+Creat an application in user's account profile.
+
+### 2. Requesting authorization
+
+To request the authorization token, you should visit the `/oauth/authorize` endpoint. You can do that by visiting manually the URL:
+
+```
+http://localhost:3000/oauth/authorize?client_id=APP_ID&redirect_uri=REDIRECT_URI&response_type=code
+```
+
+Where REDIRECT_URI is the URL in your app where users will be sent after authorization.
+
+### 3. Requesting the access token
+
+To request the access token, you should use the returned code and exchange it for an access token. To do that you can use any HTTP client. In this case, I used rest-client:
+
+```
+parameters = 'client_id=APP_ID&client_secret=APP_SECRET&code=RETURNED_CODE&grant_type=AUTHORIZATION_CODE&redirect_uri=REDIRECT_URI'
+RestClient.post 'http://localhost:3000/oauth/token', parameters
+
+# The response will be
+{
+ "access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
+ "token_type": "bearer",
+ "expires_in": 7200,
+ "refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
+}
+```
+
+You can now make requests to the API with the access token returned.
+
+### Use the access token to access the API
+
+The access token allows you to make requests to the API on a behalf of a user.
+
+```
+GET https://localhost:3000/api/v3/user?access_token=OAUTH-TOKEN
+```
+
+Or you can put the token to the Authorization header:
+
+```
+curl -H "Authorization: Bearer OAUTH-TOKEN" https://localhost:3000/api/v3/user
+```
+
+## Resource Owner Password Credentials
+
+In this flow, a token is requested in exchange for the resource owner credentials (username and password).
+The credentials should only be used when there is a high degree of trust between the resource owner and the client (e.g. the
+client is part of the device operating system or a highly privileged application), and when other authorization grant types are not
+available (such as an authorization code).
+
+Even though this grant type requires direct client access to the resource owner credentials, the resource owner credentials are used
+for a single request and are exchanged for an access token. This grant type can eliminate the need for the client to store the
+resource owner credentials for future use, by exchanging the credentials with a long-lived access token or refresh token.
+You can do POST request to `/oauth/token` with parameters:
+
+```
+{
+ "grant_type" : "password",
+ "username" : "user@example.com",
+ "password" : "sekret"
+}
+```
+
+Then, you'll receive the access token back in the response:
+
+```
+{
+ "access_token": "1f0af717251950dbd4d73154fdf0a474a5c5119adad999683f5b450c460726aa",
+ "token_type": "bearer",
+ "expires_in": 7200
+}
+```
+
+For testing you can use the oauth2 ruby gem:
+
+```
+client = OAuth2::Client.new('the_client_id', 'the_client_secret', :site => "http://example.com")
+access_token = client.password.get_token('user@example.com', 'sekret')
+puts access_token.token
+```
\ No newline at end of file
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 0055e2e476f9334713bb12ede2662ceeab782232..027a8ec2e7f3ab492741f8cce67497d0585a8a2b 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -11,6 +11,9 @@ GET /projects
Parameters:
- `archived` (optional) - if passed, limit by archived status
+- `order_by` (optional) - Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields
+- `sort` (optional) - Return requests sorted in `asc` or `desc` order
+- `search` (optional) - Return list of authorized projects according to a search criteria
```json
[
@@ -628,6 +631,8 @@ GET /projects/search/:query
Parameters:
-- query (required) - A string contained in the project name
-- per_page (optional) - number of projects to return per page
-- page (optional) - the page to retrieve
+- `query` (required) - A string contained in the project name
+- `per_page` (optional) - number of projects to return per page
+- `page` (optional) - the page to retrieve
+- `order_by` (optional) - Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields
+- `sort` (optional) - Return requests sorted in `asc` or `desc` order
diff --git a/doc/install/installation.md b/doc/install/installation.md
index aa04116779e9901bc7d5a635eefcb6944ef43db9..d987e11040b40602e8c9655346e4beed0e649350 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -294,9 +294,9 @@ GitLab Shell is an SSH access and repository management software developed speci
# When done you see 'Administrator account created:'
-**Note:** You can set the Administrator password by supplying it in environmental variable `GITLAB_ROOT_PASSWORD`, eg.:
+**Note:** You can set the Administrator/root password by supplying it in environmental variable `GITLAB_ROOT_PASSWORD` as seen below. If you don't set the password (and it is set to the default one) please wait with exposing GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login you'll be forced to change the default password.
- sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=newpassword
+ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword
### Install Init Script
@@ -388,7 +388,7 @@ Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has
root
5iveL!fe
-**Important Note:** Please login to the server before exposing it to the public internet. On login you'll be prompted to change the password.
+**Important Note:** On login you'll be prompted to change the password.
**Enjoy!**
diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md
index 00adae58dfaef96d44f31f0024552e01a36bfe87..15b4fb622af9914afabf06b56c83a0bdd808b816 100644
--- a/doc/integration/omniauth.md
+++ b/doc/integration/omniauth.md
@@ -7,6 +7,7 @@ OmniAuth does not prevent standard GitLab authentication or LDAP (if configured)
- [Initial OmniAuth Configuration](#initial-omniauth-configuration)
- [Supported Providers](#supported-providers)
- [Enable OmniAuth for an Existing User](#enable-omniauth-for-an-existing-user)
+- [OmniAuth configuration sample when using Omnibus GitLab](https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master#omniauth-google-twitter-github-login)
## Initial OmniAuth Configuration
diff --git a/doc/operations/README.md b/doc/operations/README.md
index 31b1b583b0c629c93a1059a897f42613125e216f..f1456c6c8e2abae2faf7076078e8157a96b71765 100644
--- a/doc/operations/README.md
+++ b/doc/operations/README.md
@@ -1,3 +1,4 @@
# GitLab operations
- [Sidekiq MemoryKiller](sidekiq_memory_killer.md)
+- [Cleaning up Redis sessions](cleaning_up_redis_sessions.md)
diff --git a/doc/operations/cleaning_up_redis_sessions.md b/doc/operations/cleaning_up_redis_sessions.md
new file mode 100644
index 0000000000000000000000000000000000000000..93521e976d51e05204c34addbedc8cb0e4c514ab
--- /dev/null
+++ b/doc/operations/cleaning_up_redis_sessions.md
@@ -0,0 +1,52 @@
+# Cleaning up stale Redis sessions
+
+Since version 6.2, GitLab stores web user sessions as key-value pairs in Redis.
+Prior to GitLab 7.3, user sessions did not automatically expire from Redis. If
+you have been running a large GitLab server (thousands of users) since before
+GitLab 7.3 we recommend cleaning up stale sessions to compact the Redis
+database after you upgrade to GitLab 7.3. You can also perform a cleanup while
+still running GitLab 7.2 or older, but in that case new stale sessions will
+start building up again after you clean up.
+
+In GitLab versions prior to 7.3.0, the session keys in Redis are 16-byte
+hexadecimal values such as '976aa289e2189b17d7ef525a6702ace9'. Starting with
+GitLab 7.3.0, the keys are
+prefixed with 'session:gitlab:', so they would look like
+'session:gitlab:976aa289e2189b17d7ef525a6702ace9'. Below we describe how to
+remove the keys in the old format.
+
+First we define a shell function with the proper Redis connection details.
+
+```
+rcli() {
+ # This example works for Omnibus installations of GitLab 7.3 or newer. For an
+ # installation from source you will have to change the socket path and the
+ # path to redis-cli.
+ sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket "$@"
+}
+
+# test the new shell function; the response should be PONG
+rcli ping
+```
+
+Now we do a search to see if there are any session keys in the old format for
+us to clean up.
+
+```
+# returns the number of old-format session keys in Redis
+rcli keys '*' | grep '^[a-f0-9]\{32\}$' | wc -l
+```
+
+If the number is larger than zero, you can proceed to expire the keys from
+Redis. If the number is zero there is nothing to clean up.
+
+```
+# Tell Redis to expire each matched key after 600 seconds.
+rcli keys '*' | grep '^[a-f0-9]\{32\}$' | awk '{ print "expire", $0, 600 }' | rcli
+# This will print '(integer) 1' for each key that gets expired.
+```
+
+Over the next 15 minutes (10 minutes expiry time plus 5 minutes Redis
+background save interval) your Redis database will be compacted. If you are
+still using GitLab 7.2, users who are not clicking around in GitLab during the
+10 minute expiry window will be signed out of GitLab.
diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md
index e21384d21dcfc08245ce566c199f17acce9a6e43..c9928e11b2e37b29e7a44a93d609684d596a4c7f 100644
--- a/doc/permissions/permissions.md
+++ b/doc/permissions/permissions.md
@@ -8,7 +8,6 @@ If a user is a GitLab administrator they receive all permissions.
## Project
-
| Action | Guest | Reporter | Developer | Master | Owner |
|---------------------------------------|---------|------------|-------------|----------|--------|
| Create new issue | ✓ | ✓ | ✓ | ✓ | ✓ |
@@ -29,6 +28,7 @@ If a user is a GitLab administrator they receive all permissions.
| Add new team members | | | | ✓ | ✓ |
| Push to protected branches | | | | ✓ | ✓ |
| Enable/disable branch protection | | | | ✓ | ✓ |
+| Turn on/off prot. branch push for devs| | | | ✓ | ✓ |
| Rewrite/remove git tags | | | | ✓ | ✓ |
| Edit project | | | | ✓ | ✓ |
| Add deploy keys to project | | | | ✓ | ✓ |
@@ -37,7 +37,7 @@ If a user is a GitLab administrator they receive all permissions.
| Transfer project to another namespace | | | | | ✓ |
| Remove project | | | | | ✓ |
| Force push to protected branches | | | | | |
-| Remove protected branches | | | | | |
+| Remove protected branches | | | | | |
## Group
@@ -49,4 +49,4 @@ If a user is a GitLab administrator they receive all permissions.
| Manage group members | | | | | ✓ |
| Remove group | | | | | ✓ |
-Any user can remove himself from a group, unless he is the last Owner of the group.
+Any user can remove themselves from a group, unless they are the last Owner of the group.
diff --git a/doc/project_services/project_services.md b/doc/project_services/project_services.md
index 20a69a211dd664fa10c5f34b9f4df3637552531f..ec46af5fe3be19eaf3bc1fb3f7ae6017c3cd4b0e 100644
--- a/doc/project_services/project_services.md
+++ b/doc/project_services/project_services.md
@@ -16,3 +16,4 @@ __Project integrations with external services for continuous integration and mor
- PivotalTracker
- Pushover
- Slack
+- TeamCity
\ No newline at end of file
diff --git a/doc/raketasks/README.md b/doc/raketasks/README.md
index 9e2f697bca69dfb66e2cbf6fe04141e4d1caec45..770b7a70fe0a43e99badbfa0ad145d5c9813019c 100644
--- a/doc/raketasks/README.md
+++ b/doc/raketasks/README.md
@@ -1,5 +1,8 @@
+# Rake tasks
+
- [Backup restore](backup_restore.md)
- [Cleanup](cleanup.md)
+- [Features](features.md)
- [Maintenance](maintenance.md) and self-checks
- [User management](user_management.md)
- [Web hooks](web_hooks.md)
diff --git a/doc/release/howto_rc1.md b/doc/release/howto_rc1.md
new file mode 100644
index 0000000000000000000000000000000000000000..25923d16f3486e42bd75258aa2ad2cdaacb0d569
--- /dev/null
+++ b/doc/release/howto_rc1.md
@@ -0,0 +1,126 @@
+# How to create RC1
+
+The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub.
+
+### 1. Update the installation guide
+
+1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay)
+1. Check the [GitLab Shell version](/lib/tasks/gitlab/check.rake#L782)
+1. Check the [Git version](/lib/tasks/gitlab/check.rake#L794)
+1. There might be other changes. Ask around.
+
+### 2. Create update guides
+
+1. Create: CE update guide from previous version. Like `7.3-to-7.4.md`
+1. Create: CE to EE update guide in EE repository for latest version.
+1. Update: `6.x-or-7.x-to-7.x.md` to latest version.
+1. Create: CI update guide from previous version
+
+It's best to copy paste the previous guide and make changes where necessary.
+The typical steps are listed below with any points you should specifically look at.
+
+#### 0. Any major changes?
+
+List any major changes here, so the user is aware of them before starting to upgrade. For instance:
+
+- Database updates
+- Web server changes
+- File structure changes
+
+#### 1. Stop server
+
+#### 2. Make backup
+
+#### 3. Do users need to update dependencies like `git`?
+
+- Check if the [GitLab Shell version](/lib/tasks/gitlab/check.rake#L782) changed since the last release.
+
+- Check if the [Git version](/lib/tasks/gitlab/check.rake#L794) changed since the last release.
+
+#### 4. Get latest code
+
+#### 5. Does GitLab shell need to be updated?
+
+#### 6. Install libs, migrations, etc.
+
+#### 7. Any config files updated since last release?
+
+Check if any of these changed since last release:
+
+- [lib/support/nginx/gitlab](/lib/support/nginx/gitlab)
+- [lib/support/nginx/gitlab-ssl](/lib/support/nginx/gitlab-ssl)
+-
+- [config/gitlab.yml.example](/config/gitlab.yml.example)
+- [config/unicorn.rb.example](/config/unicorn.rb.example)
+- [config/database.yml.mysql](/config/database.yml.mysql)
+- [config/database.yml.postgresql](/config/database.yml.postgresql)
+- [config/initializers/rack_attack.rb.example](/config/initializers/rack_attack.rb.example)
+- [config/resque.yml.example](/config/resque.yml.example)
+
+#### 8. Need to update init script?
+
+Check if the `init.d/gitlab` script changed since last release: [lib/support/init.d/gitlab](/lib/support/init.d/gitlab)
+
+#### 9. Start application
+
+#### 10. Check application status
+
+### 3. Code quality indicators
+
+Make sure the code quality indicators are green / good.
+
+- [](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch)
+
+- [](https://semaphoreapp.com/gitlabhq/gitlabhq) (master branch)
+
+- [](https://codeclimate.com/github/gitlabhq/gitlabhq)
+
+- [](https://gemnasium.com/gitlabhq/gitlabhq) this button can be yellow (small updates are available) but must not be red (a security fix or an important update is available)
+
+- [](https://coveralls.io/r/gitlabhq/gitlabhq)
+
+### 4. Run release tool for CE and EE
+
+**Make sure EE `master` has latest changes from CE `master`**
+
+Get release tools
+
+```
+git clone git@dev.gitlab.org:gitlab/release-tools.git
+cd release-tools
+```
+
+Release candidate creates stable branch from master.
+So we need to sync master branch between all CE remotes. Also do same for EE.
+
+```
+bundle exec rake sync
+```
+
+Create release candidate and stable branch:
+
+```
+bundle exec rake release["x.x.0.rc1"]
+```
+
+Now developers can use master for merging new features.
+So you should use stable branch for future code chages related to release.
+
+
+### 5. Release GitLab CI RC1
+
+Add to your local `gitlab-ci/.git/config`:
+
+```
+[remote "public"]
+ url = none
+ pushurl = git@dev.gitlab.org:gitlab/gitlab-ci.git
+ pushurl = git@gitlab.com:gitlab-org/gitlab-ci.git
+ pushurl = git@github.com:gitlabhq/gitlab-ci.git
+```
+
+* Create a stable branch `x-y-stable`
+* Bump VERSION to `x.y.0.rc1`
+* `git tag -a v$(cat VERSION) -m "Version $(cat VERSION)"`
+* `git push public x-y-stable v$(cat VERSION)`
+
diff --git a/doc/release/monthly.md b/doc/release/monthly.md
index 3f1bccb2cf6191980717bdfaeda6b044fb42d61e..175112b90c6d79a8e7b4d9a6884043d31ed97c9c 100644
--- a/doc/release/monthly.md
+++ b/doc/release/monthly.md
@@ -1,210 +1,126 @@
# Monthly Release
-NOTE: This is a guide for GitLab developers.
+NOTE: This is a guide used by the GitLab B.V. developers.
-# **7 workdays before release - Code Freeze & Release Manager**
+It starts 7 working days before the release.
+The release manager doesn't have to perform all the work but must ensure someone is assigned.
+The current release manager must schedule the appointment of the next release manager.
+The new release manager should create overall issue to track the progress.
-### **1. Stop merging in code, except for important bug fixes**
-
-### **2. Release Manager**
+## Release Manager
A release manager is selected that coordinates all releases the coming month, including the patch releases for previous releases.
The release manager has to make sure all the steps below are done and delegated where necessary.
This person should also make sure this document is kept up to date and issues are created and updated.
-### **3. Create an overall issue**
+## Take vacations into account
+
+The time is measured in weekdays to compensate for weekends.
+Do everything on time to prevent problems due to rush jobs or too little testing time.
+Make sure that you take into account any vacations of maintainers.
+If the release is falling behind immediately warn the team.
+
+## Create an overall issue and follow it
Create issue for GitLab CE project(internal). Name it "Release x.x.x" for easier searching.
Replace the dates with actual dates based on the number of workdays before the release.
+All steps from issue template are explained below
```
-Xth:
+Xth: (7 working days before the 22nd)
+- [ ] Code freeze
- [ ] Update the CE changelog (#LINK)
- [ ] Update the EE changelog (#LINK)
- [ ] Update the CI changelog (#LINK)
- [ ] Triage the omnibus-gitlab milestone
-Xth:
-
-- [ ] Merge CE in to EE (#LINK)
-- [ ] Close the omnibus-gitlab milestone
-
-Xth:
+Xth: (6 working days before the 22nd)
-- [ ] Create x.x.0.rc1 (#LINK)
-- [ ] Create x.x.0.rc1-ee (#LINK)
-- [ ] Create CI y.y.0.rc1 (#LINK)
-- [ ] Build package for GitLab.com (https://dev.gitlab.org/cookbooks/chef-repo/blob/master/doc/administration.md#build-a-package)
+- [ ] Merge CE master in to EE master via merge request (#LINK)
+- [ ] Create CE, EE, CI RC1 versions (#LINK)
+- [ ] Determine QA person and notify this person
-Xth:
-
-- [ ] Update GitLab.com with rc1 (#LINK) (https://dev.gitlab.org/cookbooks/chef-repo/blob/master/doc/administration.md#deploy-the-package)
-- [ ] Regression issues (CE, CI) and tweet about rc1 (#LINK)
-- [ ] Start blog post (#LINK)
-
-Xth:
+Xth: (5 working days before the 22nd)
- [ ] Do QA and fix anything coming out of it (#LINK)
+- [ ] Close the omnibus-gitlab milestone
-22nd:
-
-- [ ] Release CE, EE and CI (#LINK)
-
-Xth:
-
-- [ ] Deploy to GitLab.com (#LINK)
-
-```
-
-### **4. Update changelog**
-
-Any changes not yet added to the changelog are added by lead developer and in that merge request the complete team is asked if there is anything missing.
-
-There are three changelogs that need to be updated: CE, EE and CI.
-
-### **5. Take weekend and vacations into account**
-
-Ensure that there is enough time to incorporate the findings of the release candidate, etc.
-
-# **6 workdays before release- Merge the CE into EE**
-
-Do this via a merge request.
-
-# **5 workdays before release - Create RC1**
-
-The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub.
-
-### **1. Update the installation guide**
-
-1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay)
-1. Check the [GitLab Shell version](/lib/tasks/gitlab/check.rake#L782)
-1. Check the [Git version](/lib/tasks/gitlab/check.rake#L794)
-1. There might be other changes. Ask around.
-
-### **2. Create update guides**
-
-1. Create: CE update guide from previous version. Like `7.3-to-7.4.md`
-1. Create: CE to EE update guide in EE repository for latest version.
-1. Update: `6.x-or-7.x-to-7.x.md` to latest version.
-1. Create: CI update guide from previous version
-
-It's best to copy paste the previous guide and make changes where necessary.
-The typical steps are listed below with any points you should specifically look at.
-
-#### 0. Any major changes?
-
-List any major changes here, so the user is aware of them before starting to upgrade. For instance:
-
-- Database updates
-- Web server changes
-- File structure changes
-
-#### 1. Stop server
-
-#### 2. Make backup
-
-#### 3. Do users need to update dependencies like `git`?
-
-- Check if the [GitLab Shell version](/lib/tasks/gitlab/check.rake#L782) changed since the last release.
-
-- Check if the [Git version](/lib/tasks/gitlab/check.rake#L794) changed since the last release.
-
-#### 4. Get latest code
-
-#### 5. Does GitLab shell need to be updated?
-
-#### 6. Install libs, migrations, etc.
+Xth: (4 working days before the 22nd)
-#### 7. Any config files updated since last release?
+- [ ] Build rc1 package for GitLab.com (https://dev.gitlab.org/cookbooks/chef-repo/blob/master/doc/administration.md#build-a-package)
+- [ ] Update GitLab.com with rc1 (#LINK) (https://dev.gitlab.org/cookbooks/chef-repo/blob/master/doc/administration.md#deploy-the-package)
-Check if any of these changed since last release:
+Xth: (3 working days before the 22nd)
-- [lib/support/nginx/gitlab](/lib/support/nginx/gitlab)
-- [lib/support/nginx/gitlab-ssl](/lib/support/nginx/gitlab-ssl)
--
-- [config/gitlab.yml.example](/config/gitlab.yml.example)
-- [config/unicorn.rb.example](/config/unicorn.rb.example)
-- [config/database.yml.mysql](/config/database.yml.mysql)
-- [config/database.yml.postgresql](/config/database.yml.postgresql)
-- [config/initializers/rack_attack.rb.example](/config/initializers/rack_attack.rb.example)
-- [config/resque.yml.example](/config/resque.yml.example)
+- [ ] Create regression issues (CE, CI) (#LINK)
+- [ ] Tweet about rc1 (#LINK)
+- [ ] Prepare the blog post (#LINK)
-#### 8. Need to update init script?
+Xth: (2 working days before the 22nd)
-Check if the `init.d/gitlab` script changed since last release: [lib/support/init.d/gitlab](/lib/support/init.d/gitlab)
+- [ ] Merge CE stable branch into EE stable branch
+- [ ] Check that everyone is mentioned on the blog post (the reviewer should have done this one working day ago)
-#### 9. Start application
+Xth: (1 working day before the 22nd)
-#### 10. Check application status
+- [ ] Create CE, EE, CI stable versions (#LINK)
+- [ ] Create Omnibus tags and build packages
-### **3. Code quality indicators**
+22nd:
-Make sure the code quality indicators are green / good.
+- [ ] Release CE, EE and CI (#LINK)
-- [](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch)
+Xth: (1 working day after the 22nd)
-- [](https://semaphoreapp.com/gitlabhq/gitlabhq) (master branch)
+- [ ] Update GitLab.com with the stable version (#LINK)
-- [](https://codeclimate.com/github/gitlabhq/gitlabhq)
+```
-- [](https://gemnasium.com/gitlabhq/gitlabhq) this button can be yellow (small updates are available) but must not be red (a security fix or an important update is available)
+- - -
-- [](https://coveralls.io/r/gitlabhq/gitlabhq)
+## Code Freeze
-### **4. Run release tool**
+Stop merging code in master, except for important bug fixes
-**Make sure EE `master` has latest changes from CE `master`**
+## Update changelog
-Get release tools
+Any changes not yet added to the changelog are added by lead developer and in that merge request the complete team is
+asked if there is anything missing.
-```
-git clone git@dev.gitlab.org:gitlab/release-tools.git
-cd release-tools
-```
+There are three changelogs that need to be updated: CE, EE and CI.
-Release candidate creates stable branch from master.
-So we need to sync master branch between all CE remotes. Also do same for EE.
+Remove the Note text in the stable branches.
-```
-bundle exec rake sync
-```
+## Create RC1 (CE, EE, CI)
-Create release candidate and stable branch:
+[Follow this How-to guide](howto_rc1.md) to create RC1.
-```
-bundle exec rake release["x.x.0.rc1"]
-```
+## Prepare CHANGELOG for next release
-Now developers can use master for merging new features.
-So you should use stable branch for future code chages related to release.
+Once the stable branches have been created, update the CHANGELOG in `master` with the upcoming version and add 70 empty
+lines to it. We do this in order to avoid merge conflicts when merging the CHANGELOG.
+Make sure that the CHANGELOG im master contains the following disclaimer message:
-### 5. Release GitLab CI RC1
+> Note: The upcoming release contains empty lines to reduce the number of merge conflicts, scroll down to see past releases.
-Add to your local `gitlab-ci/.git/config`:
+## QA
-```
-[remote "public"]
- url = none
- pushurl = git@dev.gitlab.org:gitlab/gitlab-ci.git
- pushurl = git@gitlab.com:gitlab-org/gitlab-ci.git
- pushurl = git@github.com:gitlabhq/gitlab-ci.git
-```
+Create issue on dev.gitlab.org `gitlab` repository, named "GitLab X.X QA" in order to keep track of the progress.
-* Create a stable branch `x-y-stable`
-* Bump VERSION to `x.y.0.rc1`
-* `git tag -a v$(cat VERSION) -m "Version $(cat VERSION)"
-* `git push public x-y-stable v$(cat VERSION)`
+Use the omnibus packages of Enterprise Edition using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md).
+**NOTE** Upgrader can only be tested when tags are pushed to all repositories. Do not forget to confirm it is working before releasing. Note that in the issue.
-# **4 workdays before release - Release RC1**
+#### Fix anything coming out of the QA
-### **1. Determine QA person
+Create an issue with description of a problem, if it is quick fix fix it yourself otherwise contact the team for advice.
-Notify person of QA day.
+**NOTE** If there is a problem that cannot be fixed in a timely manner, reverting the feature is an option! If the feature is reverted,
+create an issue about it in order to discuss the next steps after the release.
-### **2. Update GitLab.com**
+## Update GitLab.com with RC1
Merge the RC1 EE code into GitLab.com.
Once the build is green, create a package.
@@ -212,22 +128,7 @@ If there are big database migrations consider testing them with the production d
Try to deploy in the morning.
It is important to do this as soon as possible, so we can catch any errors before we release the full version.
-### **3. Prepare the blog post**
-
-- Start with a complete copy of the [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) and fill it out.
-- Check the changelog of CE and EE for important changes.
-- Also check the CI changelog
-- Add a proposed tweet text to the blog post WIP MR description.
-- Create a WIP MR for the blog post
-- Ask Dmitriy to add screenshots to the WIP MR.
-- Decide with team who will be the MVP user.
-- Create WIP MR for adding MVP to MVP page on website
-- Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
-- Create a merge request on [GitLab.com](https://gitlab.com/gitlab-com/www-gitlab-com/tree/master)
-- Assign to one reviewer who will fix spelling issues by editing the branch (can use the online editor)
-- After the reviewer is finished the whole team will be mentioned to give their suggestions via line comments
-
-### **4. Create a regressions issue**
+## Create a regressions issue
On [the GitLab CE issue tracker on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/issues/) create an issue titled "GitLab X.X regressions" add the following text:
@@ -238,39 +139,29 @@ The release manager will comment here about the plans for patch releases.
Assign the issue to the release manager and /cc all the core-team members active on the issue tracker. If there are any known bugs in the release add them immediately.
-### **4. Tweet**
+## Tweet about RC1
Tweet about the RC release:
> GitLab x.x.0.rc1 is out. This release candidate is only suitable for testing. Please link regressions issues from LINK_TO_REGRESSION_ISSUE
-# **1 workdays before release - Preparation**
-
-### **1. Pre QA merge**
-
-Merge CE into EE before doing the QA.
+## Prepare the blog post
-### **2. QA**
+1. Start with a complete copy of the [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) and fill it out.
+1. Make sure the blog post contains information about the GitLab CI release.
+1. Check the changelog of CE and EE for important changes.
+1. Also check the CI changelog
+1. Add a proposed tweet text to the blog post WIP MR description.
+1. Create a WIP MR for the blog post
+1. Ask Dmitriy to add screenshots to the WIP MR.
+1. Decide with team who will be the MVP user.
+1. Create WIP MR for adding MVP to MVP page on website
+1. Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
+1. Create a merge request on [GitLab.com](https://gitlab.com/gitlab-com/www-gitlab-com/tree/master)
+1. Assign to one reviewer who will fix spelling issues by editing the branch (either with a git client or by using the online editor)
+1. Comment to the reviewer: '@person Please mention the whole team as soon as you are done (3 workdays before release at the latest)'
-Create issue on dev.gitlab.org `gitlab` repository, named "GitLab X.X QA" in order to keep track of the progress.
-
-Use the omnibus packages of Enterprise Edition using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md).
-
-**NOTE** Upgrader can only be tested when tags are pushed to all repositories. Do not forget to confirm it is working before releasing. Note that in the issue.
-
-### **3. Fix anything coming out of the QA**
-
-Create an issue with description of a problem, if it is quick fix fix it yourself otherwise contact the team for advice.
-
-**NOTE** If there is a problem that cannot be fixed in a timely manner, reverting the feature is an option! If the feature is reverted,
-create an issue about it in order to discuss the next steps after the release.
-
-# **22nd - Release CE, EE and CI**
-
-**Make sure EE `x-x-stable-ee` has latest changes from CE `x-x-stable`**
-
-
-### **1. Release code**
+## Create CE, EE, CI stable versions
Get release tools
@@ -287,37 +178,39 @@ bundle exec rake release["x.x.0"]
Also perform these steps for GitLab CI:
-- bump version in the stable branch
-- create annotated tag
-- push the stable branch and the annotated tag to the public repositories
-
-### **2. Update installation.md**
+1. bump version in the stable branch
+1. create annotated tag
+1. push the stable branch and the annotated tag to the public repositories
Update [installation.md](/doc/install/installation.md) to the newest version in master.
-### **3. Build the Omnibus packages**
+## Create Omnibus tags and build packages
Follow the [release doc in the Omnibus repository](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md).
This can happen before tagging because Omnibus uses tags in its own repo and SHA1's to refer to the GitLab codebase.
-### **4. Publish packages for new release**
+## Release CE, EE and CI
+
+__1. Publish packages for new release__
Update `downloads/index.html` and `downloads/archive/index.html` in `www-gitlab-com` repository.
-### **5. Publish blog for new release**
+__2. Publish blog for new release__
+Doublecheck the everyone has been mentioned in the blog post.
Merge the [blog merge request](#1-prepare-the-blog-post) in `www-gitlab-com` repository.
-### **6. Tweet to blog**
+__3. Tweet to blog__
Send out a tweet to share the good news with the world.
List the most important features and link to the blog post.
-Proposed tweet for CE "GitLab X.X is released! It brings *** "
+Proposed tweet "Release of GitLab X.X & CI Y.Y! FEATURE, FEATURE and FEATURE #gitlab"
+
+Consider creating a post on Hacker News.
-# **1 workday after release - Update GitLab.com**
+## Update GitLab.com with the stable version
-- Build a package for gitlab.com based on the official release instead of RC1
- Deploy the package (should not need downtime because of the small difference with RC1)
diff --git a/doc/update/6.x-or-7.x-to-7.6.md b/doc/update/6.x-or-7.x-to-7.7.md
similarity index 95%
rename from doc/update/6.x-or-7.x-to-7.6.md
rename to doc/update/6.x-or-7.x-to-7.7.md
index 883a654dcd8440601cd7856f19ac5e46b5e69b25..6501a8d2148729d89bb66dbaef30f3c1fe65ea4b 100644
--- a/doc/update/6.x-or-7.x-to-7.6.md
+++ b/doc/update/6.x-or-7.x-to-7.7.md
@@ -1,6 +1,6 @@
-# From 6.x or 7.x to 7.6
+# From 6.x or 7.x to 7.7
-This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.6.
+This allows you to upgrade any version of GitLab from 6.0 and up (including 7.0 and up) to 7.7.
## Global issue numbers
@@ -70,7 +70,7 @@ sudo -u git -H git checkout -- db/schema.rb # local changes will be restored aut
For GitLab Community Edition:
```bash
-sudo -u git -H git checkout 7-6-stable
+sudo -u git -H git checkout 7-7-stable
```
OR
@@ -78,7 +78,7 @@ OR
For GitLab Enterprise Edition:
```bash
-sudo -u git -H git checkout 7-6-stable-ee
+sudo -u git -H git checkout 7-7-stable-ee
```
## 4. Install additional packages
@@ -119,7 +119,7 @@ sudo apt-get install pkg-config cmake
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
-sudo -u git -H git checkout v2.4.0
+sudo -u git -H git checkout v2.4.1
```
## 7. Install libs, migrations, etc.
@@ -154,14 +154,14 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
TIP: to see what changed in `gitlab.yml.example` in this release use next command:
```
-git diff 6-0-stable:config/gitlab.yml.example 7-6-stable:config/gitlab.yml.example
+git diff 6-0-stable:config/gitlab.yml.example 7-7-stable:config/gitlab.yml.example
```
-* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/config/gitlab.yml.example but with your settings.
-* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/config/unicorn.rb.example but with your settings.
+* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-7-stable/config/gitlab.yml.example but with your settings.
+* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-7-stable/config/unicorn.rb.example but with your settings.
* Make `/home/git/gitlab-shell/config.yml` the same as https://gitlab.com/gitlab-org/gitlab-shell/blob/v2.4.0/config.yml.example but with your settings.
-* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/lib/support/nginx/gitlab but with your settings.
-* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-6-stable/lib/support/nginx/gitlab-ssl but with your settings.
+* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-7-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-7-stable/lib/support/nginx/gitlab-ssl but with your settings.
* Copy rack attack middleware config
```bash
diff --git a/doc/update/7.5-to-7.6.md b/doc/update/7.5-to-7.6.md
index 11058c211cab3f75bafcb5000e244dc92e8b2c6f..35cd437fdc44dfadbbbd7e553e68e121fdebd8df 100644
--- a/doc/update/7.5-to-7.6.md
+++ b/doc/update/7.5-to-7.6.md
@@ -70,7 +70,7 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
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-6-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example
+git diff origin/7-5-stable:config/gitlab.yml.example origin/7-6-stable:config/gitlab.yml.example
```
#### Change Nginx settings
diff --git a/doc/update/7.6-to-7.7.md b/doc/update/7.6-to-7.7.md
new file mode 100644
index 0000000000000000000000000000000000000000..90f15afcb625d19738801ea454623999b58ee9e9
--- /dev/null
+++ b/doc/update/7.6-to-7.7.md
@@ -0,0 +1,114 @@
+# From 7.6 to 7.7
+
+### 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-7-stable
+```
+
+OR
+
+For GitLab Enterprise Edition:
+
+```bash
+sudo -u git -H git checkout 7-7-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.4.1
+```
+
+### 4. Install libs, migrations, etc.
+
+```bash
+sudo apt-get install libkrb5-dev
+
+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-6-stable:config/gitlab.yml.example origin/7-7-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 setting
+
+#### 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!
+
+## Things went south? Revert to previous version (7.6)
+
+### 1. Revert the code to the previous version
+Follow the [upgrade guide from 7.5 to 7.6](7.5-to-7.6.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.
diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md
index 695c083d3611737d4a2c8b3ddce57bcdd6989243..229689392b844348e64e969a94bee0dedd759562 100644
--- a/doc/update/mysql_to_postgresql.md
+++ b/doc/update/mysql_to_postgresql.md
@@ -13,7 +13,7 @@ sudo service gitlab stop
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
cd mysql-postgresql-converter
-mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production
+mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production -p
python db_converter.py databasename.mysql databasename.psql
# Import the database dump as the application database user
@@ -94,7 +94,7 @@ sudo -u git -H mv tmp/backups/TIMESTAMP_gitlab_backup.tar tmp/backups/postgresql
# Create a separate database dump with PostgreSQL compatibility
cd tmp/backups/postgresql
-sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production
+sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production -p
# Clone the database converter
sudo -u git -H git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md
index 0a9f242d9abab7d4a433f4b942e8b4cd1b15978a..5016ee4baad31f5e3d54d4cdf853d089cdbbab21 100644
--- a/doc/update/upgrader.md
+++ b/doc/update/upgrader.md
@@ -23,7 +23,7 @@ If you have local changes to your GitLab repository the script will stash them a
## 2. Run GitLab upgrade tool
-Note: 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.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX) while 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
diff --git a/doc/workflow/README.md b/doc/workflow/README.md
index c26d85e99552cc56041d68e6bdc86326f484fcfd..8ef51b50b9d3565418666ff287d5ca38b4803b99 100644
--- a/doc/workflow/README.md
+++ b/doc/workflow/README.md
@@ -1,3 +1,5 @@
+# Workflow
+
- [Workflow](workflow.md)
- [Project Features](project_features.md)
- [Authorization for merge requests](authorization_for_merge_requests.md)
@@ -6,3 +8,4 @@
- [GitLab Flow](gitlab_flow.md)
- [Notifications](notifications.md)
- [Migrating from SVN to GitLab](migrating_from_svn.md)
+- [Protected branches](protected_branches.md)
diff --git a/doc/workflow/gitlab_flow.md b/doc/workflow/gitlab_flow.md
index f8fd7c97e2a9b8921c1eb46316eabef4b066c407..1dbff60cbfde56a29fa1629ca5016de46afc9682 100644
--- a/doc/workflow/gitlab_flow.md
+++ b/doc/workflow/gitlab_flow.md
@@ -1,6 +1,6 @@

-# Introduction
+## Introduction
Version management with git makes branching and merging much easier than older versioning systems such as SVN.
This allows a wide variety of branching strategies and workflows.
@@ -29,9 +29,9 @@ People have a hard time figuring out which branch they should develop on or depl
Frequently the reaction to this problem is to adopt a standardized pattern such as [git flow](http://nvie.com/posts/a-successful-git-branching-model/) and [GitHub flow](http://scottchacon.com/2011/08/31/github-flow.html)
We think there is still room for improvement and will detail a set of practices we call GitLab flow.
-# Git flow and its problems
+## Git flow and its problems
-[
+[
Git flow was one of the first proposals to use git branches and it has gotten a lot of attention.
It advocates a master branch and a separate develop branch as well as supporting branches for features, releases and hotfixes.
@@ -50,7 +50,7 @@ Frequently developers make a mistake and for example changes are only merged int
The root cause of these errors is that git flow is too complex for most of the use cases.
And doing releases doesn't automatically mean also doing hotfixes.
-# GitHub flow as a simpler alternative
+## GitHub flow as a simpler alternative

@@ -62,13 +62,13 @@ Merging everything into the master branch and deploying often means you minimize
But this flow still leaves a lot of questions unanswered regarding deployments, environments, releases and integrations with issues.
With GitLab flow we offer additional guidance for these questions.
-# Production branch with GitLab flow
+## Production branch with GitLab flow

GitHub flow does assume you are able to deploy to production every time you merge a feature branch.
This is possible for SaaS applications but are many cases where this is not possible.
-One would be a situation where you are not in control of the exact release moment, for example an iOS application that needs to pass AppStore validation.
+One would be a situation where you are not in control of the exact release moment, for example an iOS application that needs to pass App Store validation.
Another example is when you have deployment windows (workdays from 10am to 4pm when the operations team is at full capacity) but you also merge code at other times.
In these cases you can make a production branch that reflects the deployed code.
You can deploy a new version by merging in master to the production branch.
@@ -78,7 +78,7 @@ This time is pretty accurate if you automatically deploy your production branch.
If you need a more exact time you can have your deployment script create a tag on each deployment.
This flow prevents the overhead of releasing, tagging and merging that is common to git flow.
-# Environment branches with GitLab flow
+## Environment branches with GitLab flow

@@ -93,7 +93,7 @@ If master is good to go (it should be if you a practicing [continuous delivery](
If this is not possible because more manual testing is required you can send merge requests from the feature branch to the downstream branches.
An 'extreme' version of environment branches are setting up an environment for each feature branch as done by [Teatro](http://teatro.io/).
-# Release branches with GitLab flow
+## Release branches with GitLab flow

@@ -109,7 +109,7 @@ Every time a bug-fix is included in a release branch the patch version is raised
Some projects also have a stable branch that points to the same commit as the latest released branch.
In this flow it is not common to have a production branch (or git flow master branch).
-# Merge/pull requests with GitLab flow
+## Merge/pull requests with GitLab flow

@@ -134,7 +134,7 @@ If the assigned person does not feel comfortable they can close the merge reques
In GitLab it is common to protect the long-lived branches (e.g. the master branch) so that normal developers [can't modify these protected branches](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/permissions/permissions.md).
So if you want to merge it into a protected branch you assign it to someone with master authorizations.
-# Issues with GitLab flow
+## Issues with GitLab flow

@@ -168,7 +168,7 @@ In this case it is no problem to reuse the same branch name since it was deleted
At any time there is at most one branch for every issue.
It is possible that one feature branch solves more than one issue.
-# Linking and closing issues from merge requests
+## Linking and closing issues from merge requests

@@ -181,7 +181,7 @@ If you only want to make the reference without closing the issue you can also ju
If you have an issue that spans across multiple repositories, the best thing is to create an issue for each repository and link all issues to a parent issue.
-# Squashing commits with rebase
+## Squashing commits with rebase

@@ -189,7 +189,7 @@ With git you can use an interactive rebase (rebase -i) to squash multiple commit
This functionality is useful if you made a couple of commits for small changes during development and want to replace them with a single commit or if you want to make the order more logical.
However you should never rebase commits you have pushed to a remote server.
Somebody can have referred to the commits or cherry-picked them.
-When you rebase you change the identifier (SHA1) of the commit and this is confusing.
+When you rebase you change the identifier (SHA-1) of the commit and this is confusing.
If you do that the same change will be known under multiple identifiers and this can cause much confusion.
If people already reviewed your code it will be hard for them to review only the improvements you made since then if you have rebased everything into one commit.
@@ -207,7 +207,7 @@ If you revert a merge and you change your mind, revert the revert instead of mer
Being able to revert a merge is a good reason always to create a merge commit when you merge manually with the `--no-ff` option.
Git management software will always create a merge commit when you accept a merge request.
-# Do not order commits with rebase
+## Do not order commits with rebase

@@ -231,8 +231,8 @@ The last reason for creating merge commits is having long lived branches that yo
Martin Fowler, in [his article about feature branches](http://martinfowler.com/bliki/FeatureBranch.html) talks about this Continuous Integration (CI).
At GitLab we are guilty of confusing CI with branch testing. Quoting Martin Fowler: "I've heard people say they are doing CI because they are running builds, perhaps using a CI server, on every branch with every commit.
That's continuous building, and a Good Thing, but there's no integration, so it's not CI.".
-The solution to prevent many merge commits is to keep your feature branches shortlived, the vast majority should take less than one day of work.
-If your feature branches commenly take more than a day of work, look into ways to create smaller units of work and/or use [feature toggles](http://martinfowler.com/bliki/FeatureToggle.html).
+The solution to prevent many merge commits is to keep your feature branches short-lived, the vast majority should take less than one day of work.
+If your feature branches commonly take more than a day of work, look into ways to create smaller units of work and/or use [feature toggles](http://martinfowler.com/bliki/FeatureToggle.html).
As for the long running branches that take more than one day there are two strategies.
In a CI strategy you can merge in master at the start of the day to prevent painful merges at a later time.
In a synchronization point strategy you only merge in from well defined points in time, for example a tagged release.
@@ -244,7 +244,7 @@ Developing software happen in small messy steps and it is OK to have your histor
You can use tools to view the network graphs of commits and understand the messy history that created your code.
If you rebase code the history is incorrect, and there is no way for tools to remedy this because they can't deal with changing commit identifiers.
-# Voting on merge requests
+## Voting on merge requests

@@ -252,7 +252,7 @@ It is common to voice approval or disapproval by using +1 or -1 emoticons.
In GitLab the +1 and -1 are aggregated and shown at the top of the merge request.
As a rule of thumb anything that doesn't have two times more +1's than -1's is suspect and should not be merged yet.
-# Pushing and removing branches
+## Pushing and removing branches

@@ -266,7 +266,7 @@ This ensures that the branch overview in the repository management software show
This also ensures that when someone reopens the issue a new branch with the same name can be used without problem.
When you reopen an issue you need to create a new merge request.
-# Committing often and with the right message
+## Committing often and with the right message

@@ -282,7 +282,7 @@ Some words that are bad commit messages because they don't contain munch informa
The word fix or fixes is also a red flag, unless it comes after the commit sentence and references an issue number.
To see more information about the formatting of commit messages please see this great [blog post by Tim Pope](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
-# Testing before merging
+## Testing before merging

@@ -299,7 +299,7 @@ If there are no merge conflicts and the feature branches are short lived the ris
If there are merge conflicts you merge the master branch into the feature branch and the CI server will rerun the tests.
If you have long lived feature branches that last for more than a few days you should make your issues smaller.
-# Merging in other code
+## Merging in other code

diff --git a/doc/workflow/protected_branches.md b/doc/workflow/protected_branches.md
new file mode 100644
index 0000000000000000000000000000000000000000..805f7f8d35c46e130836174c48b10770cadf0cb8
--- /dev/null
+++ b/doc/workflow/protected_branches.md
@@ -0,0 +1,33 @@
+# Protected branches
+
+Permission in GitLab are fundamentally defined around the idea of having read or write permission to the repository and branches.
+
+To prevent people from messing with history or pushing code without review, we've created protected branches.
+
+A protected branch does three simple things:
+
+* it prevents pushes from everybody except users with Master permission
+* it prevents anyone from force pushing to the branch
+* it prevents anyone from deleting the branch
+
+You can make any branch a protected branch. GitLab makes the master branch a protected branch by default.
+
+To protect a branch, user needs to have at least a Master permission level, see [permissions document](permissions/permissions.md).
+
+
+
+Navigate to project settings page and select `protected branches`. From the `Branch` dropdown menu select the branch you want to protect.
+
+Some workflows, like [GitLab workflow](gitlab_flow.md), require all users with write access to submit a Merge request in order to get the code into a protected branch.
+
+Since Masters and Owners can already push to protected branches, that means Developers cannot push to protected branch and need to submit a Merge request.
+
+However, there are workflows where that is not needed and only protecting from force pushes and branch removal is useful.
+
+For those workflows, you can allow everyone with write access to push to a protected branch by selecting `Developers can push` check box.
+
+On already protected branches you can also allow developers to push to the repository by selecting the `Developers can push` check box.
+
+
+
+
diff --git a/doc/workflow/protected_branches/protected_branches1.png b/doc/workflow/protected_branches/protected_branches1.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c2a3de5f7043225788bb65cf35652525a0bb357
Binary files /dev/null and b/doc/workflow/protected_branches/protected_branches1.png differ
diff --git a/doc/workflow/protected_branches/protected_branches2.png b/doc/workflow/protected_branches/protected_branches2.png
new file mode 100644
index 0000000000000000000000000000000000000000..2dca35413655a79768911db229db1462e5397018
Binary files /dev/null and b/doc/workflow/protected_branches/protected_branches2.png differ
diff --git a/docker/Dockerfile b/docker/Dockerfile
index aea59916c7a5372dfe517a1fc06aafda360ff858..445fdd6d06337b078ecdbba4c52e26cfa5902d07 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -2,16 +2,16 @@ FROM ubuntu:14.04
# Install required packages
RUN apt-get update -q \
- && DEBIAN_FRONTEND=noninteractive apt-get install -qy \
+ && DEBIAN_FRONTEND=noninteractive apt-get install -qy --no-install-recommends \
+ ca-certificates \
openssh-server \
- wget \
- && apt-get clean
+ wget
# Download & Install GitLab
# If the Omnibus package version below is outdated please contribute a merge request to update it.
# If you run GitLab Enterprise Edition point it to a location where you have downloaded it.
RUN TMP_FILE=$(mktemp); \
- wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.5.2-omnibus.5.2.1.ci-1_amd64.deb \
+ wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.6.2-omnibus.5.3.0.ci.1-1_amd64.deb \
&& dpkg -i $TMP_FILE \
&& rm -f $TMP_FILE
diff --git a/features/admin/settings.feature b/features/admin/settings.feature
new file mode 100644
index 0000000000000000000000000000000000000000..8fdf0575c2c346f8457cebd37982f3f02d0aeeb4
--- /dev/null
+++ b/features/admin/settings.feature
@@ -0,0 +1,9 @@
+@admin
+Feature: Admin Settings
+ Background:
+ Given I sign in as an admin
+ And I visit admin settings page
+
+ Scenario: Change application settings
+ When I modify settings and save form
+ Then I should see application settings saved
diff --git a/features/admin/users.feature b/features/admin/users.feature
index 278f6a43e942d19cf194ef93bdd50fe1c0b7ae46..1a8720dd77edfb081a99badfc4b3e047e6baa19e 100644
--- a/features/admin/users.feature
+++ b/features/admin/users.feature
@@ -35,3 +35,13 @@ Feature: Admin Users
And I see the secondary email
When I click remove secondary email
Then I should not see secondary email anymore
+
+ Scenario: Show user keys
+ Given user "Pete" with ssh keys
+ And I visit admin users page
+ And click on user "Pete"
+ Then I should see key list
+ And I click on the key title
+ Then I should see key details
+ And I click on remove key
+ Then I should see the key removed
diff --git a/features/explore/groups.feature b/features/explore/groups.feature
index b50a3e766c64449e020f46b6efbcb982aa3bc3f0..c11634bd74a800b23d145995768c2bc48c97c50d 100644
--- a/features/explore/groups.feature
+++ b/features/explore/groups.feature
@@ -28,7 +28,6 @@ Feature: Explore Groups
Given group "TestGroup" has internal project "Internal"
When I sign in as a user
And I visit group "TestGroup" issues page
- And I change filter to Everyone's
Then I should see project "Internal" items
And I should not see project "Enterprise" items
@@ -36,7 +35,6 @@ Feature: Explore Groups
Given group "TestGroup" has internal project "Internal"
When I sign in as a user
And I visit group "TestGroup" merge requests page
- And I change filter to Everyone's
Then I should see project "Internal" items
And I should not see project "Enterprise" items
@@ -94,7 +92,6 @@ Feature: Explore Groups
Given group "TestGroup" has public project "Community"
When I sign in as a user
And I visit group "TestGroup" issues page
- And I change filter to Everyone's
Then I should see project "Community" items
And I should see project "Internal" items
And I should not see project "Enterprise" items
@@ -104,7 +101,6 @@ Feature: Explore Groups
Given group "TestGroup" has public project "Community"
When I sign in as a user
And I visit group "TestGroup" merge requests page
- And I change filter to Everyone's
Then I should see project "Community" items
And I should see project "Internal" items
And I should not see project "Enterprise" items
diff --git a/features/profile/profile.feature b/features/profile/profile.feature
index d7fa370fe2a81b52d4677c9995dbc67a8e75ac2e..d586167cdf5599e102226fe25e8bf9d826ea5fc8 100644
--- a/features/profile/profile.feature
+++ b/features/profile/profile.feature
@@ -71,6 +71,20 @@ Feature: Profile
And I click on my profile picture
Then I should see my user page
+ Scenario: I can manage application
+ Given I visit profile applications page
+ Then I click on new application button
+ And I should see application form
+ Then I fill application form out and submit
+ And I see application
+ Then I click edit
+ And I see edit application form
+ Then I change name of application and submit
+ And I see that application was changed
+ Then I visit profile applications page
+ And I click to remove application
+ Then I see that application is removed
+
@javascript
Scenario: I change my application theme
Given I visit profile design page
@@ -83,22 +97,3 @@ Feature: Profile
Given I visit profile design page
When I change my code preview theme
Then I should receive feedback that the changes were saved
-
- @javascript
- Scenario: I see the password strength indicator
- Given I visit profile password page
- When I try to set a weak password
- Then I should see the input field yellow
-
- @javascript
- Scenario: I see the password strength indicator error
- Given I visit profile password page
- When I try to set a short password
- Then I should see the input field red
- And I should see the password error message
-
- @javascript
- Scenario: I see the password strength indicator with success
- Given I visit profile password page
- When I try to set a strong password
- Then I should see the input field green
\ No newline at end of file
diff --git a/features/project/service.feature b/features/project/service.feature
index ed9e03b428d41f1b1c9c8cdd75323e6f05d9aeb4..85939a5c9ca38e4d16b82d49170a834fc7d144b9 100644
--- a/features/project/service.feature
+++ b/features/project/service.feature
@@ -66,3 +66,10 @@ Feature: Project Services
And I click Atlassian Bamboo CI service link
And I fill Atlassian Bamboo CI settings
Then I should see Atlassian Bamboo CI service settings saved
+
+ Scenario: Activate jetBrains TeamCity CI service
+ When I visit project "Shop" services page
+ And I click jetBrains TeamCity CI service link
+ And I fill jetBrains TeamCity CI settings
+ Then I should see jetBrains TeamCity CI service settings saved
+
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index b7d70881d56cf2127fecf431b495ff34a71c6840..6ea64f700927567b583ba938199ba9c36f77cb90 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -50,6 +50,16 @@ Feature: Project Source Browse Files
And I click button "Edit"
Then I can edit code
+ Scenario: If the file is binary the edit link is hidden
+ Given I visit a binary file in the repo
+ Then I cannot see the edit button
+
+ Scenario: If I don't have edit permission the edit link is disabled
+ Given public project "Community"
+ And I visit project "Community" source page
+ And I click on ".gitignore" file in repo
+ Then The edit button is disabled
+
@javascript
Scenario: I can edit and commit file
Given I click on ".gitignore" file in repo
diff --git a/features/steps/admin/groups.rb b/features/steps/admin/groups.rb
index d69a87cd07ef9d9b9747aab9e75c0d05f75d85ad..4171398e56887ad3777b030ca164ea4b82a91f9e 100644
--- a/features/steps/admin/groups.rb
+++ b/features/steps/admin/groups.rb
@@ -22,7 +22,7 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
step 'submit form with new group info' do
- fill_in 'group_name', with: 'gitlab'
+ fill_in 'group_path', with: 'gitlab'
fill_in 'group_description', with: 'Group description'
click_button "Create group"
end
diff --git a/features/steps/admin/settings.rb b/features/steps/admin/settings.rb
new file mode 100644
index 0000000000000000000000000000000000000000..c2d0d2a3fa35ca17eace300b9ee3b509a417322a
--- /dev/null
+++ b/features/steps/admin/settings.rb
@@ -0,0 +1,18 @@
+class Spinach::Features::AdminSettings < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedAdmin
+ include Gitlab::CurrentSettings
+
+ step 'I modify settings and save form' do
+ uncheck 'Gravatar enabled'
+ fill_in 'Home page url', with: 'https://about.gitlab.com/'
+ click_button 'Save'
+ end
+
+ step 'I should see application settings saved' do
+ current_application_settings.gravatar_enabled.should be_false
+ current_application_settings.home_page_url.should == 'https://about.gitlab.com/'
+ page.should have_content 'Application settings saved successfully'
+ end
+end
diff --git a/features/steps/admin/users.rb b/features/steps/admin/users.rb
index 546c1bf2a12279eef607a20b7bb7006b60e0113d..e13830972487e0e4c99e1b94a806ca9d29900793 100644
--- a/features/steps/admin/users.rb
+++ b/features/steps/admin/users.rb
@@ -82,4 +82,36 @@ class Spinach::Features::AdminUsers < Spinach::FeatureSteps
page.should have_content 'Account'
page.should have_content 'Personal projects limit'
end
+
+ step 'user "Pete" with ssh keys' do
+ user = create(:user, name: 'Pete')
+ create(:key, user: user, title: "ssh-rsa Key1", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4FIEBXGi4bPU8kzxMefudPIJ08/gNprdNTaO9BR/ndy3+58s2HCTw2xCHcsuBmq+TsAqgEidVq4skpqoTMB+Uot5Uzp9z4764rc48dZiI661izoREoKnuRQSsRqUTHg5wrLzwxlQbl1MVfRWQpqiz/5KjBC7yLEb9AbusjnWBk8wvC1bQPQ1uLAauEA7d836tgaIsym9BrLsMVnR4P1boWD3Xp1B1T/ImJwAGHvRmP/ycIqmKdSpMdJXwxcb40efWVj0Ibbe7ii9eeoLdHACqevUZi6fwfbymdow+FeqlkPoHyGg3Cu4vD/D8+8cRc7mE/zGCWcQ15Var83Tczour Key1")
+ create(:key, user: user, title: "ssh-rsa Key2", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2")
+ end
+
+ step 'click on user "Pete"' do
+ click_link 'Pete'
+ end
+
+ step 'I should see key list' do
+ page.should have_content 'ssh-rsa Key2'
+ page.should have_content 'ssh-rsa Key1'
+ end
+
+ step 'I click on the key title' do
+ click_link 'ssh-rsa Key2'
+ end
+
+ step 'I should see key details' do
+ page.should have_content 'ssh-rsa Key2'
+ page.should have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2'
+ end
+
+ step 'I click on remove key' do
+ click_link 'Remove'
+ end
+
+ step 'I should see the key removed' do
+ page.should_not have_content 'ssh-rsa Key2'
+ end
end
diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb
index 2a5850d091b05fe7d9c8ca1033f3c3d8164ae4d9..b77113e397426e1e68de9778bc00df2587bf06f3 100644
--- a/features/steps/dashboard/issues.rb
+++ b/features/steps/dashboard/issues.rb
@@ -35,14 +35,20 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
- within ".scope-filter" do
- click_link 'Created by me'
+ within ".assignee-filter" do
+ click_link "Any"
+ end
+ within ".author-filter" do
+ click_link current_user.name
end
end
step 'I click "All" link' do
- within ".scope-filter" do
- click_link "Everyone's"
+ within ".author-filter" do
+ click_link "Any"
+ end
+ within ".assignee-filter" do
+ click_link "Any"
end
end
diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb
index 75e53173d3f2cdad71ec00b7a560e20b369f9d5e..6261c89924cbb1fa1818e28cc080f4cb4d5eb860 100644
--- a/features/steps/dashboard/merge_requests.rb
+++ b/features/steps/dashboard/merge_requests.rb
@@ -39,14 +39,20 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
end
step 'I click "Authored by me" link' do
- within ".scope-filter" do
- click_link 'Created by me'
+ within ".assignee-filter" do
+ click_link "Any"
+ end
+ within ".author-filter" do
+ click_link current_user.name
end
end
step 'I click "All" link' do
- within ".scope-filter" do
- click_link "Everyone's"
+ within ".author-filter" do
+ click_link "Any"
+ end
+ within ".assignee-filter" do
+ click_link "Any"
end
end
diff --git a/features/steps/groups.rb b/features/steps/groups.rb
index 616a297db999ee99559980a5098193a4eededcc3..f09d751dba3f0ceeb2d6aada6cb52f64a398846e 100644
--- a/features/steps/groups.rb
+++ b/features/steps/groups.rb
@@ -77,7 +77,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'submit form with new group "Samurai" info' do
- fill_in 'group_name', with: 'Samurai'
+ fill_in 'group_path', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
@@ -89,17 +89,17 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
- page.should have_content "Currently you are only seeing events from the"
end
step 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name'
+ fill_in 'group_path', with: 'new-name'
click_button "Save group"
end
step 'I should see new group "Owned" name' do
within ".navbar-gitlab" do
- page.should have_content "group: new-name"
+ page.should have_content "new-name"
end
end
@@ -188,7 +188,6 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
step 'I should see group milestone with descriptions and expiry date' do
- page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry')
page.should have_content('expires at Aug 20, 2114')
end
diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb
index 38aaadcd28d62500b1381e746430f6eafa91f285..a907b0b7dcfc71972722ef1d481af501e4a95e12 100644
--- a/features/steps/profile/profile.rb
+++ b/features/steps/profile/profile.rb
@@ -58,34 +58,16 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I try change my password w/o old one' do
within '.update-password' do
- fill_in "user_password_profile", with: "22233344"
+ fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344"
click_button "Save"
end
end
- step 'I try to set a weak password' do
- within '.update-password' do
- fill_in "user_password_profile", with: "22233344"
- end
- end
-
- step 'I try to set a short password' do
- within '.update-password' do
- fill_in "user_password_profile", with: "short"
- end
- end
-
- step 'I try to set a strong password' do
- within '.update-password' do
- fill_in "user_password_profile", with: "Itulvo9z8uud%$"
- end
- end
-
step 'I change my password' do
within '.update-password' do
fill_in "user_current_password", with: "12345678"
- fill_in "user_password_profile", with: "22233344"
+ fill_in "user_password", with: "22233344"
fill_in "user_password_confirmation", with: "22233344"
click_button "Save"
end
@@ -94,7 +76,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I unsuccessfully change my password' do
within '.update-password' do
fill_in "user_current_password", with: "12345678"
- fill_in "user_password_profile", with: "password"
+ fill_in "user_password", with: "password"
fill_in "user_password_confirmation", with: "confirmation"
click_button "Save"
end
@@ -104,22 +86,6 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
page.should have_content "You must provide a valid current password"
end
- step 'I should see the input field yellow' do
- page.should have_css 'div.has-warning'
- end
-
- step 'I should see the input field green' do
- page.should have_css 'div.has-success'
- end
-
- step 'I should see the input field red' do
- page.should have_css 'div.has-error'
- end
-
- step 'I should see the password error message' do
- page.should have_content 'Your password is too short'
- end
-
step "I should see a password error message" do
page.should have_content "Password confirmation doesn't match"
end
@@ -180,7 +146,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I submit new password' do
fill_in :user_current_password, with: '12345678'
- fill_in :user_password_profile, with: '12345678'
+ fill_in :user_password, with: '12345678'
fill_in :user_password_confirmation, with: '12345678'
click_button "Set new password"
end
@@ -221,4 +187,54 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step 'I should see groups I belong to' do
page.should have_css('.profile-groups-avatars', visible: true)
end
+
+ step 'I click on new application button' do
+ click_on 'New Application'
+ end
+
+ step 'I should see application form' do
+ page.should have_content "New application"
+ end
+
+ step 'I fill application form out and submit' do
+ fill_in :doorkeeper_application_name, with: 'test'
+ fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
+ click_on "Submit"
+ end
+
+ step 'I see application' do
+ page.should have_content "Application: test"
+ page.should have_content "Application Id"
+ page.should have_content "Secret"
+ end
+
+ step 'I click edit' do
+ click_on "Edit"
+ end
+
+ step 'I see edit application form' do
+ page.should have_content "Edit application"
+ end
+
+ step 'I change name of application and submit' do
+ page.should have_content "Edit application"
+ fill_in :doorkeeper_application_name, with: 'test_changed'
+ click_on "Submit"
+ end
+
+ step 'I see that application was changed' do
+ page.should have_content "test_changed"
+ page.should have_content "Application Id"
+ page.should have_content "Secret"
+ end
+
+ step 'I click to remove application' do
+ within '.oauth-applications' do
+ click_on "Destroy"
+ end
+ end
+
+ step "I see that application is removed" do
+ page.find(".oauth-applications").should_not have_content "test_changed"
+ end
end
diff --git a/features/steps/profile/ssh_keys.rb b/features/steps/profile/ssh_keys.rb
index d1e87d407054123511d48ca00250c69a08cfde05..ea912e5b4da0c10f271db8ba8ca9593354d2da2f 100644
--- a/features/steps/profile/ssh_keys.rb
+++ b/features/steps/profile/ssh_keys.rb
@@ -37,9 +37,7 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
end
step 'I should not see "Work" ssh key' do
- within "#keys-table" do
- page.should_not have_content "Work"
- end
+ page.should_not have_content "Work"
end
step 'I have ssh key "ssh-rsa Work"' do
diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb
index 935f313e2981c9c19ee76e68d18515b72bcfa44a..d515ee1ac116fbabb9a413502dcc32e83c53232b 100644
--- a/features/steps/project/commits/commits.rb
+++ b/features/steps/project/commits/commits.rb
@@ -78,14 +78,14 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
step 'I click side-by-side diff button' do
- click_link "Side-by-side Diff"
+ click_link "Side-by-side"
end
step 'I see side-by-side diff button' do
- page.should have_content "Side-by-side Diff"
+ page.should have_content "Side-by-side"
end
step 'I see inline diff button' do
- page.should have_content "Inline Diff"
+ page.should have_content "Inline"
end
end
diff --git a/features/steps/project/create.rb b/features/steps/project/create.rb
index e1062a6ce39d99f65fa61858946228ac3ff4ca8a..6b07b62f16f7998ef3ecb84325796d66068ecb13 100644
--- a/features/steps/project/create.rb
+++ b/features/steps/project/create.rb
@@ -3,7 +3,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
include SharedPaths
step 'fill project form with valid data' do
- fill_in 'project_name', with: 'Empty'
+ fill_in 'project_path', with: 'Empty'
click_button "Create project"
end
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index d5e060bdbe818ed9328745d5a8176079ff89244f..5d8247a2ccc9c3ab2048183e770dd4fb8751fe0b 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -57,9 +57,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click link "Close"' do
- within '.page-title' do
- click_link "Close"
- end
+ first(:css, '.close-mr-link').click
end
step 'I submit new merge request "Wiki Feature"' do
@@ -111,7 +109,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click on the commit in the merge request' do
- within '.mr-commits' do
+ within '.merge-request-tabs' do
+ click_link 'Commits'
+ end
+
+ within '.commits' do
click_link Commit.truncate_sha(sample_commit.id)
end
end
@@ -154,7 +156,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'merge request is mergeable' do
- page.should have_content 'You can accept this request automatically'
+ page.should have_button 'Accept Merge Request'
end
step 'I modify merge commit message' do
@@ -181,13 +183,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click link "Reopen"' do
- within '.page-title' do
- click_link "Reopen"
- end
+ first(:css, '.reopen-mr-link').click
end
step 'I should see reopened merge request "Bug NS-04"' do
- within '.state-label' do
+ within '.issue-box' do
page.should have_content "Open"
end
end
@@ -265,11 +265,11 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click Side-by-side Diff tab' do
- click_link 'Side-by-side Diff'
+ find('a', text: 'Side-by-side').trigger('click')
end
step 'I should see comments on the side-by-side diff page' do
- within '.files [id^=diff]:nth-child(1) .note-text' do
+ within '.files [id^=diff]:nth-child(1) .parallel .note-text' do
page.should have_visible_content "Line is correct"
end
end
diff --git a/features/steps/project/services.rb b/features/steps/project/services.rb
index 7a0b47a8fe532567fbf4593af706c3cc67671282..09e86447058eeec741837d73083b82caa3a4461c 100644
--- a/features/steps/project/services.rb
+++ b/features/steps/project/services.rb
@@ -15,6 +15,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
page.should have_content 'Assembla'
page.should have_content 'Pushover'
page.should have_content 'Atlassian Bamboo'
+ page.should have_content 'JetBrains TeamCity'
end
step 'I click gitlab-ci service link' do
@@ -168,4 +169,23 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
find_field('Build key').value.should == 'KEY'
find_field('Username').value.should == 'user'
end
+
+ step 'I click JetBrains TeamCity CI service link' do
+ click_link 'JetBrains TeamCity CI'
+ end
+
+ step 'I fill JetBrains TeamCity CI settings' do
+ check 'Active'
+ fill_in 'Teamcity url', with: 'http://teamcity.example.com'
+ fill_in 'Build type', with: 'GitlabTest_Build'
+ fill_in 'Username', with: 'user'
+ fill_in 'Password', with: 'verySecret'
+ click_button 'Save'
+ end
+
+ step 'I should see JetBrains TeamCity CI service settings saved' do
+ find_field('Teamcity url').value.should == 'http://teamcity.example.com'
+ find_field('Build type').value.should == 'GitlabTest_Build'
+ find_field('Username').value.should == 'user'
+ end
end
diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb
index ddd501d4f88288159e9687794327715465d7f5f3..805e6ff0eac1b0607b0b2a108fc6df0775bbf5c2 100644
--- a/features/steps/project/source/browse_files.rb
+++ b/features/steps/project/source/browse_files.rb
@@ -48,6 +48,14 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
click_link 'Edit'
end
+ step 'I cannot see the edit button' do
+ page.should_not have_link 'edit'
+ end
+
+ step 'The edit button is disabled' do
+ page.should have_css '.disabled', text: 'Edit'
+ end
+
step 'I can edit code' do
set_new_content
evaluate_script('editor.getValue()').should == new_gitignore_content
diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb
index f41b59a6f2b5160c08514de4e7de1f7270f97e43..c229864bc8305db189431aa16f7a726f154c6b61 100644
--- a/features/steps/shared/active_tab.rb
+++ b/features/steps/shared/active_tab.rb
@@ -2,7 +2,7 @@ module SharedActiveTab
include Spinach::DSL
def ensure_active_main_tab(content)
- find('.main-nav li.active').should have_content(content)
+ find('.nav-sidebar > li.active').should have_content(content)
end
def ensure_active_sub_tab(content)
@@ -10,11 +10,11 @@ module SharedActiveTab
end
def ensure_active_sub_nav(content)
- find('div.content ul.nav-stacked-menu li.active').should have_content(content)
+ find('.sidebar-subnav > li.active').should have_content(content)
end
step 'no other main tabs should be active' do
- page.should have_selector('.main-nav li.active', count: 1)
+ page.should have_selector('.nav-sidebar > li.active', count: 1)
end
step 'no other sub tabs should be active' do
@@ -22,7 +22,7 @@ module SharedActiveTab
end
step 'no other sub navs should be active' do
- page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
+ page.should have_selector('.sidebar-subnav > li.active', count: 1)
end
step 'the active main tab should be Home' do
diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb
index a0150e90380d00ebc979ed104eeb212ef759837a..41db2612f2623f75147e4e8fc98c5cc85c0589f5 100644
--- a/features/steps/shared/issuable.rb
+++ b/features/steps/shared/issuable.rb
@@ -2,7 +2,7 @@ module SharedIssuable
include Spinach::DSL
def edit_issuable
- find('.issue-btn-group').click_link 'Edit'
+ find(:css, '.issuable-edit').click
end
step 'I click link "Edit" for the merge request' do
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 5f292255ce137a3b244621c1d8d649b9c1f7d3f4..689b297dffc2d7b789ce720c9e48aabf8949b155 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -1,6 +1,7 @@
module SharedPaths
include Spinach::DSL
include RepoHelpers
+ include DashboardHelper
step 'I visit new project page' do
visit new_project_path
@@ -71,11 +72,11 @@ module SharedPaths
end
step 'I visit dashboard issues page' do
- visit issues_dashboard_path
+ visit assigned_issues_dashboard_path
end
step 'I visit dashboard merge requests page' do
- visit merge_requests_dashboard_path
+ visit assigned_mrs_dashboard_path
end
step 'I visit dashboard search page' do
@@ -94,6 +95,10 @@ module SharedPaths
visit profile_path
end
+ step 'I visit profile applications page' do
+ visit applications_profile_path
+ end
+
step 'I visit profile password page' do
visit edit_profile_password_path
end
@@ -162,6 +167,10 @@ module SharedPaths
visit admin_teams_path
end
+ step 'I visit admin settings page' do
+ visit admin_application_settings_path
+ end
+
# ----------------------------------------
# Generic Project
# ----------------------------------------
@@ -178,6 +187,11 @@ module SharedPaths
visit project_tree_path(@project, root_ref)
end
+ step 'I visit a binary file in the repo' do
+ visit project_blob_path(@project, File.join(
+ root_ref, 'files/images/logo-black.png'))
+ end
+
step "I visit my project's commits page" do
visit project_commits_path(@project, root_ref, {limit: 5})
end
@@ -380,6 +394,11 @@ module SharedPaths
visit project_path(project)
end
+ step 'I visit project "Community" source page' do
+ project = Project.find_by(name: 'Community')
+ visit project_tree_path(project, root_ref)
+ end
+
step 'I visit project "Internal" page' do
project = Project.find_by(name: "Internal")
visit project_path(project)
diff --git a/lib/api/api.rb b/lib/api/api.rb
index d26667ba3f7ad34db41fbf8c1df19cc04b7cacfe..cb46f477ff9e96592583889d0d1c18c5a07d4e90 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -2,6 +2,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module API
class API < Grape::API
+ include APIGuard
version 'v3', using: :path
rescue_from ActiveRecord::RecordNotFound do
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
new file mode 100644
index 0000000000000000000000000000000000000000..23975518181cf4bc538d15840c16d8555fcf9cc1
--- /dev/null
+++ b/lib/api/api_guard.rb
@@ -0,0 +1,175 @@
+# Guard API with OAuth 2.0 Access Token
+
+require 'rack/oauth2'
+
+module APIGuard
+ extend ActiveSupport::Concern
+
+ included do |base|
+ # OAuth2 Resource Server Authentication
+ use Rack::OAuth2::Server::Resource::Bearer, 'The API' do |request|
+ # The authenticator only fetches the raw token string
+
+ # Must yield access token to store it in the env
+ request.access_token
+ end
+
+ helpers HelperMethods
+
+ install_error_responders(base)
+ end
+
+ # Helper Methods for Grape Endpoint
+ module HelperMethods
+ # Invokes the doorkeeper guard.
+ #
+ # If token is presented and valid, then it sets @current_user.
+ #
+ # If the token does not have sufficient scopes to cover the requred scopes,
+ # then it raises InsufficientScopeError.
+ #
+ # If the token is expired, then it raises ExpiredError.
+ #
+ # If the token is revoked, then it raises RevokedError.
+ #
+ # If the token is not found (nil), then it raises TokenNotFoundError.
+ #
+ # Arguments:
+ #
+ # scopes: (optional) scopes required for this guard.
+ # Defaults to empty array.
+ #
+ def doorkeeper_guard!(scopes: [])
+ if (access_token = find_access_token).nil?
+ raise TokenNotFoundError
+
+ else
+ case validate_access_token(access_token, scopes)
+ when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
+ raise InsufficientScopeError.new(scopes)
+
+ when Oauth2::AccessTokenValidationService::EXPIRED
+ raise ExpiredError
+
+ when Oauth2::AccessTokenValidationService::REVOKED
+ raise RevokedError
+
+ when Oauth2::AccessTokenValidationService::VALID
+ @current_user = User.find(access_token.resource_owner_id)
+
+ end
+ end
+ end
+
+ def doorkeeper_guard(scopes: [])
+ if access_token = find_access_token
+ case validate_access_token(access_token, scopes)
+ when Oauth2::AccessTokenValidationService::INSUFFICIENT_SCOPE
+ raise InsufficientScopeError.new(scopes)
+
+ when Oauth2::AccessTokenValidationService::EXPIRED
+ raise ExpiredError
+
+ when Oauth2::AccessTokenValidationService::REVOKED
+ raise RevokedError
+
+ when Oauth2::AccessTokenValidationService::VALID
+ @current_user = User.find(access_token.resource_owner_id)
+ end
+ end
+ end
+
+ def current_user
+ @current_user
+ end
+
+ private
+ def find_access_token
+ @access_token ||= Doorkeeper.authenticate(doorkeeper_request, Doorkeeper.configuration.access_token_methods)
+ end
+
+ def doorkeeper_request
+ @doorkeeper_request ||= ActionDispatch::Request.new(env)
+ end
+
+ def validate_access_token(access_token, scopes)
+ Oauth2::AccessTokenValidationService.validate(access_token, scopes: scopes)
+ end
+ end
+
+ module ClassMethods
+ # Installs the doorkeeper guard on the whole Grape API endpoint.
+ #
+ # Arguments:
+ #
+ # scopes: (optional) scopes required for this guard.
+ # Defaults to empty array.
+ #
+ def guard_all!(scopes: [])
+ before do
+ guard! scopes: scopes
+ end
+ end
+
+ private
+ def install_error_responders(base)
+ error_classes = [ MissingTokenError, TokenNotFoundError,
+ ExpiredError, RevokedError, InsufficientScopeError]
+
+ base.send :rescue_from, *error_classes, oauth2_bearer_token_error_handler
+ end
+
+ def oauth2_bearer_token_error_handler
+ Proc.new {|e|
+ response = case e
+ when MissingTokenError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new
+
+ when TokenNotFoundError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Bad Access Token.")
+
+ when ExpiredError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Token is expired. You can either do re-authorization or token refresh.")
+
+ when RevokedError
+ Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(
+ :invalid_token,
+ "Token was revoked. You have to re-authorize from the user.")
+
+ when InsufficientScopeError
+ # FIXME: ForbiddenError (inherited from Bearer::Forbidden of Rack::Oauth2)
+ # does not include WWW-Authenticate header, which breaks the standard.
+ Rack::OAuth2::Server::Resource::Bearer::Forbidden.new(
+ :insufficient_scope,
+ Rack::OAuth2::Server::Resource::ErrorMethods::DEFAULT_DESCRIPTION[:insufficient_scope],
+ { :scope => e.scopes})
+ end
+
+ response.finish
+ }
+ end
+ end
+
+ #
+ # Exceptions
+ #
+
+ class MissingTokenError < StandardError; end
+
+ class TokenNotFoundError < StandardError; end
+
+ class ExpiredError < StandardError; end
+
+ class RevokedError < StandardError; end
+
+ class InsufficientScopeError < StandardError
+ attr_reader :scopes
+ def initialize(scopes)
+ @scopes = scopes
+ end
+ end
+end
\ No newline at end of file
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 6ec1a753a69da9ade3d860d7492690f12d23053a..b52d786e0209ade5cef92d4f9f6821f765c3dff2 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -14,7 +14,8 @@ module API
# Example Request:
# GET /projects/:id/repository/branches
get ":id/repository/branches" do
- present user_project.repository.branches.sort_by(&:name), with: Entities::RepoObject, project: user_project
+ branches = user_project.repository.branches.sort_by(&:name)
+ present branches, with: Entities::RepoObject, project: user_project
end
# Get a single branch
@@ -26,7 +27,7 @@ module API
# GET /projects/:id/repository/branches/:branch
get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do
@branch = user_project.repository.branches.find { |item| item.name == params[:branch] }
- not_found!("Branch does not exist") if @branch.nil?
+ not_found!("Branch") unless @branch
present @branch, with: Entities::RepoObject, project: user_project
end
@@ -43,7 +44,7 @@ module API
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])
- not_found! unless @branch
+ not_found!("Branch") unless @branch
protected_branch = user_project.protected_branches.find_by(name: @branch.name)
user_project.protected_branches.create(name: @branch.name) unless protected_branch
@@ -63,7 +64,7 @@ module API
authorize_admin_project
@branch = user_project.repository.find_branch(params[:branch])
- not_found! unless @branch
+ not_found!("Branch does not exist") unless @branch
protected_branch = user_project.protected_branches.find_by(name: @branch.name)
protected_branch.destroy if protected_branch
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 6c5391b98c820dff50a4931bcbf2c03c4e9e2bf3..0de4e720ffe00ca8c8af9b0746e234b7d0ac3902 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -108,7 +108,7 @@ module API
if note.save
present note, with: Entities::CommitNote
else
- not_found!
+ render_api_error!("Failed to save note #{note.errors.messages}", 400)
end
end
end
diff --git a/lib/api/files.rb b/lib/api/files.rb
index 84e1d3117816e30111c2b7ca7155d28fab63c82d..e6e71bac367bf8dff50b5989553616dd2961b408 100644
--- a/lib/api/files.rb
+++ b/lib/api/files.rb
@@ -35,7 +35,7 @@ module API
file_path = attrs.delete(:file_path)
commit = user_project.repository.commit(ref)
- not_found! "Commit" unless commit
+ not_found! 'Commit' unless commit
blob = user_project.repository.blob_at(commit.sha, file_path)
@@ -53,7 +53,7 @@ module API
commit_id: commit.id,
}
else
- render_api_error!('File not found', 404)
+ not_found! 'File'
end
end
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index f0ab6938b1c3be04bc2413d4a474534ba5e23835..bda60b3b7d53aa3e49841e4ae4d297800da8d6ad 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -25,11 +25,14 @@ module API
# Example Request:
# GET /groups
get do
- if current_user.admin
- @groups = paginate Group
- else
- @groups = paginate current_user.groups
- end
+ @groups = if current_user.admin
+ Group.all
+ else
+ current_user.groups
+ end
+
+ @groups = @groups.search(params[:search]) if params[:search].present?
+ @groups = paginate @groups
present @groups, with: Entities::Group
end
@@ -51,7 +54,7 @@ module API
if @group.save
present @group, with: Entities::Group
else
- not_found!
+ render_api_error!("Failed to save group #{@group.errors.messages}", 400)
end
end
@@ -94,7 +97,7 @@ module API
if result
present group
else
- not_found!
+ render_api_error!("Failed to transfer project #{project.errors.messages}", 400)
end
end
end
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 027fb20ec469058805e263004dbb28007ca25a16..62c26ef76ceef32200f22d52966cc81976d829df 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -11,7 +11,7 @@ module API
def current_user
private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s
- @current_user ||= User.find_by(authentication_token: private_token)
+ @current_user ||= (User.find_by(authentication_token: private_token) || doorkeeper_guard)
unless @current_user && Gitlab::UserAccess.allowed?(@current_user)
return nil
@@ -42,7 +42,7 @@ module API
def user_project
@project ||= find_project(params[:id])
- @project || not_found!
+ @project || not_found!("Project")
end
def find_project(id)
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index a365f1db00f6f07ad4c6fba2fd75a8725e89a3db..81038d05f121cf003ef3a2d4ef139b3f350ccf92 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -233,7 +233,7 @@ module API
if note.save
present note, with: Entities::MRNote
else
- render_validation_error!(note)
+ render_api_error!("Failed to save note #{note.errors.messages}", 400)
end
end
end
diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb
index a4fdb752d69a3a73c4978c0649c7fbf166232b81..2ea49359df00edd128d64ad59fe4d15c136f35d2 100644
--- a/lib/api/milestones.rb
+++ b/lib/api/milestones.rb
@@ -48,7 +48,7 @@ module API
if milestone.valid?
present milestone, with: Entities::Milestone
else
- not_found!
+ render_api_error!("Failed to create milestone #{milestone.errors.messages}", 400)
end
end
@@ -72,7 +72,7 @@ module API
if milestone.valid?
present milestone, with: Entities::Milestone
else
- not_found!
+ render_api_error!("Failed to update milestone #{milestone.errors.messages}", 400)
end
end
end
diff --git a/lib/api/notes.rb b/lib/api/notes.rb
index 0ef9a3c4beb17e1fdea6179b93e58e8722c93122..3726be7c5374c151be3e9db957a4be886b3d3537 100644
--- a/lib/api/notes.rb
+++ b/lib/api/notes.rb
@@ -61,9 +61,42 @@ module API
if @note.valid?
present @note, with: Entities::Note
else
- not_found!
+ not_found!("Note #{@note.errors.messages}")
end
end
+
+ # Modify existing +noteable+ note
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # noteable_id (required) - The ID of an issue or snippet
+ # node_id (required) - The ID of a note
+ # body (required) - New content of a note
+ # Example Request:
+ # PUT /projects/:id/issues/:noteable_id/notes/:note_id
+ # PUT /projects/:id/snippets/:noteable_id/notes/:node_id
+ put ":id/#{noteables_str}/:#{noteable_id_str}/notes/:note_id" do
+ required_attributes! [:body]
+
+ authorize! :admin_note, user_project.notes.find(params[:note_id])
+
+ opts = {
+ note: params[:body],
+ note_id: params[:note_id],
+ noteable_type: noteables_str.classify,
+ noteable_id: params[noteable_id_str]
+ }
+
+ @note = ::Notes::UpdateService.new(user_project, current_user,
+ opts).execute
+
+ if @note.valid?
+ present @note, with: Entities::Note
+ else
+ render_api_error!("Failed to save note #{note.errors.messages}", 400)
+ end
+ end
+
end
end
end
diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb
index 7d056b9bf5872c4f6bbf78740c83d17f77a60bed..be9850367b9835def0549af04147db482f12e275 100644
--- a/lib/api/project_hooks.rb
+++ b/lib/api/project_hooks.rb
@@ -53,7 +53,7 @@ module API
if @hook.errors[:url].present?
error!("Invalid url given", 422)
end
- not_found!
+ not_found!("Project hook #{@hook.errors.messages}")
end
end
@@ -82,7 +82,7 @@ module API
if @hook.errors[:url].present?
error!("Invalid url given", 422)
end
- not_found!
+ not_found!("Project hook #{@hook.errors.messages}")
end
end
diff --git a/lib/api/project_members.rb b/lib/api/project_members.rb
index 1595ed0bc3653dc068a8cd7fc318eace0be245de..8e32f124ea5e2abd91273c271bed9d225a320f8f 100644
--- a/lib/api/project_members.rb
+++ b/lib/api/project_members.rb
@@ -9,7 +9,7 @@ module API
if errors[:access_level].any?
error!(errors[:access_level], 422)
end
- not_found!
+ not_found!(errors)
end
end
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 7fcf97d1ad6531c9465bcb18670a64c403151046..b9c95c785f2d8f17674b2da6e42634571cc22f31 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -15,19 +15,29 @@ module API
# Get a projects list for authenticated user
#
- # Parameters:
- # archived (optional) - if passed, limit by archived status
- #
# Example Request:
# GET /projects
get do
@projects = current_user.authorized_projects
+ sort = params[:sort] == 'desc' ? 'desc' : 'asc'
+
+ @projects = case params["order_by"]
+ when 'id' then @projects.reorder("id #{sort}")
+ when 'name' then @projects.reorder("name #{sort}")
+ when 'created_at' then @projects.reorder("created_at #{sort}")
+ when 'last_activity_at' then @projects.reorder("last_activity_at #{sort}")
+ else @projects
+ end
# If the archived parameter is passed, limit results accordingly
if params[:archived].present?
@projects = @projects.where(archived: parse_boolean(params[:archived]))
end
+ if params[:search].present?
+ @projects = @projects.search(params[:search])
+ end
+
@projects = paginate @projects
present @projects, with: Entities::Project
end
@@ -37,7 +47,17 @@ module API
# Example Request:
# GET /projects/owned
get '/owned' do
- @projects = paginate current_user.owned_projects
+ sort = params[:sort] == 'desc' ? 'desc' : 'asc'
+ @projects = current_user.owned_projects
+ @projects = case params["order_by"]
+ when 'id' then @projects.reorder("id #{sort}")
+ when 'name' then @projects.reorder("name #{sort}")
+ when 'created_at' then @projects.reorder("created_at #{sort}")
+ when 'last_activity_at' then @projects.reorder("last_activity_at #{sort}")
+ else @projects
+ end
+
+ @projects = paginate @projects
present @projects, with: Entities::Project
end
@@ -47,7 +67,17 @@ module API
# GET /projects/all
get '/all' do
authenticated_as_admin!
- @projects = paginate Project
+ sort = params[:sort] == 'desc' ? 'desc' : 'asc'
+
+ @projects = case params["order_by"]
+ when 'id' then Project.order("id #{sort}")
+ when 'name' then Project.order("name #{sort}")
+ when 'created_at' then Project.order("created_at #{sort}")
+ when 'last_activity_at' then Project.order("last_activity_at #{sort}")
+ else Project
+ end
+
+ @projects = paginate @projects
present @projects, with: Entities::Project
end
@@ -198,7 +228,7 @@ module API
render_api_error!("Project already forked", 409)
end
else
- not_found!
+ not_found!("Source Project")
end
end
@@ -227,6 +257,16 @@ module API
ids = current_user.authorized_projects.map(&:id)
visibility_levels = [ Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::PUBLIC ]
projects = Project.where("(id in (?) OR visibility_level in (?)) AND (name LIKE (?))", ids, visibility_levels, "%#{params[:query]}%")
+ sort = params[:sort] == 'desc' ? 'desc' : 'asc'
+
+ projects = case params["order_by"]
+ when 'id' then projects.order("id #{sort}")
+ when 'name' then projects.order("name #{sort}")
+ when 'created_at' then projects.order("created_at #{sort}")
+ when 'last_activity_at' then projects.order("last_activity_at #{sort}")
+ else projects
+ end
+
present paginate(projects), with: Entities::Project
end
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index a1a7721b28894cd542d87728fa90bafd4eb0dfd6..03a556a2c5562a7d4731c010324d73bd1a7f8da8 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -133,7 +133,7 @@ module API
env['api.format'] = :binary
present data
else
- not_found!
+ not_found!('File')
end
end
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index 762639414e0e99dede44601d60a03648eb8e8fbb..1f71906bc8ec5081e6e8808aae3f1805bde91491 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -72,8 +72,26 @@ module Grack
end
def authenticate_user(login, password)
- auth = Gitlab::Auth.new
- auth.find(login, password)
+ user = Gitlab::Auth.new.find(login, password)
+ return user if user.present?
+
+ # At this point, we know the credentials were wrong. We let Rack::Attack
+ # know there was a failed authentication attempt from this IP. This
+ # information is stored in the Rails cache (Redis) and will be used by
+ # the Rack::Attack middleware to decide whether to block requests from
+ # this IP.
+ config = Gitlab.config.rack_attack.git_basic_auth
+ Rack::Attack::Allow2Ban.filter(@request.ip, config) do
+ # Unless the IP is whitelisted, return true so that Allow2Ban
+ # increments the counter (stored in Rails.cache) for the IP
+ if config.ip_whitelist.include?(@request.ip)
+ false
+ else
+ true
+ end
+ end
+
+ nil # No user was found
end
def authorized_request?
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
new file mode 100644
index 0000000000000000000000000000000000000000..22ad7ef8c8b9817aa0efda2733dc5ebb193f38b9
--- /dev/null
+++ b/lib/gitlab/current_settings.rb
@@ -0,0 +1,37 @@
+module Gitlab
+ module CurrentSettings
+ def current_application_settings
+ begin
+ if ActiveRecord::Base.connection.table_exists?('application_settings')
+ ApplicationSetting.current ||
+ ApplicationSetting.create_from_defaults
+ else
+ fake_application_settings
+ end
+ rescue ActiveRecord::NoDatabaseError, database_adapter.constantize::Error
+ fake_application_settings
+ end
+ end
+
+ def fake_application_settings
+ OpenStruct.new(
+ default_projects_limit: Settings.gitlab['default_projects_limit'],
+ signup_enabled: Settings.gitlab['signup_enabled'],
+ signin_enabled: Settings.gitlab['signin_enabled'],
+ gravatar_enabled: Settings.gravatar['enabled'],
+ sign_in_text: Settings.extra['sign_in_text'],
+ )
+ end
+
+ # We need to check which database is setup
+ # but we cannot assume that the database exists already.
+ # Not checking this will break "rake gitlab:setup".
+ def database_adapter
+ if Rails.configuration.database_configuration[Rails.env]['adapter'] == 'mysql2'
+ "Mysql2"
+ else
+ "PG"
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb
index 67aca5e36e90580f0b381e7231400bd3e14758bc..4a712c6345f55e052e2b202cd30cc65935e3b5e5 100644
--- a/lib/gitlab/git.rb
+++ b/lib/gitlab/git.rb
@@ -1,5 +1,9 @@
module Gitlab
module Git
BLANK_SHA = '0' * 40
+
+ def self.extract_ref_name(ref)
+ ref.gsub(/\Arefs\/(tags|heads)\//, '')
+ end
end
end
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 875f8d8b3a3149fcda4717eea9777ef52a073548..d47ef61fd1177cf6ef7c676b449582e8937f6ec2 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -79,16 +79,8 @@ module Gitlab
oldrev, newrev, ref = change.split(' ')
action = if project.protected_branch?(branch_name(ref))
- # we dont allow force push to protected branch
- if forced_push?(project, oldrev, newrev)
- :force_push_code_to_protected_branches
- # and we dont allow remove of protected branch
- elsif newrev == Gitlab::Git::BLANK_SHA
- :remove_protected_branches
- else
- :push_code_to_protected_branches
- end
- elsif project.repository.tag_names.include?(tag_name(ref))
+ protected_branch_action(project, oldrev, newrev, branch_name(ref))
+ elsif protected_tag?(project, tag_name(ref))
# Prevent any changes to existing git tag unless user has permissions
:admin_project
else
@@ -108,6 +100,24 @@ module Gitlab
private
+ def protected_branch_action(project, oldrev, newrev, branch_name)
+ # we dont allow force push to protected branch
+ if forced_push?(project, oldrev, newrev)
+ :force_push_code_to_protected_branches
+ # and we dont allow remove of protected branch
+ elsif newrev == Gitlab::Git::BLANK_SHA
+ :remove_protected_branches
+ elsif project.developers_can_push_to_protected_branch?(branch_name)
+ :push_code
+ else
+ :push_code_to_protected_branches
+ end
+ end
+
+ def protected_tag?(project, tag_name)
+ project.repository.tag_names.include?(tag_name)
+ end
+
def user_allowed?(user)
Gitlab::UserAccess.allowed?(user)
end
diff --git a/lib/gitlab/github/client.rb b/lib/gitlab/github/client.rb
new file mode 100644
index 0000000000000000000000000000000000000000..d6b936c649c74ca33e4ed2edc0926fe4835e6944
--- /dev/null
+++ b/lib/gitlab/github/client.rb
@@ -0,0 +1,29 @@
+module Gitlab
+ module Github
+ class Client
+ attr_reader :client
+
+ def initialize
+ @client = ::OAuth2::Client.new(
+ config.app_id,
+ config.app_secret,
+ github_options
+ )
+ end
+
+ private
+
+ def config
+ Gitlab.config.omniauth.providers.select{|provider| provider.name == "github"}.first
+ end
+
+ def github_options
+ {
+ site: 'https://api.github.com',
+ authorize_url: 'https://github.com/login/oauth/authorize',
+ token_url: 'https://github.com/login/oauth/access_token'
+ }
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/github/importer.rb b/lib/gitlab/github/importer.rb
new file mode 100644
index 0000000000000000000000000000000000000000..c72a1c25e9e49e7eb8e192d155a37aab5d6eddf0
--- /dev/null
+++ b/lib/gitlab/github/importer.rb
@@ -0,0 +1,48 @@
+module Gitlab
+ module Github
+ class Importer
+ attr_reader :project
+
+ def initialize(project)
+ @project = project
+ end
+
+ def execute
+ client = octo_client(project.creator.github_access_token)
+
+ #Issues && Comments
+ client.list_issues(project.import_source, state: :all).each do |issue|
+ if issue.pull_request.nil?
+ body = "*Created by: #{issue.user.login}*\n\n#{issue.body}"
+
+ if issue.comments > 0
+ body += "\n\n\n**Imported comments:**\n"
+ client.issue_comments(project.import_source, issue.number).each do |c|
+ body += "\n\n*By #{c.user.login} on #{c.created_at}*\n\n#{c.body}"
+ end
+ end
+
+ project.issues.create!(
+ description: body,
+ title: issue.title,
+ state: issue.state == 'closed' ? 'closed' : 'opened',
+ author_id: gl_user_id(project, issue.user.id)
+ )
+ end
+ end
+ end
+
+ private
+
+ def octo_client(access_token)
+ ::Octokit.auto_paginate = true
+ ::Octokit::Client.new(:access_token => access_token)
+ end
+
+ def gl_user_id(project, github_id)
+ user = User.joins(:identities).find_by("identities.extern_uid = ?", github_id.to_s)
+ (user && user.id) || project.creator_id
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/github/project_creator.rb b/lib/gitlab/github/project_creator.rb
new file mode 100644
index 0000000000000000000000000000000000000000..682ef389e443770a760f5c77476efed79385be00
--- /dev/null
+++ b/lib/gitlab/github/project_creator.rb
@@ -0,0 +1,37 @@
+module Gitlab
+ module Github
+ class ProjectCreator
+ attr_reader :repo, :namespace, :current_user
+
+ def initialize(repo, namespace, current_user)
+ @repo = repo
+ @namespace = namespace
+ @current_user = current_user
+ end
+
+ def execute
+ @project = Project.new(
+ name: repo.name,
+ path: repo.name,
+ description: repo.description,
+ namespace: namespace,
+ creator: current_user,
+ visibility_level: repo.private ? Gitlab::VisibilityLevel::PRIVATE : Gitlab::VisibilityLevel::PUBLIC,
+ import_type: "github",
+ import_source: repo.full_name,
+ import_url: repo.clone_url.sub("https://", "https://#{current_user.github_access_token}@")
+ )
+
+ if @project.save!
+ @project.reload
+
+ if @project.import_failed?
+ @project.import_retry
+ else
+ @project.import_start
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index e2fbafb389911ef68e4da2da7da917f6acb9e86a..fea4d2d55d22b92dcaba7ee94d8500ca05100f4d 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -21,6 +21,9 @@ module Gitlab
@cmd_output = ""
@cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
+ # We are not using stdin so we should close it, in case the command we
+ # are running waits for input.
+ stdin.close
@cmd_output << stdout.read
@cmd_output << stderr.read
@cmd_status = wait_thr.value.exitstatus
diff --git a/lib/gitlab/push_data_builder.rb b/lib/gitlab/push_data_builder.rb
new file mode 100644
index 0000000000000000000000000000000000000000..faea6ae375cede0c0500496ddf2d0e314c0c9ebc
--- /dev/null
+++ b/lib/gitlab/push_data_builder.rb
@@ -0,0 +1,80 @@
+module Gitlab
+ class PushDataBuilder
+ class << self
+ # Produce a hash of post-receive data
+ #
+ # data = {
+ # before: String,
+ # after: String,
+ # ref: String,
+ # user_id: String,
+ # user_name: String,
+ # project_id: String,
+ # repository: {
+ # name: String,
+ # url: String,
+ # description: String,
+ # homepage: String,
+ # },
+ # commits: Array,
+ # total_commits_count: Fixnum
+ # }
+ #
+ def build(project, user, oldrev, newrev, ref, commits = [])
+ # Total commits count
+ commits_count = commits.size
+
+ # Get latest 20 commits ASC
+ commits_limited = commits.last(20)
+
+ # Hash to be passed as post_receive_data
+ data = {
+ before: oldrev,
+ after: newrev,
+ ref: ref,
+ checkout_sha: checkout_sha(project.repository, newrev, ref),
+ user_id: user.id,
+ user_name: user.name,
+ project_id: project.id,
+ repository: {
+ name: project.name,
+ url: project.url_to_repo,
+ description: project.description,
+ homepage: project.web_url,
+ },
+ commits: [],
+ total_commits_count: commits_count
+ }
+
+ # For performance purposes maximum 20 latest commits
+ # will be passed as post receive hook data.
+ commits_limited.each do |commit|
+ data[:commits] << commit.hook_attrs(project)
+ end
+
+ data
+ end
+
+ # This method provide a sample data generated with
+ # existing project and commits to test web hooks
+ def build_sample(project, user)
+ commits = project.repository.commits(project.default_branch, nil, 3)
+ build(project, user, commits.last.id, commits.first.id, "refs/heads/#{project.default_branch}", commits)
+ end
+
+ def checkout_sha(repository, newrev, ref)
+ if newrev != Gitlab::Git::BLANK_SHA && ref.start_with?('refs/tags/')
+ tag_name = Gitlab::Git.extract_ref_name(ref)
+ tag = repository.find_tag(tag_name)
+
+ if tag
+ commit = repository.commit(tag.target)
+ commit.try(:sha)
+ end
+ else
+ newrev
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index c4d0d85b7f58903e4171d8602857aae16622f445..cf6e260f25750be6200f4b4b8030102cf5c6e991 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -11,7 +11,7 @@ module Gitlab
end
def project_name_regex
- /\A[a-zA-Z0-9_][a-zA-Z0-9_\-\. ]*\z/
+ /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\. ]*\z/
end
def project_regex_message
diff --git a/lib/gitlab/theme.rb b/lib/gitlab/theme.rb
index b7c50cb734d763fa8a7cd14bb10524fb7f088b8f..a7c83a880f6f0beb4cef9c66f60408d79969613c 100644
--- a/lib/gitlab/theme.rb
+++ b/lib/gitlab/theme.rb
@@ -19,5 +19,19 @@ module Gitlab
return themes[id]
end
+
+ def self.type_css_class_by_id(id)
+ types = {
+ BASIC => 'light_theme',
+ MARS => 'dark_theme',
+ MODERN => 'dark_theme',
+ GRAY => 'dark_theme',
+ COLOR => 'dark_theme'
+ }
+
+ id ||= Gitlab.config.gitlab.default_theme
+
+ types[id]
+ end
end
end
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index fc6ce657ded57afcf5c0bec317c5b0658c8d1820..43115915de1e3e63533044b2941efff49f4264c7 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -585,10 +585,6 @@ namespace :gitlab do
def gitlab_shell_patch_version
Gitlab::Shell.version_required.split('.')[2].to_i
end
-
- def has_gitlab_shell3?
- gitlab_shell_version.try(:start_with?, "v3.")
- end
end
diff --git a/lib/tasks/gitlab/mail_google_schema_whitelisting.rake b/lib/tasks/gitlab/mail_google_schema_whitelisting.rake
index f40bba24da8700b73d9300d85dd3a8aaa9beeecc..102c6ae55d5afd9245e9234e1ddd14b683615d48 100644
--- a/lib/tasks/gitlab/mail_google_schema_whitelisting.rake
+++ b/lib/tasks/gitlab/mail_google_schema_whitelisting.rake
@@ -54,8 +54,8 @@ namespace :gitlab do
diff --git a/spec/controllers/github_imports_controller_spec.rb b/spec/controllers/github_imports_controller_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..26e7854fea3a9fc5fc5ad0f95d75f44ff94987a9
--- /dev/null
+++ b/spec/controllers/github_imports_controller_spec.rb
@@ -0,0 +1,65 @@
+require 'spec_helper'
+
+describe GithubImportsController do
+ let(:user) { create(:user, github_access_token: 'asd123') }
+
+ before do
+ sign_in(user)
+ end
+
+ describe "GET callback" do
+ it "updates access token" do
+ token = "asdasd12345"
+ Gitlab::Github::Client.any_instance.stub_chain(:client, :auth_code, :get_token, :token).and_return(token)
+ Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github")
+
+ get :callback
+
+ user.reload.github_access_token.should == token
+ controller.should redirect_to(status_github_import_url)
+ end
+ end
+
+ describe "GET status" do
+ before do
+ @repo = OpenStruct.new(login: 'vim', full_name: 'asd/vim')
+ end
+
+ it "assigns variables" do
+ @project = create(:project, import_type: 'github', creator_id: user.id)
+ controller.stub_chain(:octo_client, :repos).and_return([@repo])
+ controller.stub_chain(:octo_client, :orgs).and_return([])
+
+ get :status
+
+ expect(assigns(:already_added_projects)).to eq([@project])
+ expect(assigns(:repos)).to eq([@repo])
+ end
+
+ it "does not show already added project" do
+ @project = create(:project, import_type: 'github', creator_id: user.id, import_source: 'asd/vim')
+ controller.stub_chain(:octo_client, :repos).and_return([@repo])
+ controller.stub_chain(:octo_client, :orgs).and_return([])
+
+ get :status
+
+ expect(assigns(:already_added_projects)).to eq([@project])
+ expect(assigns(:repos)).to eq([])
+ end
+ end
+
+ describe "POST create" do
+ before do
+ @repo = OpenStruct.new(login: 'vim', full_name: 'asd/vim', owner: OpenStruct.new(login: "john"))
+ end
+
+ it "takes already existing namespace" do
+ namespace = create(:namespace, name: "john", owner: user)
+ Gitlab::Github::ProjectCreator.should_receive(:new).with(@repo, namespace, user).
+ and_return(double(execute: true))
+ controller.stub_chain(:octo_client, :repo).and_return(@repo)
+
+ post :create, format: :js
+ end
+ end
+end
diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb
index b557567bd047080cb8ef0dbbd755d735e619c014..37d6b416d22f7b567197cf132b3235fb13a9215d 100644
--- a/spec/features/admin/admin_hooks_spec.rb
+++ b/spec/features/admin/admin_hooks_spec.rb
@@ -12,7 +12,7 @@ describe "Admin::Hooks", feature: true do
describe "GET /admin/hooks" do
it "should be ok" do
visit admin_root_path
- within ".main-nav" do
+ within ".sidebar-wrapper" do
click_on "Hooks"
end
current_path.should == admin_hooks_path
diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb
index 746b6fc1ac955ff276fd7b02466c7c3e6b03ccf0..de4f94fff2f4909917b1d737dffc4b454c59c2a2 100644
--- a/spec/features/atom/users_spec.rb
+++ b/spec/features/atom/users_spec.rb
@@ -24,11 +24,12 @@ describe "User Feed", feature: true do
end
it "should have issue opened event" do
- body.should have_content("#{user.name} opened issue ##{issue.iid}")
+ expect(body).to have_content("#{safe_name} opened issue ##{issue.iid}")
end
it "should have issue comment event" do
- body.should have_content("#{user.name} commented on issue ##{issue.iid}")
+ expect(body).
+ to have_content("#{safe_name} commented on issue ##{issue.iid}")
end
end
end
@@ -40,4 +41,8 @@ describe "User Feed", feature: true do
def note_event(note, user)
EventCreateService.new.leave_note(note, user)
end
+
+ def safe_name
+ html_escape(user.name)
+ end
end
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index cac409b9139ebb737020ccc44890f1fef18b0d3c..895a11270bc076b36fc186a438ca7eff03a5d01b 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -72,27 +72,23 @@ describe 'Comments' do
it "should show the note edit form and hide the note body" do
within("#note_#{note.id}") do
+ find(".current-note-edit-form", visible: true).should be_visible
find(".note-edit-form", visible: true).should be_visible
- find(".note-text", visible: false).should_not be_visible
+ find(:css, ".note-text", visible: false).should_not be_visible
end
end
- it "should reset the edit note form textarea with the original content of the note if cancelled" do
- find('.note').hover
- find(".js-note-edit").click
-
- within(".note-edit-form") do
- fill_in "note[note]", with: "Some new content"
- find(".btn-cancel").click
- find(".js-note-text", visible: false).text.should == note.note
- end
- end
+ # TODO: fix after 7.7 release
+ #it "should reset the edit note form textarea with the original content of the note if cancelled" do
+ #within(".current-note-edit-form") do
+ #fill_in "note[note]", with: "Some new content"
+ #find(".btn-cancel").click
+ #find(".js-note-text", visible: false).text.should == note.note
+ #end
+ #end
it "appends the edited at time to the note" do
- find('.note').hover
- find(".js-note-edit").click
-
- within(".note-edit-form") do
+ within(".current-note-edit-form") do
fill_in "note[note]", with: "Some new content"
find(".btn-save").click
end
@@ -119,7 +115,7 @@ describe 'Comments' do
it "removes the attachment div and resets the edit form" do
find(".js-note-attachment-delete").click
should_not have_css(".note-attachment")
- find(".note-edit-form", visible: false).should_not be_visible
+ find(".current-note-edit-form", visible: false).should_not be_visible
end
end
end
diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb
index bdf7b59114bc787f24948e3f161c5790f0999595..4a76e89fd34fd199908251c4e0b15090308248bf 100644
--- a/spec/features/profile_spec.rb
+++ b/spec/features/profile_spec.rb
@@ -9,7 +9,7 @@ describe "Profile account page", feature: true do
describe "when signup is enabled" do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
+ ApplicationSetting.any_instance.stub(signup_enabled?: true)
visit profile_account_path
end
@@ -23,7 +23,7 @@ describe "Profile account page", feature: true do
describe "when signup is disabled" do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
+ ApplicationSetting.any_instance.stub(signup_enabled?: false)
visit profile_account_path
end
diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb
index a1206989d39fbaf97e6e6c42eae0f32a3beb7cf4..8b237199bcca9b87b83b7ee36977520d5cc07929 100644
--- a/spec/features/users_spec.rb
+++ b/spec/features/users_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Users', feature: true do
describe "GET /users/sign_up" do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
+ ApplicationSetting.any_instance.stub(signup_enabled?: true)
end
it "should create a new user account" do
@@ -11,7 +11,7 @@ describe 'Users', feature: true do
fill_in "user_name", with: "Name Surname"
fill_in "user_username", with: "Great"
fill_in "user_email", with: "name@mail.com"
- fill_in "user_password_sign_up", with: "password1234"
+ fill_in "user_password", with: "password1234"
fill_in "user_password_confirmation", with: "password1234"
expect { click_button "Sign up" }.to change {User.count}.by(1)
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 07dd33b211bf7ce77c57a57ce6a66c9db4fb8b3e..9cdbc846b19406dd1f34bc0cefd18264d2c81cf7 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -87,7 +87,7 @@ describe ApplicationHelper do
let(:user_email) { 'user@email.com' }
it "should return a generic avatar path when Gravatar is disabled" do
- Gitlab.config.gravatar.stub(:enabled).and_return(false)
+ ApplicationSetting.any_instance.stub(gravatar_enabled?: false)
gravatar_icon(user_email).should match('no_avatar.png')
end
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index 114058e3095ef6bfc29dc476a5527dd5a1b872ca..2146b0b138335cc6f2d13766cf8ae75e6c6ce82c 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -20,4 +20,13 @@ describe ProjectsHelper do
""
end
end
+
+ describe "#project_status_css_class" do
+ it "returns appropriate class" do
+ project_status_css_class("started").should == "active"
+ project_status_css_class("failed").should == "danger"
+ project_status_css_class("finished").should == "success"
+ end
+
+ end
end
diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..8aa50c4c778ce3b4939827b8a9eef9bde3f42d88
--- /dev/null
+++ b/spec/helpers/tree_helper_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe TreeHelper do
+ describe 'flatten_tree' do
+ let(:project) { create(:project) }
+
+ before {
+ @repository = project.repository
+ @commit = project.repository.commit("e56497bb")
+ }
+
+ context "on a directory containing more than one file/directory" do
+ let(:tree_item) { double(name: "files", path: "files") }
+
+ it "should return the directory name" do
+ flatten_tree(tree_item).should match('files')
+ end
+ end
+
+ context "on a directory containing only one directory" do
+ let(:tree_item) { double(name: "foo", path: "foo") }
+
+ it "should return the flattened path" do
+ flatten_tree(tree_item).should match('foo/bar')
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 66e87e57cbc2ad6a777d3f21756515e16935da15..8561fd89ba75fa812967de15a240502ff73d280b 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -129,6 +129,13 @@ describe Gitlab::GitAccess do
}
end
+ def self.updated_permissions_matrix
+ updated_permissions_matrix = permissions_matrix.dup
+ updated_permissions_matrix[:developer][:push_protected_branch] = true
+ updated_permissions_matrix[:developer][:push_all] = true
+ updated_permissions_matrix
+ end
+
permissions_matrix.keys.each do |role|
describe "#{role} access" do
before { protect_feature_branch }
@@ -143,5 +150,22 @@ describe Gitlab::GitAccess do
end
end
end
+
+ context "with enabled developers push to protected branches " do
+ updated_permissions_matrix.keys.each do |role|
+ describe "#{role} access" do
+ before { create(:protected_branch, name: 'feature', developers_can_push: true, project: project) }
+ before { project.team << [user, role] }
+
+ updated_permissions_matrix[role].each do |action, allowed|
+ context action do
+ subject { access.push_access_check(user, project, changes[action]) }
+
+ it { subject.allowed?.should allowed ? be_true : be_false }
+ end
+ end
+ end
+ end
+ end
end
end
diff --git a/spec/lib/gitlab/github/project_creator.rb b/spec/lib/gitlab/github/project_creator.rb
new file mode 100644
index 0000000000000000000000000000000000000000..0bade5619a512eb6b2277904bb5a262c48e517b9
--- /dev/null
+++ b/spec/lib/gitlab/github/project_creator.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe Gitlab::Github::ProjectCreator do
+ let(:user) { create(:user, github_access_token: "asdffg") }
+ let(:repo) { OpenStruct.new(
+ login: 'vim',
+ name: 'vim',
+ private: true,
+ full_name: 'asd/vim',
+ clone_url: "https://gitlab.com/asd/vim.git",
+ owner: OpenStruct.new(login: "john"))
+ }
+ let(:namespace){ create(:namespace) }
+
+ it 'creates project' do
+ Project.any_instance.stub(:add_import_job)
+
+ project_creator = Gitlab::Github::ProjectCreator.new(repo, namespace, user)
+ project_creator.execute
+ project = Project.last
+
+ project.import_url.should == "https://asdffg@gitlab.com/asd/vim.git"
+ project.visibility_level.should == Gitlab::VisibilityLevel::PRIVATE
+ end
+end
diff --git a/spec/lib/gitlab/push_data_builder_spec.rb b/spec/lib/gitlab/push_data_builder_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..691fd13363787ed0011288e2bf2ca7e6649a4921
--- /dev/null
+++ b/spec/lib/gitlab/push_data_builder_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'Gitlab::PushDataBuilder' do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+
+
+ describe :build_sample do
+ let(:data) { Gitlab::PushDataBuilder.build_sample(project, user) }
+
+ it { data.should be_a(Hash) }
+ it { data[:before].should == '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' }
+ it { data[:after].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
+ it { data[:ref].should == 'refs/heads/master' }
+ it { data[:commits].size.should == 3 }
+ it { data[:total_commits_count].should == 3 }
+ end
+
+ describe :build do
+ let(:data) do
+ Gitlab::PushDataBuilder.build(project,
+ user,
+ Gitlab::Git::BLANK_SHA,
+ '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b',
+ 'refs/tags/v1.1.0')
+ end
+
+ it { data.should be_a(Hash) }
+ it { data[:before].should == Gitlab::Git::BLANK_SHA }
+ it { data[:checkout_sha].should == '5937ac0a7beb003549fc5fd26fc247adbce4a52e' }
+ it { data[:after].should == '8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b' }
+ it { data[:ref].should == 'refs/tags/v1.1.0' }
+ it { data[:commits].should be_empty }
+ it { data[:total_commits_count].should be_zero }
+ end
+end
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..039775dddda102779ac3f01964f3ab2ecbcd1362
--- /dev/null
+++ b/spec/models/application_setting_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe ApplicationSetting, models: true do
+ it { ApplicationSetting.create_from_defaults.should be_valid }
+end
diff --git a/spec/models/assembla_service_spec.rb b/spec/models/assembla_service_spec.rb
index 4300090eb13ed4c2a03a861d32e9df7627840680..005dd41fea91f7e81407ac6466d97e71f6b651ff 100644
--- a/spec/models/assembla_service_spec.rb
+++ b/spec/models/assembla_service_spec.rb
@@ -33,7 +33,7 @@ describe AssemblaService, models: true do
token: 'verySecret',
subdomain: 'project_name'
)
- @sample_data = GitPushService.new.sample_data(project, user)
+ @sample_data = Gitlab::PushDataBuilder.build_sample(project, user)
@api_url = 'https://atlas.assembla.com/spaces/project_name/github_tool?secret_key=verySecret'
WebMock.stub_request(:post, @api_url)
end
diff --git a/spec/models/flowdock_service_spec.rb b/spec/models/flowdock_service_spec.rb
index 5540f0fa988809b0d384cda283a0502d275d31f5..ac156719b43e60578e4dc6d1b920a5133c1b40ca 100644
--- a/spec/models/flowdock_service_spec.rb
+++ b/spec/models/flowdock_service_spec.rb
@@ -32,7 +32,7 @@ describe FlowdockService do
service_hook: true,
token: 'verySecret'
)
- @sample_data = GitPushService.new.sample_data(project, user)
+ @sample_data = Gitlab::PushDataBuilder.build_sample(project, user)
@api_url = 'https://api.flowdock.com/v1/git/verySecret'
WebMock.stub_request(:post, @api_url)
end
diff --git a/spec/models/gemnasium_service_spec.rb b/spec/models/gemnasium_service_spec.rb
index 60ffa6f8b05766f225d755d0b7bdfa7e0e6521b4..2c560c11dac94f6355014a9c6fa94aa6f128deac 100644
--- a/spec/models/gemnasium_service_spec.rb
+++ b/spec/models/gemnasium_service_spec.rb
@@ -33,7 +33,7 @@ describe GemnasiumService do
token: 'verySecret',
api_key: 'GemnasiumUserApiKey'
)
- @sample_data = GitPushService.new.sample_data(project, user)
+ @sample_data = Gitlab::PushDataBuilder.build_sample(project, user)
end
it "should call Gemnasium service" do
Gemnasium::GitlabService.should_receive(:execute).with(an_instance_of(Hash)).once
diff --git a/spec/models/pushover_service_spec.rb b/spec/models/pushover_service_spec.rb
index 59db69d7572f567cec17b850bcb8c0f6684c9926..f2813d66c7d83fe55a76be6012136bc5568b97cb 100644
--- a/spec/models/pushover_service_spec.rb
+++ b/spec/models/pushover_service_spec.rb
@@ -36,7 +36,7 @@ describe PushoverService do
let(:pushover) { PushoverService.new }
let(:user) { create(:user) }
let(:project) { create(:project) }
- let(:sample_data) { GitPushService.new.sample_data(project, user) }
+ let(:sample_data) { Gitlab::PushDataBuilder.build_sample(project, user) }
let(:api_key) { 'verySecret' }
let(:user_key) { 'verySecret' }
diff --git a/spec/models/slack_service_spec.rb b/spec/models/slack_service_spec.rb
index d48403919676414a3e0ea855ee3abf9608ca401f..345940724096279909108d71709c60d2664f4421 100644
--- a/spec/models/slack_service_spec.rb
+++ b/spec/models/slack_service_spec.rb
@@ -34,7 +34,7 @@ describe SlackService do
let(:slack) { SlackService.new }
let(:user) { create(:user) }
let(:project) { create(:project) }
- let(:sample_data) { GitPushService.new.sample_data(project, user) }
+ let(:sample_data) { Gitlab::PushDataBuilder.build_sample(project, user) }
let(:webhook_url) { 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' }
before do
diff --git a/spec/requests/api/api_helpers_spec.rb b/spec/requests/api/api_helpers_spec.rb
index e2f222c0d341266ae63391ecc0a68277cce4d7ab..cc071342d7c192469209752193a153dea2744292 100644
--- a/spec/requests/api/api_helpers_spec.rb
+++ b/spec/requests/api/api_helpers_spec.rb
@@ -41,6 +41,7 @@ describe API, api: true do
describe ".current_user" do
it "should return nil for an invalid token" do
env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = 'invalid token'
+ self.class.any_instance.stub(:doorkeeper_guard){ false }
current_user.should be_nil
end
diff --git a/spec/requests/api/doorkeeper_access_spec.rb b/spec/requests/api/doorkeeper_access_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..ddef99d77afbbc3f52fdbcee46472db0f0bc0a6c
--- /dev/null
+++ b/spec/requests/api/doorkeeper_access_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+describe API::API, api: true do
+ include ApiHelpers
+
+ let!(:user) { create(:user) }
+ let!(:application) { Doorkeeper::Application.create!(:name => "MyApp", :redirect_uri => "https://app.com", :owner => user) }
+ let!(:token) { Doorkeeper::AccessToken.create! :application_id => application.id, :resource_owner_id => user.id }
+
+
+ describe "when unauthenticated" do
+ it "returns authentication success" do
+ get api("/user"), :access_token => token.token
+ response.status.should == 200
+ end
+ end
+
+ describe "when token invalid" do
+ it "returns authentication error" do
+ get api("/user"), :access_token => "123a"
+ response.status.should == 401
+ end
+ end
+
+ describe "authorization by private token" do
+ it "returns authentication success" do
+ get api("/user", user)
+ response.status.should == 200
+ end
+ end
+end
diff --git a/spec/requests/api/fork_spec.rb b/spec/requests/api/fork_spec.rb
index cbbd1e7de5a77beacd365cf6af77f83c16b2eae9..5921b3e06983d930ecb97a5f6703e72ea3205159 100644
--- a/spec/requests/api/fork_spec.rb
+++ b/spec/requests/api/fork_spec.rb
@@ -44,7 +44,7 @@ describe API::API, api: true do
it 'should fail on missing project access for the project to fork' do
post api("/projects/fork/#{project.id}", user3)
response.status.should == 404
- json_response['message'].should == '404 Not Found'
+ json_response['message'].should == '404 Project Not Found'
end
it 'should fail if forked project exists in the user namespace' do
@@ -58,7 +58,7 @@ describe API::API, api: true do
it 'should fail if project to fork from does not exist' do
post api('/projects/fork/424242', user)
response.status.should == 404
- json_response['message'].should == '404 Not Found'
+ json_response['message'].should == '404 Project Not Found'
end
end
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 8dfd2cd650e79965f2ebf24c388aada08553d8da..95f82463367b791d82bb3fc1ce30c5f32e8f9aff 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -91,7 +91,8 @@ describe API::API, api: true do
it "should not create group, duplicate" do
post api("/groups", admin), {name: "Duplicate Test", path: group2.path}
- response.status.should == 404
+ response.status.should == 400
+ response.message.should == "Bad Request"
end
it "should return 400 bad request error if name not given" do
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb
index 7aa53787aedb666c0d1311b8f140e451d2452c42..429824e829a3c70847117605d20af36631329892 100644
--- a/spec/requests/api/notes_spec.rb
+++ b/spec/requests/api/notes_spec.rb
@@ -131,4 +131,58 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!'
end
end
+
+ describe 'PUT /projects/:id/noteable/:noteable_id/notes/:note_id' do
+ context 'when noteable is an Issue' do
+ it 'should return modified note' do
+ put api("/projects/#{project.id}/issues/#{issue.id}/"\
+ "notes/#{issue_note.id}", user), body: 'Hello!'
+ response.status.should == 200
+ json_response['body'].should == 'Hello!'
+ end
+
+ it 'should return a 404 error when note id not found' do
+ put api("/projects/#{project.id}/issues/#{issue.id}/notes/123", user),
+ body: 'Hello!'
+ response.status.should == 404
+ end
+
+ it 'should return a 400 bad request error if body not given' do
+ put api("/projects/#{project.id}/issues/#{issue.id}/"\
+ "notes/#{issue_note.id}", user)
+ response.status.should == 400
+ end
+ end
+
+ context 'when noteable is a Snippet' do
+ it 'should return modified note' do
+ put api("/projects/#{project.id}/snippets/#{snippet.id}/"\
+ "notes/#{snippet_note.id}", user), body: 'Hello!'
+ response.status.should == 200
+ json_response['body'].should == 'Hello!'
+ end
+
+ it 'should return a 404 error when note id not found' do
+ put api("/projects/#{project.id}/snippets/#{snippet.id}/"\
+ "notes/123", user), body: "Hello!"
+ response.status.should == 404
+ end
+ end
+
+ context 'when noteable is a Merge Request' do
+ it 'should return modified note' do
+ put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/"\
+ "notes/#{merge_request_note.id}", user), body: 'Hello!'
+ response.status.should == 200
+ json_response['body'].should == 'Hello!'
+ end
+
+ it 'should return a 404 error when note id not found' do
+ put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/"\
+ "notes/123", user), body: "Hello!"
+ response.status.should == 404
+ end
+ end
+ end
+
end
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 2c4b68c10b688402ec76dc2e63ff43c1ca827c62..3098b0f77f99014c4026a14f52e4740d0a5f961e 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -7,6 +7,8 @@ describe API::API, api: true do
let(:user3) { create(:user) }
let(:admin) { create(:admin) }
let(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
+ let(:project2) { create(:project, path: 'project2', creator_id: user.id, namespace: user.namespace) }
+ let(:project3) { create(:project, path: 'project3', creator_id: user.id, namespace: user.namespace) }
let(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') }
let(:project_member) { create(:project_member, user: user, project: project, access_level: ProjectMember::MASTER) }
let(:project_member2) { create(:project_member, user: user3, project: project, access_level: ProjectMember::DEVELOPER) }
@@ -29,6 +31,29 @@ describe API::API, api: true do
json_response.first['name'].should == project.name
json_response.first['owner']['username'].should == user.username
end
+
+ context "and using search" do
+ it "should return searched project" do
+ get api("/projects", user), { search: project.name }
+ response.status.should eq(200)
+ json_response.should be_an Array
+ json_response.length.should eq(1)
+ end
+ end
+
+ context "and using sorting" do
+ before do
+ project2
+ project3
+ end
+
+ it "should return the correct order when sorted by id" do
+ get api("/projects", user), { order_by: 'id', sort: 'desc'}
+ response.status.should eq(200)
+ json_response.should be_an Array
+ json_response.first['id'].should eq(project3.id)
+ end
+ end
end
end
@@ -198,8 +223,6 @@ describe API::API, api: true do
it 'should respond with 400 on failure' do
post api("/projects/user/#{user.id}", admin)
response.status.should == 400
- json_response['message']['creator'].should == ['can\'t be blank']
- json_response['message']['namespace'].should == ['can\'t be blank']
json_response['message']['name'].should == [
'can\'t be blank',
'is too short (minimum is 0 characters)',
@@ -291,7 +314,7 @@ describe API::API, api: true do
it "should return a 404 error if not found" do
get api("/projects/42", user)
response.status.should == 404
- json_response['message'].should == '404 Not Found'
+ json_response['message'].should == '404 Project Not Found'
end
it "should return a 404 error if user is not a member" do
@@ -342,7 +365,7 @@ describe API::API, api: true do
it "should return a 404 error if not found" do
get api("/projects/42/events", user)
response.status.should == 404
- json_response['message'].should == '404 Not Found'
+ json_response['message'].should == '404 Project Not Found'
end
it "should return a 404 error if user is not a member" do
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 1ecc79ea7ef203be10ea34d2448ec9c215cf910f..dec488c6d00723eb8b3d7d8999dd765e469c9ec0 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -186,7 +186,7 @@ describe API::API, api: true do
describe "GET /users/sign_up" do
context 'enabled' do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
+ ApplicationSetting.any_instance.stub(signup_enabled?: true)
end
it "should return sign up page if signup is enabled" do
@@ -197,7 +197,7 @@ describe API::API, api: true do
context 'disabled' do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
+ ApplicationSetting.any_instance.stub(signup_enabled?: false)
end
it "should redirect to sign in page if signup is disabled" do
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index e6505040317591ce319e5770efb586e5319b138e..f149f3f62a9bb735009cf03cccc6eee621f17ac0 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -430,6 +430,26 @@ describe Projects::TreeController, "routing" do
end
end
+describe Projects::EditTreeController, 'routing' do
+ it 'to #show' do
+ get('/gitlab/gitlabhq/edit/master/app/models/project.rb').should(
+ route_to('projects/edit_tree#show',
+ project_id: 'gitlab/gitlabhq',
+ id: 'master/app/models/project.rb'))
+ get('/gitlab/gitlabhq/edit/master/app/models/project.rb/preview').should(
+ route_to('projects/edit_tree#show',
+ project_id: 'gitlab/gitlabhq',
+ id: 'master/app/models/project.rb/preview'))
+ end
+
+ it 'to #preview' do
+ post('/gitlab/gitlabhq/edit/master/app/models/project.rb/preview').should(
+ route_to('projects/edit_tree#preview',
+ project_id: 'gitlab/gitlabhq',
+ id: 'master/app/models/project.rb'))
+ end
+end
+
# project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/}
# POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/}
# project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/}
diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb
index 9f2941520532aef3e771aa60b742809f7a40066e..35c7aac94dfd59da48996fc69f05e733945388be 100644
--- a/spec/services/merge_requests/refresh_service_spec.rb
+++ b/spec/services/merge_requests/refresh_service_spec.rb
@@ -47,10 +47,10 @@ describe MergeRequests::RefreshService do
reload_mrs
end
- it { @merge_request.notes.should be_empty }
+ it { @merge_request.notes.last.note.should include('changed to merged') }
it { @merge_request.should be_merged }
it { @fork_merge_request.should be_merged }
- it { @fork_merge_request.notes.should be_empty }
+ it { @fork_merge_request.notes.last.note.should include('changed to merged') }
end
context 'push to fork repo source branch' do
@@ -61,7 +61,7 @@ describe MergeRequests::RefreshService do
it { @merge_request.notes.should be_empty }
it { @merge_request.should be_open }
- it { @fork_merge_request.notes.should_not be_empty }
+ it { @fork_merge_request.notes.last.note.should include('new commit') }
it { @fork_merge_request.should be_open }
end
@@ -84,7 +84,7 @@ describe MergeRequests::RefreshService do
reload_mrs
end
- it { @merge_request.notes.should be_empty }
+ it { @merge_request.notes.last.note.should include('changed to merged') }
it { @merge_request.should be_merged }
it { @fork_merge_request.should be_open }
it { @fork_merge_request.notes.should be_empty }
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index f8377650e0a6193a2200f93868e4850d55bbf248..e305536f7ee6f17957c6e0d43b90b5c343258b04 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -116,6 +116,7 @@ describe NotificationService do
should_email(note.noteable.assignee_id)
should_not_email(note.author_id)
+ should_not_email(@u_mentioned.id)
should_not_email(@u_disabled.id)
should_not_email(@u_not_mentioned.id)
notification.new_note(note)
@@ -168,6 +169,12 @@ describe NotificationService do
notification.new_note(note)
end
+ it do
+ @u_committer.update_attributes(notification_level: Notification::N_MENTION)
+ should_not_email(@u_committer.id, note)
+ notification.new_note(note)
+ end
+
def should_email(user_id, n)
Notify.should_receive(:note_commit_email).with(user_id, n.id)
end
@@ -190,11 +197,18 @@ describe NotificationService do
it do
should_email(issue.assignee_id)
should_email(@u_watcher.id)
+ should_not_email(@u_mentioned.id)
should_not_email(@u_participating.id)
should_not_email(@u_disabled.id)
notification.new_issue(issue, @u_disabled)
end
+ it do
+ issue.assignee.update_attributes(notification_level: Notification::N_MENTION)
+ should_not_email(issue.assignee_id)
+ notification.new_issue(issue, @u_disabled)
+ end
+
def should_email(user_id)
Notify.should_receive(:new_issue_email).with(user_id, issue.id)
end
@@ -391,7 +405,7 @@ describe NotificationService do
@u_watcher = create(:user, notification_level: Notification::N_WATCH)
@u_participating = create(:user, notification_level: Notification::N_PARTICIPATING)
@u_disabled = create(:user, notification_level: Notification::N_DISABLED)
- @u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_PARTICIPATING)
+ @u_mentioned = create(:user, username: 'mention', notification_level: Notification::N_MENTION)
@u_committer = create(:user, username: 'committer')
@u_not_mentioned = create(:user, username: 'regular', notification_level: Notification::N_PARTICIPATING)
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index e6db410fb1cad0f43978e7cd5c2e08994a2659f4..24fee7c0379d746bfe3e94cdda7ea7a3aa44def6 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -5,6 +5,7 @@ module TestEnv
# When developing the seed repository, comment out the branch you will modify.
BRANCH_SHA = {
+ 'flatten-dir' => 'e56497b',
'feature' => '0b4bc9a',
'feature_conflict' => 'bb5206f',
'fix' => '12d65c8',
diff --git a/vendor/assets/javascripts/chart-lib.min.js b/vendor/assets/javascripts/chart-lib.min.js
old mode 100755
new mode 100644
diff --git a/vendor/assets/javascripts/pwstrength-bootstrap-1.2.2.js b/vendor/assets/javascripts/pwstrength-bootstrap-1.2.2.js
deleted file mode 100644
index ee374a07fab69a5e925e79c69029bf9d0f9c30c6..0000000000000000000000000000000000000000
--- a/vendor/assets/javascripts/pwstrength-bootstrap-1.2.2.js
+++ /dev/null
@@ -1,659 +0,0 @@
-/*!
- * jQuery Password Strength plugin for Twitter Bootstrap
- *
- * Copyright (c) 2008-2013 Tane Piper
- * Copyright (c) 2013 Alejandro Blanco
- * Dual licensed under the MIT and GPL licenses.
- */
-
-(function (jQuery) {
-// Source: src/rules.js
-
- var rulesEngine = {};
-
- try {
- if (!jQuery && module && module.exports) {
- var jQuery = require("jquery"),
- jsdom = require("jsdom").jsdom;
- jQuery = jQuery(jsdom().parentWindow);
- }
- } catch (ignore) {}
-
- (function ($, rulesEngine) {
- "use strict";
- var validation = {};
-
- rulesEngine.forbiddenSequences = [
- "0123456789", "abcdefghijklmnopqrstuvwxyz", "qwertyuiop", "asdfghjkl",
- "zxcvbnm", "!@#$%^&*()_+"
- ];
-
- validation.wordNotEmail = function (options, word, score) {
- if (word.match(/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i)) {
- return score;
- }
- return 0;
- };
-
- validation.wordLength = function (options, word, score) {
- var wordlen = word.length,
- lenScore = Math.pow(wordlen, options.rules.raisePower);
- if (wordlen < options.common.minChar) {
- lenScore = (lenScore + score);
- }
- return lenScore;
- };
-
- validation.wordSimilarToUsername = function (options, word, score) {
- var username = $(options.common.usernameField).val();
- if (username && word.toLowerCase().match(username.toLowerCase())) {
- return score;
- }
- return 0;
- };
-
- validation.wordTwoCharacterClasses = function (options, word, score) {
- if (word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) ||
- (word.match(/([a-zA-Z])/) && word.match(/([0-9])/)) ||
- (word.match(/(.[!,@,#,$,%,\^,&,*,?,_,~])/) && word.match(/[a-zA-Z0-9_]/))) {
- return score;
- }
- return 0;
- };
-
- validation.wordRepetitions = function (options, word, score) {
- if (word.match(/(.)\1\1/)) { return score; }
- return 0;
- };
-
- validation.wordSequences = function (options, word, score) {
- var found = false,
- j;
- if (word.length > 2) {
- $.each(rulesEngine.forbiddenSequences, function (idx, seq) {
- var sequences = [seq, seq.split('').reverse().join('')];
- $.each(sequences, function (idx, sequence) {
- for (j = 0; j < (word.length - 2); j += 1) { // iterate the word trough a sliding window of size 3:
- if (sequence.indexOf(word.toLowerCase().substring(j, j + 3)) > -1) {
- found = true;
- }
- }
- });
- });
- if (found) { return score; }
- }
- return 0;
- };
-
- validation.wordLowercase = function (options, word, score) {
- return word.match(/[a-z]/) && score;
- };
-
- validation.wordUppercase = function (options, word, score) {
- return word.match(/[A-Z]/) && score;
- };
-
- validation.wordOneNumber = function (options, word, score) {
- return word.match(/\d+/) && score;
- };
-
- validation.wordThreeNumbers = function (options, word, score) {
- return word.match(/(.*[0-9].*[0-9].*[0-9])/) && score;
- };
-
- validation.wordOneSpecialChar = function (options, word, score) {
- return word.match(/.[!,@,#,$,%,\^,&,*,?,_,~]/) && score;
- };
-
- validation.wordTwoSpecialChar = function (options, word, score) {
- return word.match(/(.*[!,@,#,$,%,\^,&,*,?,_,~].*[!,@,#,$,%,\^,&,*,?,_,~])/) && score;
- };
-
- validation.wordUpperLowerCombo = function (options, word, score) {
- return word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) && score;
- };
-
- validation.wordLetterNumberCombo = function (options, word, score) {
- return word.match(/([a-zA-Z])/) && word.match(/([0-9])/) && score;
- };
-
- validation.wordLetterNumberCharCombo = function (options, word, score) {
- return word.match(/([a-zA-Z0-9].*[!,@,#,$,%,\^,&,*,?,_,~])|([!,@,#,$,%,\^,&,*,?,_,~].*[a-zA-Z0-9])/) && score;
- };
-
- rulesEngine.validation = validation;
-
- rulesEngine.executeRules = function (options, word) {
- var totalScore = 0;
-
- $.each(options.rules.activated, function (rule, active) {
- if (active) {
- var score = options.rules.scores[rule],
- funct = rulesEngine.validation[rule],
- result,
- errorMessage;
-
- if (!$.isFunction(funct)) {
- funct = options.rules.extra[rule];
- }
-
- if ($.isFunction(funct)) {
- result = funct(options, word, score);
- if (result) {
- totalScore += result;
- }
- if (result < 0 || (!$.isNumeric(result) && !result)) {
- errorMessage = options.ui.spanError(options, rule);
- if (errorMessage.length > 0) {
- options.instances.errors.push(errorMessage);
- }
- }
- }
- }
- });
-
- return totalScore;
- };
- }(jQuery, rulesEngine));
-
- try {
- if (module && module.exports) {
- module.exports = rulesEngine;
- }
- } catch (ignore) {}
-
-// Source: src/options.js
-
-
-
-
- var defaultOptions = {};
-
- defaultOptions.common = {};
- defaultOptions.common.minChar = 6;
- defaultOptions.common.usernameField = "#username";
- defaultOptions.common.userInputs = [
- // Selectors for input fields with user input
- ];
- defaultOptions.common.onLoad = undefined;
- defaultOptions.common.onKeyUp = undefined;
- defaultOptions.common.zxcvbn = false;
- defaultOptions.common.debug = false;
-
- defaultOptions.rules = {};
- defaultOptions.rules.extra = {};
- defaultOptions.rules.scores = {
- wordNotEmail: -100,
- wordLength: -50,
- wordSimilarToUsername: -100,
- wordSequences: -50,
- wordTwoCharacterClasses: 2,
- wordRepetitions: -25,
- wordLowercase: 1,
- wordUppercase: 3,
- wordOneNumber: 3,
- wordThreeNumbers: 5,
- wordOneSpecialChar: 3,
- wordTwoSpecialChar: 5,
- wordUpperLowerCombo: 2,
- wordLetterNumberCombo: 2,
- wordLetterNumberCharCombo: 2
- };
- defaultOptions.rules.activated = {
- wordNotEmail: true,
- wordLength: true,
- wordSimilarToUsername: true,
- wordSequences: true,
- wordTwoCharacterClasses: false,
- wordRepetitions: false,
- wordLowercase: true,
- wordUppercase: true,
- wordOneNumber: true,
- wordThreeNumbers: true,
- wordOneSpecialChar: true,
- wordTwoSpecialChar: true,
- wordUpperLowerCombo: true,
- wordLetterNumberCombo: true,
- wordLetterNumberCharCombo: true
- };
- defaultOptions.rules.raisePower = 1.4;
-
- defaultOptions.ui = {};
- defaultOptions.ui.bootstrap2 = false;
- defaultOptions.ui.showProgressBar = true;
- defaultOptions.ui.showPopover = false;
- defaultOptions.ui.showStatus = false;
- defaultOptions.ui.spanError = function (options, key) {
- "use strict";
- var text = options.ui.errorMessages[key];
- if (!text) { return ''; }
- return '' + text + '';
- };
- defaultOptions.ui.errorMessages = {
- wordLength: "Your password is too short",
- wordNotEmail: "Do not use your email as your password",
- wordSimilarToUsername: "Your password cannot contain your username",
- wordTwoCharacterClasses: "Use different character classes",
- wordRepetitions: "Too many repetitions",
- wordSequences: "Your password contains sequences"
- };
- defaultOptions.ui.verdicts = ["Weak", "Normal", "Medium", "Strong", "Very Strong"];
- defaultOptions.ui.showVerdicts = true;
- defaultOptions.ui.showVerdictsInsideProgressBar = false;
- defaultOptions.ui.showErrors = false;
- defaultOptions.ui.container = undefined;
- defaultOptions.ui.viewports = {
- progress: undefined,
- verdict: undefined,
- errors: undefined
- };
- defaultOptions.ui.scores = [14, 26, 38, 50];
-
-// Source: src/ui.js
-
-
-
-
- var ui = {};
-
- (function ($, ui) {
- "use strict";
-
- var barClasses = ["danger", "warning", "success"],
- statusClasses = ["error", "warning", "success"];
-
- ui.getContainer = function (options, $el) {
- var $container;
-
- $container = $(options.ui.container);
- if (!($container && $container.length === 1)) {
- $container = $el.parent();
- }
- return $container;
- };
-
- ui.findElement = function ($container, viewport, cssSelector) {
- if (viewport) {
- return $container.find(viewport).find(cssSelector);
- }
- return $container.find(cssSelector);
- };
-
- ui.getUIElements = function (options, $el) {
- var $container, result;
-
- if (options.instances.viewports) {
- return options.instances.viewports;
- }
-
- $container = ui.getContainer(options, $el);
-
- result = {};
- result.$progressbar = ui.findElement($container, options.ui.viewports.progress, "div.progress");
- if (options.ui.showVerdictsInsideProgressBar) {
- result.$verdict = result.$progressbar.find("span.password-verdict");
- }
-
- if (!options.ui.showPopover) {
- if (!options.ui.showVerdictsInsideProgressBar) {
- result.$verdict = ui.findElement($container, options.ui.viewports.verdict, "span.password-verdict");
- }
- result.$errors = ui.findElement($container, options.ui.viewports.errors, "ul.error-list");
- }
-
- options.instances.viewports = result;
- return result;
- };
-
- ui.initProgressBar = function (options, $el) {
- var $container = ui.getContainer(options, $el),
- progressbar = "