Commit b5677fd1 authored by James Lopez's avatar James Lopez

attempt to fix conflicts with mirror URL callbacks

parent 77b1e29c
...@@ -90,7 +90,8 @@ class Project < ActiveRecord::Base ...@@ -90,7 +90,8 @@ class Project < ActiveRecord::Base
after_destroy :remove_pages after_destroy :remove_pages
after_update :update_forks_visibility_level after_update :update_forks_visibility_level
after_update :remove_mirror_repository_reference, if: :import_url_changed? after_update :remove_mirror_repository_reference,
if: ->(project) { project.mirror? && project.import_url_changed? }
ActsAsTaggableOn.strict_case_match = true ActsAsTaggableOn.strict_case_match = true
acts_as_taggable_on :tags acts_as_taggable_on :tags
...@@ -1261,6 +1262,8 @@ class Project < ActiveRecord::Base ...@@ -1261,6 +1262,8 @@ class Project < ActiveRecord::Base
end end
def remove_mirror_repository_reference def remove_mirror_repository_reference
# return if it's the first assignment
return unless changes['import_url'] && changes['import_url'].first
repository.remove_remote(Repository::MIRROR_REMOTE) repository.remove_remote(Repository::MIRROR_REMOTE)
end end
......
...@@ -808,8 +808,8 @@ ActiveRecord::Schema.define(version: 20160414064845) do ...@@ -808,8 +808,8 @@ ActiveRecord::Schema.define(version: 20160414064845) do
t.integer "project_id" t.integer "project_id"
t.text "data" t.text "data"
t.text "encrypted_credentials" t.text "encrypted_credentials"
t.text "encrypted_credentials_iv" t.string "encrypted_credentials_iv"
t.text "encrypted_credentials_salt" t.string "encrypted_credentials_salt"
end end
create_table "projects", force: :cascade do |t| create_table "projects", force: :cascade do |t|
......
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