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
ef318152
Commit
ef318152
authored
3 years ago
by
pabois
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:noesya/osuny
parents
b9f1a496
b7559f28
No related branches found
Branches containing commit
Tags
v3.1.5
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/imported/page.rb
+4
-3
4 additions, 3 deletions
app/models/communication/website/imported/page.rb
app/models/communication/website/imported/post.rb
+3
-2
3 additions, 2 deletions
app/models/communication/website/imported/post.rb
with
7 additions
and
5 deletions
app/models/communication/website/imported/page.rb
+
4
−
3
View file @
ef318152
...
...
@@ -44,13 +44,13 @@ class Communication::Website::Imported::Page < ApplicationRecord
belongs_to
:page
,
class_name:
'Communication::Website::Page'
,
optional:
true
alias_attribute
:generated_object
,
:
category
alias_attribute
:generated_object
,
:
page
belongs_to
:featured_medium
,
class_name:
'Communication::Website::Imported::Medium'
,
optional:
true
before_validation
:sync
after_
save
:sync_attachments
after_
commit
:sync_attachments
,
on:
[
:create
,
:update
]
default_scope
{
order
(
:path
)
}
...
...
@@ -84,7 +84,7 @@ class Communication::Website::Imported::Page < ApplicationRecord
# Continue only if there are remote changes
# Don't touch if there are local changes (page.updated_at > updated_at)
# Don't touch if there are no remote changes (page.updated_at == updated_at)
#
return unless updated_at > page.updated_at
return
unless
updated_at
>
page
.
updated_at
end
puts
"Update page
#{
page
.
id
}
"
sanitized_title
=
Wordpress
.
clean_string
self
.
title
.
to_s
...
...
@@ -97,6 +97,7 @@ class Communication::Website::Imported::Page < ApplicationRecord
end
def
sync_attachments
return
unless
updated_at
>
page
.
updated_at
if
featured_medium
.
present?
unless
featured_medium
.
file
.
attached?
&&
featured_medium
.
file
.
blob
.
persisted?
featured_medium
.
load_remote_file!
...
...
This diff is collapsed.
Click to expand it.
app/models/communication/website/imported/post.rb
+
3
−
2
View file @
ef318152
...
...
@@ -48,7 +48,7 @@ class Communication::Website::Imported::Post < ApplicationRecord
optional:
true
before_validation
:sync
after_
save
:sync_attachments
after_
commit
:sync_attachments
,
on:
[
:create
,
:update
]
default_scope
{
order
(
path: :desc
)
}
...
...
@@ -82,7 +82,7 @@ class Communication::Website::Imported::Post < ApplicationRecord
# Continue only if there are remote changes
# Don't touch if there are local changes (post.updated_at > updated_at)
# Don't touch if there are no remote changes (post.updated_at == updated_at)
#
return unless updated_at > post.updated_at
return
unless
updated_at
>
post
.
updated_at
end
puts
"Update post
#{
post
.
id
}
"
sanitized_title
=
Wordpress
.
clean_string
self
.
title
.
to_s
...
...
@@ -98,6 +98,7 @@ class Communication::Website::Imported::Post < ApplicationRecord
end
def
sync_attachments
return
unless
updated_at
>
post
.
updated_at
if
featured_medium
.
present?
unless
featured_medium
.
file
.
attached?
&&
featured_medium
.
file
.
blob
.
persisted?
featured_medium
.
load_remote_file!
...
...
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