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
f3ce2a7a
Unverified
Commit
f3ce2a7a
authored
2 years ago
by
Arnaud Levy
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #683 from noesya/more_legacy_fixes
Migration des vieux textes dans les pages
parents
9134f285
67530f53
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/blocks_migration.rb
+15
-11
15 additions, 11 deletions
app/services/blocks_migration.rb
with
15 additions
and
11 deletions
app/services/blocks_migration.rb
+
15
−
11
View file @
f3ce2a7a
...
...
@@ -5,22 +5,26 @@ class BlocksMigration
def
self
.
cleanup
Communication
::
Website
::
Post
.
find_each
do
|
post
|
next
if
post
.
text
.
blank?
cleanup_post
post
cleanup_item
post
end
Communication
::
Website
::
Page
.
find_each
do
|
page
|
cleanup_item
page
end
end
private
def
self
.
cleanup_post
(
post
)
puts
"
#{
post
}
(
#{
post
.
id
}
,
#{
post
.
university
}
)"
return
if
post
.
blocks
.
any?
def
self
.
cleanup_item
(
item
)
return
if
item
.
text
.
blank?
puts
"
#{
item
}
(
#{
item
.
id
}
,
#{
item
.
university
}
,
#{
item
.
website
}
)"
return
if
item
.
blocks
.
any?
puts
" migrating"
puts
post
.
text
.
to_html
# block = post.blocks.create university: post.university, template_kind: :chapter
# data = block.data
# data['text'] = post.text.to_html
# block.data = data
# block.save
puts
item
.
text
.
to_html
return
block
=
item
.
blocks
.
create
university:
item
.
university
,
template_kind: :chapter
data
=
block
.
data
data
[
'text'
]
=
item
.
text
.
to_html
block
.
data
=
data
block
.
save
end
end
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