diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 219165627..cd73793aa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -657,8 +657,8 @@ def api_offset_and_limit(options=params) limit = options[:limit].to_i if limit < 1 limit = 25 - elsif limit > 100 - limit = 100 + elsif limit > Setting.api_limit.to_i + limit = Setting.api_limit.to_i end if offset.nil? && options[:page].present? offset = (options[:page].to_i - 1) * limit diff --git a/app/views/settings/_general.html.erb b/app/views/settings/_general.html.erb index 23abdb3f5..9a17a4e91 100644 --- a/app/views/settings/_general.html.erb +++ b/app/views/settings/_general.html.erb @@ -25,6 +25,8 @@

<%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %>

+

<%= setting_text_field :api_limit, :size => 6 %>

+

<%= setting_text_field :feeds_limit, :size => 6 %>

<%= call_hook(:view_settings_general_form) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b5245a7df..dcb6bcb32 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -419,6 +419,7 @@ en: setting_host_name: Host name and path setting_text_formatting: Text formatting setting_wiki_compression: Wiki history compression + setting_api_limit: Maximum number of items returned in a JSON/XML API response setting_feeds_limit: Maximum number of items in Atom feeds setting_default_projects_public: New projects are public by default setting_autofetch_changesets: Fetch commits automatically diff --git a/config/settings.yml b/config/settings.yml index 01f55a970..69745733d 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -113,6 +113,9 @@ host_name: protocol: default: http security_notifications: 1 +api_limit: + format: int + default: 100 feeds_limit: format: int default: 15