Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-09 20:27:56 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-12-09 20:27:56 +0300
commite0df1b5f9944cff1ee7234c9fa292a7a06456c08 (patch)
treebd3e760fb41f1974bd6aac0ccefbc6f97cdce04f /lib/gitlab
parent3e01385bca92dc8c0df3aa4032cc58d708dc0ff5 (diff)
parentad4c2a08104cba0557d824fac6a70eedd45921b7 (diff)
Merge remote-tracking branch 'upstream/master' into fix-git-hooks-when-creating-file
* upstream/master: (60 commits) Refactor SSH keys docs Improvements to setting up ssh Do not reload diff for merge request made from fork when target branch in fork is updated Add 8.12.10, 8.12.11, and 8.12.12 CHANGELOG.md items Changes after review Fix broken test Adds CHANGELOG entry Adds tests Uniformize props name format Replace commit icon svg logic Replace play icon svg logic Update docs to reflect new defaults on omnibus Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' Merge branch 'html-safe-diff-line-content' into 'security' Merge branch 'rs-filter-authentication_token' into 'security' Merge branch 'destroy-session' into 'security' remove unnecessary issues event filter on comments tab Updating reference to database password Add CHANGELOG entry Displays milestone remaining days only when it's present ...
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/asciidoc.rb2
-rw-r--r--lib/gitlab/ci/status/factory.rb43
-rw-r--r--lib/gitlab/ci/status/pipeline/factory.rb30
-rw-r--r--lib/gitlab/ci/status/stage/common.rb24
-rw-r--r--lib/gitlab/ci/status/stage/factory.rb15
-rw-r--r--lib/gitlab/data_builder/pipeline.rb2
-rw-r--r--lib/gitlab/search_results.rb2
7 files changed, 90 insertions, 28 deletions
diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb
index 1a22ad9acf5..9667df4ffb8 100644
--- a/lib/gitlab/asciidoc.rb
+++ b/lib/gitlab/asciidoc.rb
@@ -6,7 +6,7 @@ module Gitlab
module Asciidoc
DEFAULT_ADOC_ATTRS = [
'showtitle', 'idprefix=user-content-', 'idseparator=-', 'env=gitlab',
- 'env-gitlab', 'source-highlighter=html-pipeline'
+ 'env-gitlab', 'source-highlighter=html-pipeline', 'icons=font'
].freeze
# Public: Converts the provided Asciidoc markup into HTML.
diff --git a/lib/gitlab/ci/status/factory.rb b/lib/gitlab/ci/status/factory.rb
new file mode 100644
index 00000000000..b2f896f2211
--- /dev/null
+++ b/lib/gitlab/ci/status/factory.rb
@@ -0,0 +1,43 @@
+module Gitlab
+ module Ci
+ module Status
+ class Factory
+ attr_reader :subject
+
+ def initialize(subject)
+ @subject = subject
+ end
+
+ def fabricate!
+ if extended_status
+ extended_status.new(core_status)
+ else
+ core_status
+ end
+ end
+
+ private
+
+ def subject_status
+ @subject_status ||= subject.status
+ end
+
+ def core_status
+ Gitlab::Ci::Status
+ .const_get(subject_status.capitalize)
+ .new(subject)
+ end
+
+ def extended_status
+ @extended ||= extended_statuses.find do |status|
+ status.matches?(subject)
+ end
+ end
+
+ def extended_statuses
+ []
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/status/pipeline/factory.rb b/lib/gitlab/ci/status/pipeline/factory.rb
index 71d27bf7cf5..4ac4ec671d0 100644
--- a/lib/gitlab/ci/status/pipeline/factory.rb
+++ b/lib/gitlab/ci/status/pipeline/factory.rb
@@ -2,35 +2,15 @@ module Gitlab
module Ci
module Status
module Pipeline
- class Factory
- EXTENDED_STATUSES = [Pipeline::SuccessWithWarnings]
-
- def initialize(pipeline)
- @pipeline = pipeline
- @status = pipeline.status || :created
- end
-
- def fabricate!
- if extended_status
- extended_status.new(core_status)
- else
- core_status
- end
- end
-
+ class Factory < Status::Factory
private
- def core_status
- Gitlab::Ci::Status
- .const_get(@status.capitalize)
- .new(@pipeline)
- .extend(Status::Pipeline::Common)
+ def extended_statuses
+ [Pipeline::SuccessWithWarnings]
end
- def extended_status
- @extended ||= EXTENDED_STATUSES.find do |status|
- status.matches?(@pipeline)
- end
+ def core_status
+ super.extend(Status::Pipeline::Common)
end
end
end
diff --git a/lib/gitlab/ci/status/stage/common.rb b/lib/gitlab/ci/status/stage/common.rb
new file mode 100644
index 00000000000..14c437d2b98
--- /dev/null
+++ b/lib/gitlab/ci/status/stage/common.rb
@@ -0,0 +1,24 @@
+module Gitlab
+ module Ci
+ module Status
+ module Stage
+ module Common
+ def has_details?
+ true
+ end
+
+ def details_path
+ namespace_project_pipeline_path(@subject.project.namespace,
+ @subject.project,
+ @subject.pipeline,
+ anchor: @subject.name)
+ end
+
+ def has_action?
+ false
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/status/stage/factory.rb b/lib/gitlab/ci/status/stage/factory.rb
new file mode 100644
index 00000000000..c6522d5ada1
--- /dev/null
+++ b/lib/gitlab/ci/status/stage/factory.rb
@@ -0,0 +1,15 @@
+module Gitlab
+ module Ci
+ module Status
+ module Stage
+ class Factory < Status::Factory
+ private
+
+ def core_status
+ super.extend(Status::Stage::Common)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/data_builder/pipeline.rb b/lib/gitlab/data_builder/pipeline.rb
index 06a783ebc1c..e50e54b6e99 100644
--- a/lib/gitlab/data_builder/pipeline.rb
+++ b/lib/gitlab/data_builder/pipeline.rb
@@ -22,7 +22,7 @@ module Gitlab
sha: pipeline.sha,
before_sha: pipeline.before_sha,
status: pipeline.status,
- stages: pipeline.stages,
+ stages: pipeline.stages_name,
created_at: pipeline.created_at,
finished_at: pipeline.finished_at,
duration: pipeline.duration
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
index 47d8599e298..35212992698 100644
--- a/lib/gitlab/search_results.rb
+++ b/lib/gitlab/search_results.rb
@@ -68,7 +68,7 @@ module Gitlab
end
def merge_requests
- merge_requests = MergeRequest.in_projects(project_ids_relation)
+ merge_requests = MergeRequestsFinder.new(current_user).execute.in_projects(project_ids_relation)
if query =~ /[#!](\d+)\z/
merge_requests = merge_requests.where(iid: $1)
else