Skip to content

Commit

Permalink
Juuuust in case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed May 17, 2018
1 parent d044b55 commit 433956c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/controllers/posts_controller.rb
Expand Up @@ -103,8 +103,6 @@ def create
@post.smoke_detector = @smoke_detector
@post.site = Site.find_by(site_domain: URI.parse(@post.link).host)

ReviewItem.create(reviewable: @post, queue: ReviewQueue['posts'], completed: false)

params['post']['reasons'].each do |r|
reason = Reason.find_or_create_by(reason_name: r.split('(').first.strip.humanize)

Expand All @@ -129,6 +127,12 @@ def create
rescue # rubocop:disable Lint/HandleExceptions
end

ri = ReviewItem.new(reviewable: @post, queue: ReviewQueue['posts'], completed: false)
ri_success = ri.save
unless ri_success
Rails.logger.warn "[post-create] review item create failed: #{ri.errors.full_messages.join(', ')}"
end

respond_to do |format|
if @post.save
format.json { render status: :created, plain: 'OK' }
Expand Down

0 comments on commit 433956c

Please sign in to comment.