From f286a6044be49b88b067f89072618aecc7164caa Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Sat, 19 Mar 2022 09:56:46 +0000 Subject: [PATCH] Deprecate and rename rss_* methods to atom_* methods (#15118). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by Mischa The Evil and Marius BĂLTEANU git-svn-id: http://svn.redmine.org/redmine/trunk@21467 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/activities_controller.rb | 2 +- app/controllers/application_controller.rb | 27 +++++++++++++++------ app/controllers/boards_controller.rb | 2 +- app/controllers/issues_controller.rb | 2 +- app/controllers/journals_controller.rb | 2 +- app/controllers/my_controller.rb | 16 ++++++++---- app/controllers/news_controller.rb | 2 +- app/controllers/projects_controller.rb | 4 +-- app/controllers/repositories_controller.rb | 2 +- app/controllers/timelog_controller.rb | 2 +- app/models/anonymous_user.rb | 2 +- app/models/user.rb | 26 ++++++++++++++------ app/views/activities/index.html.erb | 4 +-- app/views/boards/index.html.erb | 4 +-- app/views/boards/show.html.erb | 4 +-- app/views/issues/index.html.erb | 6 ++--- app/views/issues/show.html.erb | 4 +-- app/views/journals/index.builder | 2 +- app/views/my/_sidebar.html.erb | 6 ++--- app/views/my/blocks/_issues.erb | 2 +- app/views/news/index.html.erb | 4 +-- app/views/projects/index.html.erb | 2 +- app/views/projects/show.html.erb | 2 +- app/views/repositories/revisions.html.erb | 4 +-- app/views/repositories/show.html.erb | 4 +-- app/views/timelog/index.html.erb | 4 +-- app/views/users/show.html.erb | 4 +-- app/views/welcome/index.html.erb | 4 +-- app/views/wiki/date_index.html.erb | 4 +-- app/views/wiki/index.html.erb | 4 +-- config/routes.rb | 2 +- test/functional/journals_controller_test.rb | 2 +- test/functional/my_controller_test.rb | 18 +++++++------- test/integration/application_test.rb | 4 +-- test/integration/routing/my_test.rb | 2 +- test/unit/user_test.rb | 14 +++++------ 36 files changed, 114 insertions(+), 85 deletions(-) diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 405c7d0a0..7746ec2f6 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -20,7 +20,7 @@ class ActivitiesController < ApplicationController menu_item :activity before_action :find_optional_project_by_id, :authorize_global - accept_rss_auth :index + accept_atom_auth :index def index @days = Setting.activity_days_default.to_i diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c287cc96a..5d2c9074e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -33,7 +33,7 @@ class ApplicationController < ActionController::Base helper :avatars class_attribute :accept_api_auth_actions - class_attribute :accept_rss_auth_actions + class_attribute :accept_atom_auth_actions class_attribute :model_object layout 'base' @@ -120,9 +120,9 @@ class ApplicationController < ActionController::Base end elsif autologin_user = try_to_autologin user = autologin_user - elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth? - # RSS key authentication does not start a session - user = User.find_by_rss_key(params[:key]) + elsif params[:format] == 'atom' && params[:key] && request.get? && accept_atom_auth? + # ATOM key authentication does not start a session + user = User.find_by_atom_key(params[:key]) end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? @@ -624,16 +624,27 @@ class ApplicationController < ActionController::Base :content_type => 'application/atom+xml' end - def self.accept_rss_auth(*actions) + def self.accept_atom_auth(*actions) if actions.any? - self.accept_rss_auth_actions = actions + self.accept_atom_auth_actions = actions else - self.accept_rss_auth_actions || [] + self.accept_atom_auth_actions || [] end end + def self.accept_rss_auth(*actions) + ActiveSupport::Deprecation.warn "Application#self.accept_rss_auth is deprecated and will be removed in Redmine 6.0. Please use #self.accept_atom_auth instead." + self.class.accept_atom_auth(*actions) + end + + def accept_atom_auth?(action=action_name) + self.class.accept_atom_auth.include?(action.to_sym) + end + + # TODO: remove in Redmine 6.0 def accept_rss_auth?(action=action_name) - self.class.accept_rss_auth.include?(action.to_sym) + ActiveSupport::Deprecation.warn "Application#accept_rss_auth? is deprecated and will be removed in Redmine 6.0. Please use #accept_atom_auth? instead." + accept_atom_auth?(action) end def self.accept_api_auth(*actions) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 1f84b091e..b2d0d35b0 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -20,7 +20,7 @@ class BoardsController < ApplicationController default_search_scope :messages before_action :find_project_by_project_id, :find_board_if_available, :authorize - accept_rss_auth :index, :show + accept_atom_auth :index, :show helper :sort include SortHelper diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 41ee95051..f1dfa2b58 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -25,7 +25,7 @@ class IssuesController < ApplicationController before_action :authorize, :except => [:index, :new, :create] before_action :find_optional_project, :only => [:index, :new, :create] before_action :build_new_issue_from_params, :only => [:new, :create] - accept_rss_auth :index, :show + accept_atom_auth :index, :show accept_api_auth :index, :show, :create, :update, :destroy rescue_from Query::StatementInvalid, :with => :query_statement_invalid diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 8c2f433c9..368dfdf25 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -22,7 +22,7 @@ class JournalsController < ApplicationController before_action :find_issue, :only => [:new] before_action :find_optional_project, :only => [:index] before_action :authorize, :only => [:new, :edit, :update, :diff] - accept_rss_auth :index + accept_atom_auth :index menu_item :issues helper :issues diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 58038d332..38427e97d 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -26,7 +26,7 @@ class MyController < ApplicationController accept_api_auth :account require_sudo_mode :account, only: :put - require_sudo_mode :reset_rss_key, :reset_api_key, :show_api_key, :destroy + require_sudo_mode :reset_atom_key, :reset_api_key, :show_api_key, :destroy helper :issues helper :users @@ -120,18 +120,24 @@ class MyController < ApplicationController end # Create a new feeds key - def reset_rss_key + def reset_atom_key if request.post? - if User.current.rss_token - User.current.rss_token.destroy + if User.current.atom_token + User.current.atom_token.destroy User.current.reload end - User.current.rss_key + User.current.atom_key flash[:notice] = l(:notice_feeds_access_key_reseted) end redirect_to my_account_path end + # TODO: remove in Redmine 6.0 + def reset_rss_key + ActiveSupport::Deprecation.warn "My#reset_rss_key is deprecated and will be removed in Redmine 6.0. Please use #reset_atom_key instead." + reset_atom_key + end + def show_api_key @user = User.current end diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index e64ca075d..801952c21 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -25,7 +25,7 @@ class NewsController < ApplicationController before_action :find_project_by_project_id, :only => :create before_action :authorize, :except => [:index, :new] before_action :find_optional_project, :only => [:index, :new] - accept_rss_auth :index + accept_atom_auth :index accept_api_auth :index, :show, :create, :update, :destroy helper :watchers diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c2e2c70ea..e775f6b10 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,7 +30,7 @@ class ProjectsController < ApplicationController :destroy] before_action :authorize_global, :only => [:new, :create] before_action :require_admin, :only => [:copy, :archive, :unarchive] - accept_rss_auth :index + accept_atom_auth :index accept_api_auth :index, :show, :create, :update, :destroy, :archive, :unarchive, :close, :reopen require_sudo_mode :destroy @@ -192,7 +192,7 @@ class ProjectsController < ApplicationController @total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f end - @key = User.current.rss_key + @key = User.current.atom_key end format.api end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index fe55e1770..e6546df1e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers] before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] before_action :authorize - accept_rss_auth :revisions + accept_atom_auth :revisions accept_api_auth :add_related_issue, :remove_related_issue rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 7b56a6c27..c0570c304 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -28,7 +28,7 @@ class TimelogController < ApplicationController before_action :find_optional_issue, :only => [:new, :create] before_action :find_optional_project, :only => [:index, :report] - accept_rss_auth :index + accept_atom_auth :index accept_api_auth :index, :show, :create, :update, :destroy rescue_from Query::StatementInvalid, :with => :query_statement_invalid diff --git a/app/models/anonymous_user.rb b/app/models/anonymous_user.rb index eddcf814c..b4995d1d0 100644 --- a/app/models/anonymous_user.rb +++ b/app/models/anonymous_user.rb @@ -38,7 +38,7 @@ class AnonymousUser < User def mail=(*args); nil end def mail; nil end def time_zone; nil end - def rss_key; nil end + def atom_key; nil end def pref UserPreference.new(:user => self) diff --git a/app/models/user.rb b/app/models/user.rb index eac3d82ae..ffe147ba1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -87,7 +87,7 @@ class User < Principal :after_remove => Proc.new {|user, group| group.user_removed(user)} has_many :changesets, :dependent => :nullify has_one :preference, :dependent => :destroy, :class_name => 'UserPreference' - has_one :rss_token, lambda {where "action='feeds'"}, :class_name => 'Token' + has_one :atom_token, lambda {where "action='feeds'"}, :class_name => 'Token' has_one :api_token, lambda {where "action='api'"}, :class_name => 'Token' has_one :email_address, lambda {where :is_default => true}, :autosave => true has_many :email_addresses, :dependent => :delete_all @@ -415,12 +415,18 @@ class User < Principal self.pref[:comments_sorting] == 'desc' end - # Return user's RSS key (a 40 chars long string), used to access feeds - def rss_key - if rss_token.nil? - create_rss_token(:action => 'feeds') + # Return user's ATOM key (a 40 chars long string), used to access feeds + def atom_key + if atom_token.nil? + create_atom_token(:action => 'feeds') end - rss_token.value + atom_token.value + end + + # TODO: remove in Redmine 6.0 + def rss_key + ActiveSupport::Deprecation.warn "User.rss_key is deprecated and will be removed in Redmine 6.0. Please use User.atom_key instead." + atom_key end # Return user's API key (a 40 chars long string), used to access the API @@ -530,10 +536,16 @@ class User < Principal end end - def self.find_by_rss_key(key) + def self.find_by_atom_key(key) Token.find_active_user('feeds', key) end + # TODO: remove in Redmine 6.0 + def self.find_by_rss_key(key) + ActiveSupport::Deprecation.warn "User.find_by_rss_key is deprecated and will be removed in Redmine 6.0. Please use User.find_by_atom_key instead." + self.find_by_atom_key(key) + end + def self.find_by_api_key(key) Token.find_active_user('api', key) end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index e7f179ebe..83f67b1b8 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -22,11 +22,11 @@   <% other_formats_links do |f| %> - <%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.rss_key %> + <%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.atom_key %> <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.rss_key), :format => 'atom') %> +<%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.atom_key), :format => 'atom') %> <% end %> <% content_for :sidebar do %> diff --git a/app/views/boards/index.html.erb b/app/views/boards/index.html.erb index 7d0da1696..63daeb535 100644 --- a/app/views/boards/index.html.erb +++ b/app/views/boards/index.html.erb @@ -38,11 +38,11 @@ <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.atom_key} %> <% end %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}) %> + <%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.atom_key}) %> <% end %> <% html_title l(:label_board_plural) %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index b80ff0383..bc8c24c3d 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -58,10 +58,10 @@ <% end %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %> <% end %> <% html_title @board.name %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@project}: #{@board}") %> <% end %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index b05b6ccf2..5a4d6b2c4 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -34,7 +34,7 @@ <% end %> <% other_formats_links do |f| %> - <%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %> + <%= f.link_to_with_query_parameters 'Atom', :key => User.current.atom_key %> <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %> <%= f.link_to_with_query_parameters 'PDF' %> <% end %> @@ -80,12 +80,12 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, + :page => nil, :key => User.current.atom_key}, :title => l(:label_issue_plural)) %> <%= auto_discovery_link_tag(:atom, {:controller => 'journals', :action => 'index', :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, + :page => nil, :key => User.current.atom_key}, :title => l(:label_changes_details)) %> <% end %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 390728ada..c7cd5689c 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -127,7 +127,7 @@ end %> <%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %> <%= f.link_to 'PDF' %> <% end %> @@ -145,7 +145,7 @@ end %> <% end %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> + <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> <% end %> <%= context_menu %> diff --git a/app/views/journals/index.builder b/app/views/journals/index.builder index b044d8c84..26a067f6c 100644 --- a/app/views/journals/index.builder +++ b/app/views/journals/index.builder @@ -3,7 +3,7 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.title @title - xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false) + xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.atom_key, :only_path => false) xml.link "rel" => "alternate", "href" => home_url xml.id home_url xml.icon favicon_url diff --git a/app/views/my/_sidebar.html.erb b/app/views/my/_sidebar.html.erb index 01ac5c6a5..cd4860796 100644 --- a/app/views/my/_sidebar.html.erb +++ b/app/views/my/_sidebar.html.erb @@ -10,12 +10,12 @@

<%= l(:label_feeds_access_key) %>

-<% if @user.rss_token %> -<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %> +<% if @user.atom_token %> +<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.atom_token.created_on)) %> <% else %> <%= l(:label_missing_feeds_access_key) %> <% end %> -(<%= link_to l(:button_reset), my_rss_key_path, :method => :post %>) +(<%= link_to l(:button_reset), my_atom_key_path, :method => :post %>)

<% if Setting.rest_api_enabled? %> diff --git a/app/views/my/blocks/_issues.erb b/app/views/my/blocks/_issues.erb index 845ef5b85..d7cff39e6 100644 --- a/app/views/my/blocks/_issues.erb +++ b/app/views/my/blocks/_issues.erb @@ -36,6 +36,6 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, - _project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.rss_key)), + _project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.atom_key)), {:title => query.name}) %> <% end %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 8ec1d512a..64fbe578b 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -38,11 +38,11 @@ <%= pagination_links_full @news_pages %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.atom_key} %> <% end %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, _project_news_path(@project, :key => User.current.rss_key, :format => 'atom')) %> + <%= auto_discovery_link_tag(:atom, _project_news_path(@project, :key => User.current.atom_key, :format => 'atom')) %> <%= stylesheet_link_tag 'scm' %> <% end %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index adf6b868f..3bd665640 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -30,7 +30,7 @@ <% end %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %> <% if @query.display_type == 'list' %> <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %> <% end %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 18b15d840..5c7ef440c 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -151,7 +151,7 @@ <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %> +<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.atom_key}) %> <% end %> <% html_title(l(:label_overview)) -%> diff --git a/app/views/repositories/revisions.html.erb b/app/views/repositories/revisions.html.erb index fc22210da..a12942c49 100644 --- a/app/views/repositories/revisions.html.erb +++ b/app/views/repositories/revisions.html.erb @@ -23,12 +23,12 @@ <%= stylesheet_link_tag "scm" %> <%= auto_discovery_link_tag( :atom, - :params => request.query_parameters.merge(:page => nil, :key => User.current.rss_key), + :params => request.query_parameters.merge(:page => nil, :key => User.current.atom_key), :format => 'atom') %> <% end %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %> <% end %> <% html_title(l(:label_revision_plural)) -%> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index adcce9f64..5533ff09d 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -45,14 +45,14 @@ :atom, :action => 'revisions', :id => @project, :repository_id => @repository.identifier_param, - :key => User.current.rss_key) %> + :key => User.current.atom_key) %> <% end %> <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:action => 'revisions', :id => @project, :repository_id => @repository.identifier_param, - :key => User.current.rss_key} %> + :key => User.current.atom_key} %> <% end %> <% end %> <% end %> diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index 7b9778d8e..f6751ebc8 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -28,7 +28,7 @@ <%= pagination_links_full @entry_pages, @entry_count %> <% other_formats_links do |f| %> - <%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %> + <%= f.link_to_with_query_parameters 'Atom', :key => User.current.atom_key %> <%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <% end %> @@ -67,5 +67,5 @@ <% html_title(@query.new_record? ? l(:label_spent_time) : @query.name, l(:label_details)) %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :title => l(:label_spent_time)) %> + <%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.atom_key}, :title => l(:label_spent_time)) %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fabf91dae..16a6c3414 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -122,11 +122,11 @@ <%= render :partial => 'activities/activities', :locals => {:events_by_day => @events_by_day} %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.atom_key} %> <% end %> <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.rss_key) %> + <%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.atom_key) %> <% end %> <% end %> <%= call_hook :view_account_right_bottom, :user => @user %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 32e338fdf..990fc03fb 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -21,8 +21,8 @@ <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'}, +<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.atom_key, :format => 'atom'}, :title => "#{Setting.app_title}: #{l(:label_news_latest)}") %> -<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.rss_key, :format => 'atom'}, +<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.atom_key, :format => 'atom'}, :title => "#{Setting.app_title}: #{l(:label_activity)}") %> <% end %> diff --git a/app/views/wiki/date_index.html.erb b/app/views/wiki/date_index.html.erb index 274f19a8a..496411b7f 100644 --- a/app/views/wiki/date_index.html.erb +++ b/app/views/wiki/date_index.html.erb @@ -29,7 +29,7 @@ <% unless @pages.empty? %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %> + <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.atom_key} %> <% if User.current.allowed_to?(:export_wiki_pages, @project) %> <%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %> <%= f.link_to('HTML', :url => {:action => 'export'}) %> @@ -38,5 +38,5 @@ <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %> +<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.atom_key) %> <% end %> diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erb index bb6086874..3c7f55dab 100644 --- a/app/views/wiki/index.html.erb +++ b/app/views/wiki/index.html.erb @@ -25,7 +25,7 @@ <%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, - :key => User.current.rss_key} %> + :key => User.current.atom_key} %> <% if User.current.allowed_to?(:export_wiki_pages, @project) %> <%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %> <%= f.link_to('HTML', :url => {:action => 'export'}) %> @@ -37,5 +37,5 @@ <%= auto_discovery_link_tag( :atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', - :key => User.current.rss_key) %> + :key => User.current.atom_key) %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index ccfd00195..5cb0055e5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,7 +89,7 @@ Rails.application.routes.draw do match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page get 'my/api_key', :to => 'my#show_api_key', :as => 'my_api_key' post 'my/api_key', :to => 'my#reset_api_key' - post 'my/rss_key', :to => 'my#reset_rss_key', :as => 'my_rss_key' + post 'my/atom_key', :to => 'my#reset_atom_key', :as => 'my_atom_key' match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index ac6b5c69e..b1d1ffc6c 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -94,7 +94,7 @@ class JournalsControllerTest < Redmine::ControllerTest :index, :params => { :format => 'atom', - :key => user.rss_key + :key => user.atom_key } ) @fields.each_with_index do |field, i| diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index 8439115fc..a2442dc4d 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -787,22 +787,22 @@ class MyControllerTest < Redmine::ControllerTest User.find(2).pref.my_page_layout) end - def test_reset_rss_key_with_existing_key - @previous_token_value = User.find(2).rss_key # Will generate one if it's missing - post :reset_rss_key + def test_reset_atom_key_with_existing_key + @previous_token_value = User.find(2).atom_key # Will generate one if it's missing + post :reset_atom_key - assert_not_equal @previous_token_value, User.find(2).rss_key - assert User.find(2).rss_token + assert_not_equal @previous_token_value, User.find(2).atom_key + assert User.find(2).atom_token assert_match /reset/, flash[:notice] assert_redirected_to '/my/account' end - def test_reset_rss_key_without_existing_key + def test_reset_atom_key_without_existing_key Token.delete_all - assert_nil User.find(2).rss_token - post :reset_rss_key + assert_nil User.find(2).atom_token + post :reset_atom_key - assert User.find(2).rss_token + assert User.find(2).atom_token assert_match /reset/, flash[:notice] assert_redirected_to '/my/account' end diff --git a/test/integration/application_test.rb b/test/integration/application_test.rb index 28cd4aa8d..a4e2808a1 100644 --- a/test/integration/application_test.rb +++ b/test/integration/application_test.rb @@ -59,8 +59,8 @@ class ApplicationTest < Redmine::IntegrationTest get '/issues/4.atom' assert_response 302 - rss_key = User.find(2).rss_key - get "/issues/4.atom?key=#{rss_key}" + atom_key = User.find(2).atom_key + get "/issues/4.atom?key=#{atom_key}" assert_response 200 assert_nil session[:user_id] end diff --git a/test/integration/routing/my_test.rb b/test/integration/routing/my_test.rb index 2fdb53aad..bf6dfa4ae 100644 --- a/test/integration/routing/my_test.rb +++ b/test/integration/routing/my_test.rb @@ -33,7 +33,7 @@ class RoutingMyTest < Redmine::RoutingTest should_route 'GET /my/api_key' => 'my#show_api_key' should_route 'POST /my/api_key' => 'my#reset_api_key' - should_route 'POST /my/rss_key' => 'my#reset_rss_key' + should_route 'POST /my/atom_key' => 'my#reset_atom_key' should_route 'GET /my/password' => 'my#password' should_route 'POST /my/password' => 'my#password' diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 6590ce2f7..9e2b9be1a 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -798,19 +798,19 @@ class UserTest < ActiveSupport::TestCase assert_equal 1, anon2.errors.count end - def test_rss_key - assert_nil @jsmith.rss_token - key = @jsmith.rss_key + def test_atom_key + assert_nil @jsmith.atom_token + key = @jsmith.atom_key assert_equal 40, key.length @jsmith.reload - assert_equal key, @jsmith.rss_key + assert_equal key, @jsmith.atom_key end - def test_rss_key_should_not_be_generated_twice + def test_atom_key_should_not_be_generated_twice assert_difference 'Token.count', 1 do - key1 = @jsmith.rss_key - key2 = @jsmith.rss_key + key1 = @jsmith.atom_key + key2 = @jsmith.atom_key assert_equal key1, key2 end end -- 2.39.5