Skip to content

Commit

Permalink
Simplify the reporters iteration in the component preview
Browse files Browse the repository at this point in the history
  • Loading branch information
hellcp-work committed Sep 21, 2023
1 parent ebff696 commit cbf2312
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class ReportsNoticeComponentPreview < ViewComponent::Preview
# Preview at http://HOST:PORT/rails/view_components/reports_notice_component/user_reportable_as_admin
def user_reportable_as_admin
reportable = User.last
User.take(3).each do |reporter|
Report.new(reportable:, user: reporter).save!
User.take(3).each do |user|
Report.new(reportable:, user:).save!
end
render(ReportsNoticeComponent.new(reportable:, user: User.admins.first))
end
Expand All @@ -12,8 +12,8 @@ def user_reportable_as_admin
def user_reportable_as_reporter
reportable = User.last
reporters = User.take(3)
reporters.each do |reporter|
Report.new(reportable:, user: reporter).save!
reporters.each do |user|
Report.new(reportable:, user:).save!
end
render(ReportsNoticeComponent.new(reportable:, user: reporters.last))
end
Expand Down

0 comments on commit cbf2312

Please sign in to comment.