mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 04:13:53 +08:00
Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
This commit is contained in:
@ -23,7 +23,7 @@ module Onebox
|
||||
linked = "<a href='#{@url}'>#{@url}</a>"
|
||||
if route[:post_number].present? && route[:post_number].to_i > 1
|
||||
# Post Link
|
||||
post = Post.where(topic_id: route[:topic_id], post_number: route[:post_number].to_i).first
|
||||
post = Post.find_by(topic_id: route[:topic_id], post_number: route[:post_number].to_i)
|
||||
return linked unless post
|
||||
return linked if post.hidden
|
||||
return linked unless Guardian.new.can_see?(post)
|
||||
|
Reference in New Issue
Block a user