diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 24c962df2b3..85aca138411 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -166,4 +166,24 @@ def show_super_admin_bar? cookies[:admin] == "true" end + + def custom_pagy_url_for(pagy, page, current_path: nil) + if current_path.blank? + pagy_url_for(pagy, page) + else + uri = URI.parse(current_path) + params = URI.decode_www_form(uri.query || "").to_h + + # Delete existing page param if it exists + params.delete("page") + # Add new page param unless it's page 1 + params["page"] = page unless page == 1 + + if params.empty? + uri.path + else + "#{uri.path}?#{URI.encode_www_form(params)}" + end + end + end end diff --git a/app/models/concerns/providable.rb b/app/models/concerns/providable.rb index 4a8de8c09c1..996efff8841 100644 --- a/app/models/concerns/providable.rb +++ b/app/models/concerns/providable.rb @@ -23,10 +23,8 @@ def git_repository_provider end def synth_provider - @synth_provider ||= begin - api_key = self_hosted? ? Setting.synth_api_key : ENV["SYNTH_API_KEY"] - api_key.present? ? Provider::Synth.new(api_key) : nil - end + api_key = self_hosted? ? Setting.synth_api_key : ENV["SYNTH_API_KEY"] + api_key.present? ? Provider::Synth.new(api_key) : nil end private diff --git a/app/views/account/entries/index.html.erb b/app/views/account/entries/index.html.erb index c659d97f532..31197675d6d 100644 --- a/app/views/account/entries/index.html.erb +++ b/app/views/account/entries/index.html.erb @@ -84,7 +84,7 @@