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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 15:11:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 15:11:29 +0300
commit7b384a1f3d2608898318e67d11eea2914889ae81 (patch)
treeaf33e77d13b18a96156c69616cb09a3a4f7697c6 /app/models
parentd46287cc16ba244720c6d5c00491944336972988 (diff)
Add latest changes from gitlab-org/gitlab@12-3-stable
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--app/models/ci/job_artifact.rb6
-rw-r--r--app/models/clusters/cluster.rb2
-rw-r--r--app/models/lfs_object.rb1
-rw-r--r--app/models/project.rb1
-rw-r--r--app/models/project_services/jira_service.rb2
-rw-r--r--app/models/release.rb1
-rw-r--r--app/models/repository.rb28
8 files changed, 14 insertions, 29 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 3ef0ed0ef49..1f8a0373450 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -118,6 +118,8 @@ module Ci
scope :eager_load_job_artifacts, -> { includes(:job_artifacts) }
+ scope :with_artifacts_stored_locally, -> { with_existing_job_artifacts(Ci::JobArtifact.archive.with_files_stored_locally) }
+ scope :with_archived_trace_stored_locally, -> { with_existing_job_artifacts(Ci::JobArtifact.trace.with_files_stored_locally) }
scope :with_artifacts_not_expired, ->() { with_artifacts_archive.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
scope :with_expired_artifacts, ->() { with_artifacts_archive.where('artifacts_expire_at < ?', Time.now) }
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) }
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index 62bf2c3ac9c..da2758507ce 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -5,7 +5,6 @@ module Ci
include AfterCommitQueue
include ObjectStorage::BackgroundMove
include UpdateProjectStatistics
- include Sortable
extend Gitlab::Ci::Model
NotSupportedAdapterError = Class.new(StandardError)
@@ -65,7 +64,6 @@ module Ci
after_save :update_file_store, if: :saved_change_to_file?
scope :with_files_stored_locally, -> { where(file_store: [nil, ::JobArtifactUploader::Store::LOCAL]) }
- scope :with_files_stored_remotely, -> { where(file_store: ::JobArtifactUploader::Store::REMOTE) }
scope :with_file_types, -> (file_types) do
types = self.file_types.select { |file_type| file_types.include?(file_type) }.values
@@ -145,10 +143,6 @@ module Ci
self.update_column(:file_store, file.object_store)
end
- def self.total_size
- self.sum(:size)
- end
-
def self.artifacts_size_for(project)
self.where(project: project).sum(:size)
end
diff --git a/app/models/clusters/cluster.rb b/app/models/clusters/cluster.rb
index 231cadfae05..6a5b98a4676 100644
--- a/app/models/clusters/cluster.rb
+++ b/app/models/clusters/cluster.rb
@@ -39,7 +39,7 @@ module Clusters
def self.has_one_cluster_application(name) # rubocop:disable Naming/PredicateName
application = APPLICATIONS[name.to_s]
- has_one application.association_name, class_name: application.to_s, inverse_of: :cluster # rubocop:disable Rails/ReflectionClassName
+ has_one application.association_name, class_name: application.to_s # rubocop:disable Rails/ReflectionClassName
end
has_one_cluster_application :helm
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb
index f73aa2705b7..60b11ad9356 100644
--- a/app/models/lfs_object.rb
+++ b/app/models/lfs_object.rb
@@ -9,7 +9,6 @@ class LfsObject < ApplicationRecord
has_many :projects, -> { distinct }, through: :lfs_objects_projects
scope :with_files_stored_locally, -> { where(file_store: LfsObjectUploader::Store::LOCAL) }
- scope :with_files_stored_remotely, -> { where(file_store: LfsObjectUploader::Store::REMOTE) }
validates :oid, presence: true, uniqueness: true
diff --git a/app/models/project.rb b/app/models/project.rb
index 18afccf7ddc..7c065db9829 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -273,7 +273,6 @@ class Project < ApplicationRecord
has_many :builds, class_name: 'Ci::Build', inverse_of: :project, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :build_trace_section_names, class_name: 'Ci::BuildTraceSectionName'
has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks
- has_many :job_artifacts, class_name: 'Ci::JobArtifact'
has_many :runner_projects, class_name: 'Ci::RunnerProject', inverse_of: :project
has_many :runners, through: :runner_projects, source: :runner, class_name: 'Ci::Runner'
has_many :variables, class_name: 'Ci::Variable'
diff --git a/app/models/project_services/jira_service.rb b/app/models/project_services/jira_service.rb
index 86139c62f68..a76970bfa2a 100644
--- a/app/models/project_services/jira_service.rb
+++ b/app/models/project_services/jira_service.rb
@@ -298,7 +298,7 @@ class JiraService < IssueTrackerService
title: title,
status: status,
icon: {
- title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.base_url)
+ title: 'GitLab', url16x16: asset_url(Gitlab::Favicon.main, host: gitlab_config.url)
}
}
}
diff --git a/app/models/release.rb b/app/models/release.rb
index 9117a475ee9..cd63b4d5fef 100644
--- a/app/models/release.rb
+++ b/app/models/release.rb
@@ -22,6 +22,7 @@ class Release < ApplicationRecord
accepts_nested_attributes_for :links, allow_destroy: true
validates :description, :project, :tag, presence: true
+ validates :name, presence: true, on: :create
validates_associated :milestone_releases, message: -> (_, obj) { obj[:value].map(&:errors).map(&:full_messages).join(",") }
scope :sorted, -> { order(released_at: :desc) }
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 96b1b55e2b1..f084a314392 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -133,28 +133,18 @@ class Repository
end
end
- # the opts are:
- # - :path
- # - :limit
- # - :offset
- # - :skip_merges
- # - :after
- # - :before
- # - :all
- # - :first_parent
- def commits(ref = nil, opts = {})
+ def commits(ref = nil, path: nil, limit: nil, offset: nil, skip_merges: false, after: nil, before: nil, all: nil)
options = {
repo: raw_repository,
ref: ref,
- path: opts[:path],
- follow: Array(opts[:path]).length == 1,
- limit: opts[:limit],
- offset: opts[:offset],
- skip_merges: !!opts[:skip_merges],
- after: opts[:after],
- before: opts[:before],
- all: !!opts[:all],
- first_parent: !!opts[:first_parent]
+ path: path,
+ limit: limit,
+ offset: offset,
+ after: after,
+ before: before,
+ follow: Array(path).length == 1,
+ skip_merges: skip_merges,
+ all: all
}
commits = Gitlab::Git::Commit.where(options)