eBooru/app/helpers/dmails_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

27 lines
580 B
Ruby

# frozen_string_literal: true
module DmailsHelper
def dmails_current_folder_path
case cookies[:dmail_folder]
when "sent"
sent_dmails_path
when "received"
received_dmails_path
else
all_dmails_path
end
end
def all_dmails_path(params = {})
dmails_path(folder: "all", **params)
end
def sent_dmails_path(params = {})
dmails_path(search: {from_id: CurrentUser.id}, folder: "sent", **params)
end
def received_dmails_path(params = {})
dmails_path(search: {to_id: CurrentUser.id}, folder: "received", **params)
end
end