From: Anton Khorev Date: Thu, 24 Aug 2023 15:38:03 +0000 (+0300) Subject: Move max value of issues counter to settings X-Git-Tag: live~1049^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/fff98f2afbc73375fd5242b0f95b98303d84637a Move max value of issues counter to settings --- diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 7bc64cb83..aab742bf5 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -26,9 +26,9 @@ module IssuesHelper end def open_issues_count - count = Issue.visible_to(current_user).open.limit(100).size - if count > 99 - tag.span("99+", :class => "badge count-number") + count = Issue.visible_to(current_user).open.limit(Settings.max_issues_count).size + if count >= Settings.max_issues_count + tag.span("#{Settings.max_issues_count - 1}+", :class => "badge count-number") elsif count.positive? tag.span(count, :class => "badge count-number") end diff --git a/config/initializers/config.rb b/config/initializers/config.rb index 983f02266..c1cc522a5 100644 --- a/config/initializers/config.rb +++ b/config/initializers/config.rb @@ -77,6 +77,7 @@ Config.setup do |config| required(:tracepoints_per_page).filled(:int?) required(:max_number_of_way_nodes).filled(:int?) required(:max_number_of_relation_members).filled(:int?) + required(:max_issues_count).filled(:int?) required(:api_timeout).filled(:int?) required(:imagery_blacklist).maybe(:array?) required(:status).filled(:str?, :included_in? => ALLOWED_STATUS) diff --git a/config/settings.yml b/config/settings.yml index 3ea298efc..2274d727c 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -43,6 +43,8 @@ max_note_request_area: 25 default_note_query_limit: 100 # Maximum limit on the number of notes returned by the note search api method max_note_query_limit: 10000 +# Maximum value of open issues counter for moderators, anything equal or over this value "n" is shown as "(n-1)+" +max_issues_count: 100 # Zoom level to use for postcode results from the geocoder postcode_zoom: 15 # Timeout for API calls in seconds