Commit b07dc938 authored by James Lopez's avatar James Lopez

fixed specs and refactored a few things due to recent model changes and merge conflicts

parent ad68bc63
Pipeline #3506957 failed with stages
in 486 minutes and 59 seconds
class CommitStatus < ActiveRecord::Base
include Statuseable
include Importable
self.table_name = 'ci_builds'
......@@ -7,7 +8,7 @@ class CommitStatus < ActiveRecord::Base
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id, touch: true
belongs_to :user
validates :pipeline, presence: true
validates :pipeline, presence: true, unless: :importing?
validates_presence_of :name
......@@ -4,6 +4,7 @@ class Note < ActiveRecord::Base
include Participable
include Mentionable
include Awardable
include Importable
default_value_for :system, false
......@@ -28,11 +29,11 @@ class Note < ActiveRecord::Base
validates :attachment, file_size: { maximum: :max_attachment_size }
validates :noteable_type, presence: true
validates :noteable_id, presence: true, unless: :for_commit?
validates :noteable_id, presence: true, unless: [:for_commit?, :importing?]
validates :commit_id, presence: true, if: :for_commit?
validates :author, presence: true
validate unless: :for_commit? do |note|
validate unless: [:for_commit?, :importing?] do |note|
unless note.noteable.try(:project) == note.project
errors.add(:invalid_project, 'Note and noteable project mismatch')
......@@ -3,7 +3,7 @@ module Gitlab
class RelationFactory
OVERRIDES = { snippets: :project_snippets,
ci_commits: 'Ci::Commit',
pipelines: 'Ci::Pipeline',
statuses: 'commit_status',
variables: 'Ci::Variable',
triggers: 'Ci::Trigger',
......@@ -18,7 +18,7 @@ module Gitlab
def initialize(relation_sym:, relation_hash:, members_mapper:, user_admin:)
@relation_name = OVERRIDES[relation_sym] || relation_sym
@relation_hash = relation_hash.except('id')
@relation_hash = relation_hash.except('id', 'noteable_id')
@members_mapper = members_mapper
@user_admin = user_admin
module Gitlab
module ImportExport
class UploadsRestorer < UploadsSaver
class << self
alias_method :restore, :save
def save
def restore
return true unless
copy_files(uploads_export_path, uploads_path)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment