Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
793d1626
Unverified
Commit
793d1626
authored
2 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
website website
parent
7197c1b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/communication/website.rb
+8
-0
8 additions, 0 deletions
app/models/communication/website.rb
app/models/concerns/with_git.rb
+9
-13
9 additions, 13 deletions
app/models/concerns/with_git.rb
with
17 additions
and
13 deletions
app/models/communication/website.rb
+
8
−
0
View file @
793d1626
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
app/models/concerns/with_git.rb
+
9
−
13
View file @
793d1626
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment