mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
fix forums not being seeded
This commit is contained in:
parent
2ad2a4347f
commit
08b4889b31
2 changed files with 49 additions and 47 deletions
|
@ -100,11 +100,10 @@ for comment_body <- resources["comments"] do
|
|||
end
|
||||
|
||||
IO.puts "---- Generating forum posts"
|
||||
for resource <- resources["forum_posts"] do
|
||||
for {forum_name, topics} <- resource do
|
||||
for %{"forum" => forum_name, "topics" => topics} <- resources["forum_posts"] do
|
||||
forum = Repo.get_by!(Forum, short_name: forum_name)
|
||||
|
||||
for {topic_name, [first_post | posts]} <- topics do
|
||||
for %{"title" => topic_name, "posts" => [first_post | posts]} <- topics do
|
||||
Topics.create_topic(
|
||||
forum,
|
||||
request_attributes,
|
||||
|
@ -139,6 +138,5 @@ for resource <- resources["forum_posts"] do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
IO.puts "---- Done."
|
||||
|
|
|
@ -57,23 +57,27 @@
|
|||
"spoilers inside of a table\n\nHello | World\n--- | ---:\n`||cool beans!||` | ||cool beans!||"
|
||||
],
|
||||
"forum_posts": [{
|
||||
"dis": [{
|
||||
"Example topic": [
|
||||
"forum": "dis",
|
||||
"topics": [{
|
||||
"title": "Example Topic",
|
||||
"posts": [
|
||||
"example post",
|
||||
"yet another example post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Second example topic": [
|
||||
"title": "Second Example Topic",
|
||||
"posts": [
|
||||
"post",
|
||||
"post 2"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]},
|
||||
{
|
||||
"art": [{
|
||||
"Embedded images": [
|
||||
"forum": "art",
|
||||
"topics": [{
|
||||
"title": "Embedded Images",
|
||||
"posts": [
|
||||
">>1t >>1s >>1p",
|
||||
">>1",
|
||||
"non-existent: >>1000t >>1000s >>1000p >>1000"
|
||||
|
|
Loading…
Reference in a new issue