diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-28 22:52:44 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-28 22:52:44 -0800 |
commit | 815e9aa283f113051268370908776c5517dab711 (patch) | |
tree | 9beaa0dfa9aa5dee5e76581cc6d7f4b90b5c6d1a | |
parent | 792ced2f4190226c3335967a8e5a30d3b72bd4ae (diff) | |
parent | 2149f8b52c8f0d8333707f7c798b0e6a8a892c1c (diff) | |
download | gitlab-ce-815e9aa283f113051268370908776c5517dab711.tar.gz |
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into haynes/gitlab-ce-commit_calendar
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/assets/stylesheets/gl_bootstrap.scss | 3 | ||||
-rw-r--r-- | app/assets/stylesheets/main/mixins.scss | 2 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/services_controller.rb | 5 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 19 | ||||
-rw-r--r-- | app/models/project.rb | 20 | ||||
-rw-r--r-- | app/models/project_services/gitlab_issue_tracker_service.rb | 25 | ||||
-rw-r--r-- | app/models/project_services/issue_tracker_service.rb | 8 | ||||
-rw-r--r-- | app/models/service.rb | 2 | ||||
-rw-r--r-- | config/gitlab.yml.example | 4 | ||||
-rw-r--r-- | doc/integration/ldap.md | 7 | ||||
-rw-r--r-- | lib/gitlab/git_access.rb | 2 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 1 |
15 files changed, 67 insertions, 39 deletions
@@ -173,7 +173,7 @@ gem 'ace-rails-ap' gem 'mousetrap-rails' # Semantic UI Sass for Sidebar -gem 'semantic-ui-sass', '~> 0.16.1.0' +gem 'semantic-ui-sass', '~> 1.8.0' gem "sass-rails", '~> 4.0.2' gem "coffee-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 5c70541a735..4b5b718c87e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -491,7 +491,7 @@ GEM activesupport (>= 3.1, < 4.2) select2-rails (3.5.2) thor (~> 0.14) - semantic-ui-sass (0.16.1.0) + semantic-ui-sass (1.8.0.0) sass (~> 3.2) settingslogic (2.0.9) sexp_processor (4.4.0) @@ -717,7 +717,7 @@ DEPENDENCIES sdoc seed-fu select2-rails - semantic-ui-sass (~> 0.16.1.0) + semantic-ui-sass (~> 1.8.0) settingslogic shoulda-matchers (~> 2.1.0) sidekiq (~> 3.3) diff --git a/app/assets/stylesheets/gl_bootstrap.scss b/app/assets/stylesheets/gl_bootstrap.scss index 2a68d922bb7..6efa56544a5 100644 --- a/app/assets/stylesheets/gl_bootstrap.scss +++ b/app/assets/stylesheets/gl_bootstrap.scss @@ -1,9 +1,6 @@ /* * Twitter bootstrap with GitLab customizations/additions * - * Some unused bootstrap compontents like panels are not included. - * Other components like tabs are modified to GitLab style. - * */ $font-size-base: 13px !default; diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index 8435d1dae79..e54482d14c3 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -139,7 +139,7 @@ } @mixin panel-colored { - border: none; + border: 1px solid #EEE; background: $box_bg; @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.09)); diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ad13a0ac3e4..36e13706768 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -181,7 +181,7 @@ class ApplicationController < ActionController::Base end def add_gon_variables - gon.default_issues_tracker = Project.issues_tracker.default_value + gon.default_issues_tracker = Project.new.default_issue_tracker.to_param gon.api_version = API::API.version gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 09bccb4bf8f..5b35cc90413 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -9,7 +9,7 @@ class Projects::ServicesController < Projects::ApplicationController def index @project.build_missing_services - @services = @project.services.reload + @services = @project.services.visible.reload end def edit @@ -17,9 +17,6 @@ class Projects::ServicesController < Projects::ApplicationController def update if @service.update_attributes(service_params) - if @service.activated? && @service.issue_tracker? - @project.update_attributes(issues_tracker: @service.to_param) - end redirect_to edit_project_service_path(@project, @service.to_param), notice: 'Successfully updated.' else diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 2bf430f9142..9fe183e6e2f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -16,32 +16,19 @@ module IssuesHelper def url_for_project_issues(project = @project) return '' if project.nil? - if project.default_issues_tracker? - project_issues_path(project) - else - project.external_issue_tracker.project_url - end + project.issues_tracker.project_url end def url_for_new_issue(project = @project) return '' if project.nil? - if project.default_issues_tracker? - url = new_project_issue_path project_id: project - else - project.external_issue_tracker.new_issue_url - end + project.issues_tracker.new_issue_url end def url_for_issue(issue_iid, project = @project) return '' if project.nil? - if project.default_issues_tracker? - url = project_issue_url project_id: project, id: issue_iid - else - url = project.external_issue_tracker.issues_url - url.gsub(':id', issue_iid.to_s) - end + project.issues_tracker.issue_url(issue_iid) end def title_for_issue(issue_iid, project = @project) diff --git a/app/models/project.rb b/app/models/project.rb index 12751bb77e6..b26c697a7b7 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -77,6 +77,7 @@ class Project < ActiveRecord::Base has_one :jira_service, dependent: :destroy has_one :redmine_service, dependent: :destroy has_one :custom_issue_tracker_service, dependent: :destroy + has_one :gitlab_issue_tracker_service, dependent: :destroy has_one :forked_project_link, dependent: :destroy, foreign_key: "forked_to_project_id" @@ -149,8 +150,6 @@ class Project < ActiveRecord::Base scope :public_and_internal_only, -> { where(visibility_level: Project.public_and_internal_levels) } scope :non_archived, -> { where(archived: false) } - enumerize :issues_tracker, in: (Service.issue_tracker_service_list).append(:gitlab), default: :gitlab - state_machine :import_status, initial: :none do event :import_start do transition [:none, :finished] => :started @@ -317,19 +316,28 @@ class Project < ActiveRecord::Base end end + def default_issue_tracker + gitlab_issue_tracker_service ||= create_gitlab_issue_tracker_service + end + + def issues_tracker + if external_issue_tracker + external_issue_tracker + else + default_issue_tracker + end + end + def default_issues_tracker? if external_issue_tracker false else - unless self.issues_tracker == Project.issues_tracker.default_value - self.update_attributes(issues_tracker: Project.issues_tracker.default_value) - end true end end def external_issues_trackers - services.select { |service| service.issue_tracker? } + services.select(&:issue_tracker?).reject(&:default?) end def external_issue_tracker diff --git a/app/models/project_services/gitlab_issue_tracker_service.rb b/app/models/project_services/gitlab_issue_tracker_service.rb new file mode 100644 index 00000000000..25f5f23bdf9 --- /dev/null +++ b/app/models/project_services/gitlab_issue_tracker_service.rb @@ -0,0 +1,25 @@ +class GitlabIssueTrackerService < IssueTrackerService + include Rails.application.routes.url_helpers + prop_accessor :title, :description, :project_url, :issues_url, :new_issue_url + + + def default? + true + end + + def to_param + 'gitlab' + end + + def project_url + project_issues_path(project) + end + + def new_issue_url + new_project_issue_path project_id: project + end + + def issue_url(iid) + "#{Gitlab.config.gitlab.url}#{project_issue_path(project_id: project, id: iid)}" + end +end diff --git a/app/models/project_services/issue_tracker_service.rb b/app/models/project_services/issue_tracker_service.rb index fc7b2fe5acd..632f053d17b 100644 --- a/app/models/project_services/issue_tracker_service.rb +++ b/app/models/project_services/issue_tracker_service.rb @@ -6,6 +6,10 @@ class IssueTrackerService < Service :issue_tracker end + def default? + false + end + def project_url # implement inside child end @@ -18,6 +22,10 @@ class IssueTrackerService < Service # implement inside child end + def issue_url(iid) + self.issues_url.gsub(':id', iid.to_s) + end + def fields [ { type: 'text', name: 'description', placeholder: description }, diff --git a/app/models/service.rb b/app/models/service.rb index 42419475349..15948e63e41 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -26,6 +26,8 @@ class Service < ActiveRecord::Base validates :project_id, presence: true + scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') } + def activated? active end diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index e5780cabb63..59af49c0180 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -153,9 +153,9 @@ production: &base label: 'LDAP' host: '_your_ldap_server' - port: 636 + port: 389 uid: 'sAMAccountName' - method: 'ssl' # "tls" or "ssl" or "plain" + method: 'plain' # "tls" or "ssl" or "plain" bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' password: '_the_password_of_the_bind_user' diff --git a/doc/integration/ldap.md b/doc/integration/ldap.md index 56b0d826adb..125ce31b521 100644 --- a/doc/integration/ldap.md +++ b/doc/integration/ldap.md @@ -29,9 +29,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server label: 'LDAP' host: '_your_ldap_server' - port: 636 + port: 389 uid: 'sAMAccountName' - method: 'ssl' # "tls" or "ssl" or "plain" + method: 'plain' # "tls" or "ssl" or "plain" bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' password: '_the_password_of_the_bind_user' @@ -76,6 +76,9 @@ main: # 'main' is the GitLab 'provider ID' of this LDAP server EOS ``` +If you are getting 'Connection Refused' errors when trying to connect to the LDAP server please double-check the LDAP `port` and `method` settings used by GitLab. +Common combinations are `method: 'plain'` and `port: 389`, OR `method: 'ssl'` and `port: 636`. + If you are using a GitLab installation from source you can find the LDAP settings in `/home/git/gitlab/config/gitlab.yml`: ``` diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index c7bf2efc628..ea96d04c5ab 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -73,7 +73,7 @@ module Gitlab changes = changes.lines if changes.kind_of?(String) # Iterate over all changes to find if user allowed all of them to be applied - changes.each do |change| + changes.map(&:strip).reject(&:blank?).each do |change| status = change_access_check(user, project, change) unless status.allowed? # If user does not have access to make at least one change - cancel all push diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 5c9eea956f3..d633287b2a9 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -23,6 +23,7 @@ describe GitlabMarkdownHelper do @project = project @ref = 'markdown' @repository = project.repository + @request.host = Gitlab.config.gitlab.host end describe "#gfm" do |