eBooru/app/helpers/uploads_helper.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

20 lines
602 B
Ruby

# frozen_string_literal: true
module UploadsHelper
def render_status(upload)
case upload.status
when /duplicate: (\d+)/
dup_post_id = $1
link_to(upload.status.gsub("error: RuntimeError - ", ""), post_path(dup_post_id))
when /\Aerror: /
search_params = params[:search].permit!
link_to(upload.sanitized_status, uploads_path(search: search_params.merge({ status: upload.sanitized_status })))
else
search_params = params[:search].permit!
link_to(upload.status, uploads_path(search: search_params.merge({ status: upload.status })))
end
end
end