Skip to content
Snippets Groups Projects
Unverified Commit 793d1626 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

website website

parent 7197c1b6
No related branches found
No related tags found
No related merge requests found
......@@ -107,6 +107,14 @@ class Communication::Website < ApplicationRecord
languages.find_by(iso_code: iso_code) || default_language
end
def website
self
end
def website_id
id
end
protected
def sanitize_fields
......
......@@ -32,35 +32,31 @@ module WithGit
end
def sync_with_git
return unless website_for_self.git_repository.valid?
Communication::Website::GitFile.sync website_for_self, self
return unless website.git_repository.valid?
Communication::Website::GitFile.sync website, self
recursive_dependencies.each do |object|
Communication::Website::GitFile.sync website_for_self, object
Communication::Website::GitFile.sync website, object
end
references.each do |object|
Communication::Website::GitFile.sync website_for_self, object
Communication::Website::GitFile.sync website, object
end
website_for_self.git_repository.sync!
website.git_repository.sync!
end
handle_asynchronously :sync_with_git, queue: 'default'
def destroy_from_git
return unless website_for_self.git_repository.valid?
Communication::Website::GitFile.sync website_for_self, self, destroy: true
return unless website.git_repository.valid?
Communication::Website::GitFile.sync website, self, destroy: true
# # FIXME
# dependencies = git_destroy_dependencies(website).to_a.flatten.uniq.compact
# dependencies.each do |object|
# Communication::Website::GitFile.sync website, object, destroy: true
# end
website_for_self.git_repository.sync!
website.git_repository.sync!
end
def for_website?(website)
if is_a? Communication::Website
website.id == id
else
website.id == website_id
end
website.id == website_id
end
protected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment