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
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'
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?
: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)
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
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
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
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
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
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
: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
@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
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
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
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)
: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
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
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
</span>
<% 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 %>
</table>
<% 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) %>
<% 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 %>
<% 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 %>
<% 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 %>
<%= 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 %>
<% 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 %>
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
<h4><%= l(:label_feeds_access_key) %></h4>
<p>
-<% 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 %>)
</p>
<% if Setting.rest_api_enabled? %>
<% 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 %>
<span class="pagination"><%= pagination_links_full @news_pages %></span>
<% 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 %>
<% 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 %>
<% 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)) -%>
<%= 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)) -%>
: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 %>
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
<% 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 %>
<% 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 %>
<%= 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 %>
</div>
<% 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 %>
<% 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'}) %>
<% 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 %>
<%= 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'}) %>
<%= 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 %>
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
:index,
:params => {
:format => 'atom',
- :key => user.rss_key
+ :key => user.atom_key
}
)
@fields.each_with_index do |field, i|
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
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
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'
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