Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ブログのpublished_at=nilかつwip=falseでもindexとshowが表示されるようにする #4200

Merged
merged 3 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/views/articles/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
= article.user.login_name
.articles__item-meta
.articles__item-published-at
= article.wip? ? '執筆中' : l(article.published_at)
- if article.wip?
= '執筆中'
- elsif article.published_at.nil?
= l(article.created_at)
- else
= l(article.published_at)
7 changes: 6 additions & 1 deletion app/views/articles/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
= @article.user.login_name
.article__meta
.article__published-at
= @article.wip? ? '執筆中' : l(@article.published_at)
- if @article.wip?
= '執筆中'
- elsif @article.published_at.nil?
= l(@article.created_at)
- else
= l(@article.published_at)
.article__body
.js-markdown-view.is-long-text
= @article.body
Expand Down
7 changes: 7 additions & 0 deletions lib/tasks/bootcamp.rake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ namespace :bootcamp do

User.all.each(&:create_talk!)

if ENV['DB_NAME'] == 'bootcamp_staging'
Article.where(wip: false).where(published_at: nil).find_each do |article|
article.published_at = article.created_at
article.save!(validate: false)
end
end

puts '== END Cloud Build Task =='
end
end
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/articles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ article3:
body: 本文3
user: komagata
wip: true

# published_at=nilかつwip=false
article4:
title: タイトル4
body: 本文4
user: komagata
wip: false