From b86f8d65d76ce0a121ae17828f27e437daa486ac Mon Sep 17 00:00:00 2001
From: Christian Ratz
-<% if @user.rss_token %> -<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %> -<% else %> -<%= l(:label_missing_feeds_access_key) %> +<% unless Setting.feeds_disabled? %> +
+ <% if @user.rss_token %> + <%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %> + <% else %> + <%= l(:label_missing_feeds_access_key) %> + <% end %> + (<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>) +
<% end %> -(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>) - <% if Setting.rest_api_enabled? %><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %>
+<%= setting_check_box :feeds_disabled, :size => 6 %>
+<%= setting_text_field :feeds_limit, :size => 6 %>
<%= setting_text_field :file_max_size_displayed, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %>
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index bb6afbe093..4ac8774c7e 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -211,6 +211,14 @@ module ActionView end end end + + module AssetTagHelper + def auto_discovery_link_tag_with_no_atom_feeds(type = :rss, url_options = {}, tag_options = {}) + return if (type == :atom) && Setting.table_exists? && Setting.feeds_disabled? + auto_discovery_link_tag_without_no_atom_feeds(type, url_options, tag_options) + end + alias_method_chain :auto_discovery_link_tag, :no_atom_feeds + end end end diff --git a/config/locales/de.yml b/config/locales/de.yml index 218d1d77b3..78611a4c49 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1148,6 +1148,7 @@ de: setting_emails_footer: "E-Mail-Fußzeile" setting_emails_header: "Emailkopf" setting_enabled_scm: "Aktivierte Versionskontrollsysteme" + setting_feeds_disabled: "Atom-Feeds deaktivieren" setting_feeds_limit: "Max. Anzahl Einträge pro Atom-Feed" setting_file_max_size_displayed: "Maximale Größe inline angezeigter Textdateien" setting_gravatar_default: "Standard-Gravatar-Bild" diff --git a/config/locales/en.yml b/config/locales/en.yml index 0284324075..0deb69b482 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1124,6 +1124,7 @@ en: setting_emails_footer: "Emails footer" setting_emails_header: "Emails header" setting_enabled_scm: "Enabled SCM" + setting_feeds_disabled: "Disable Feeds" setting_feeds_limit: "Feed content limit" setting_file_max_size_displayed: "Max size of text files displayed inline" setting_gravatar_default: "Default Gravatar image" diff --git a/config/settings.yml b/config/settings.yml index 84f819868f..1dce2332e5 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -81,6 +81,8 @@ host_name: default: localhost:3000 protocol: default: http +feeds_disabled: + default: 0 feeds_limit: format: int default: 15 diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 0b7f39c1d1..9cdf0d6179 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -15,6 +15,7 @@ See doc/COPYRIGHT.rdoc for more details. * `#1418` Additional changes: Change links to issues/planning elements to use work_packages controller * `#1898` Separate action for changing wiki parent page (was same as rename before) * `#1923` Add permission that allows hiding repository statistics on commits per author +* `#1850` Disable atom feeds via setting ## 3.0.0pre15 diff --git a/lib/redmine/views/other_formats_builder.rb b/lib/redmine/views/other_formats_builder.rb index 98d180b4af..0083a6eb81 100644 --- a/lib/redmine/views/other_formats_builder.rb +++ b/lib/redmine/views/other_formats_builder.rb @@ -18,6 +18,7 @@ module Redmine end def link_to(name, options={}) + return if Setting.table_exists? && Setting.feeds_disabled? && name == "Atom" url = { :format => name.to_s.downcase }.merge(options.delete(:url) || {}) caption = options.delete(:caption) || name html_options = { :class => name.to_s.downcase, :rel => 'nofollow' }.merge(options)