mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 17:56:03 +01:00
Deprecate and rename rss_* methods to atom_* methods (#15118).
Patch by Mischa The Evil and Marius BĂLTEANU git-svn-id: http://svn.redmine.org/redmine/trunk@21467 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
class ActivitiesController < ApplicationController
|
class ActivitiesController < ApplicationController
|
||||||
menu_item :activity
|
menu_item :activity
|
||||||
before_action :find_optional_project_by_id, :authorize_global
|
before_action :find_optional_project_by_id, :authorize_global
|
||||||
accept_rss_auth :index
|
accept_atom_auth :index
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@days = Setting.activity_days_default.to_i
|
@days = Setting.activity_days_default.to_i
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ApplicationController < ActionController::Base
|
|||||||
helper :avatars
|
helper :avatars
|
||||||
|
|
||||||
class_attribute :accept_api_auth_actions
|
class_attribute :accept_api_auth_actions
|
||||||
class_attribute :accept_rss_auth_actions
|
class_attribute :accept_atom_auth_actions
|
||||||
class_attribute :model_object
|
class_attribute :model_object
|
||||||
|
|
||||||
layout 'base'
|
layout 'base'
|
||||||
@@ -120,9 +120,9 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
elsif autologin_user = try_to_autologin
|
elsif autologin_user = try_to_autologin
|
||||||
user = autologin_user
|
user = autologin_user
|
||||||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_atom_auth?
|
||||||
# RSS key authentication does not start a session
|
# ATOM key authentication does not start a session
|
||||||
user = User.find_by_rss_key(params[:key])
|
user = User.find_by_atom_key(params[:key])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
||||||
@@ -624,16 +624,27 @@ class ApplicationController < ActionController::Base
|
|||||||
:content_type => 'application/atom+xml'
|
:content_type => 'application/atom+xml'
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.accept_rss_auth(*actions)
|
def self.accept_atom_auth(*actions)
|
||||||
if actions.any?
|
if actions.any?
|
||||||
self.accept_rss_auth_actions = actions
|
self.accept_atom_auth_actions = actions
|
||||||
else
|
else
|
||||||
self.accept_rss_auth_actions || []
|
self.accept_atom_auth_actions || []
|
||||||
end
|
end
|
||||||
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)
|
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
|
end
|
||||||
|
|
||||||
def self.accept_api_auth(*actions)
|
def self.accept_api_auth(*actions)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
class BoardsController < ApplicationController
|
class BoardsController < ApplicationController
|
||||||
default_search_scope :messages
|
default_search_scope :messages
|
||||||
before_action :find_project_by_project_id, :find_board_if_available, :authorize
|
before_action :find_project_by_project_id, :find_board_if_available, :authorize
|
||||||
accept_rss_auth :index, :show
|
accept_atom_auth :index, :show
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
include SortHelper
|
include SortHelper
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class IssuesController < ApplicationController
|
|||||||
before_action :authorize, :except => [:index, :new, :create]
|
before_action :authorize, :except => [:index, :new, :create]
|
||||||
before_action :find_optional_project, :only => [:index, :new, :create]
|
before_action :find_optional_project, :only => [:index, :new, :create]
|
||||||
before_action :build_new_issue_from_params, :only => [: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
|
accept_api_auth :index, :show, :create, :update, :destroy
|
||||||
|
|
||||||
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class JournalsController < ApplicationController
|
|||||||
before_action :find_issue, :only => [:new]
|
before_action :find_issue, :only => [:new]
|
||||||
before_action :find_optional_project, :only => [:index]
|
before_action :find_optional_project, :only => [:index]
|
||||||
before_action :authorize, :only => [:new, :edit, :update, :diff]
|
before_action :authorize, :only => [:new, :edit, :update, :diff]
|
||||||
accept_rss_auth :index
|
accept_atom_auth :index
|
||||||
menu_item :issues
|
menu_item :issues
|
||||||
|
|
||||||
helper :issues
|
helper :issues
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MyController < ApplicationController
|
|||||||
accept_api_auth :account
|
accept_api_auth :account
|
||||||
|
|
||||||
require_sudo_mode :account, only: :put
|
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 :issues
|
||||||
helper :users
|
helper :users
|
||||||
@@ -120,18 +120,24 @@ class MyController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Create a new feeds key
|
# Create a new feeds key
|
||||||
def reset_rss_key
|
def reset_atom_key
|
||||||
if request.post?
|
if request.post?
|
||||||
if User.current.rss_token
|
if User.current.atom_token
|
||||||
User.current.rss_token.destroy
|
User.current.atom_token.destroy
|
||||||
User.current.reload
|
User.current.reload
|
||||||
end
|
end
|
||||||
User.current.rss_key
|
User.current.atom_key
|
||||||
flash[:notice] = l(:notice_feeds_access_key_reseted)
|
flash[:notice] = l(:notice_feeds_access_key_reseted)
|
||||||
end
|
end
|
||||||
redirect_to my_account_path
|
redirect_to my_account_path
|
||||||
end
|
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
|
def show_api_key
|
||||||
@user = User.current
|
@user = User.current
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class NewsController < ApplicationController
|
|||||||
before_action :find_project_by_project_id, :only => :create
|
before_action :find_project_by_project_id, :only => :create
|
||||||
before_action :authorize, :except => [:index, :new]
|
before_action :authorize, :except => [:index, :new]
|
||||||
before_action :find_optional_project, :only => [: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
|
accept_api_auth :index, :show, :create, :update, :destroy
|
||||||
|
|
||||||
helper :watchers
|
helper :watchers
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
|
|||||||
:destroy]
|
:destroy]
|
||||||
before_action :authorize_global, :only => [:new, :create]
|
before_action :authorize_global, :only => [:new, :create]
|
||||||
before_action :require_admin, :only => [:copy, :archive, :unarchive]
|
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
|
accept_api_auth :index, :show, :create, :update, :destroy, :archive, :unarchive, :close, :reopen
|
||||||
require_sudo_mode :destroy
|
require_sudo_mode :destroy
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ class ProjectsController < ApplicationController
|
|||||||
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
|
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
@key = User.current.rss_key
|
@key = User.current.atom_key
|
||||||
end
|
end
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController
|
|||||||
before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
|
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 :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||||
before_action :authorize
|
before_action :authorize
|
||||||
accept_rss_auth :revisions
|
accept_atom_auth :revisions
|
||||||
accept_api_auth :add_related_issue, :remove_related_issue
|
accept_api_auth :add_related_issue, :remove_related_issue
|
||||||
|
|
||||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class TimelogController < ApplicationController
|
|||||||
before_action :find_optional_issue, :only => [:new, :create]
|
before_action :find_optional_issue, :only => [:new, :create]
|
||||||
before_action :find_optional_project, :only => [:index, :report]
|
before_action :find_optional_project, :only => [:index, :report]
|
||||||
|
|
||||||
accept_rss_auth :index
|
accept_atom_auth :index
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy
|
accept_api_auth :index, :show, :create, :update, :destroy
|
||||||
|
|
||||||
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class AnonymousUser < User
|
|||||||
def mail=(*args); nil end
|
def mail=(*args); nil end
|
||||||
def mail; nil end
|
def mail; nil end
|
||||||
def time_zone; nil end
|
def time_zone; nil end
|
||||||
def rss_key; nil end
|
def atom_key; nil end
|
||||||
|
|
||||||
def pref
|
def pref
|
||||||
UserPreference.new(:user => self)
|
UserPreference.new(:user => self)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class User < Principal
|
|||||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||||
has_many :changesets, :dependent => :nullify
|
has_many :changesets, :dependent => :nullify
|
||||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
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 :api_token, lambda {where "action='api'"}, :class_name => 'Token'
|
||||||
has_one :email_address, lambda {where :is_default => true}, :autosave => true
|
has_one :email_address, lambda {where :is_default => true}, :autosave => true
|
||||||
has_many :email_addresses, :dependent => :delete_all
|
has_many :email_addresses, :dependent => :delete_all
|
||||||
@@ -415,12 +415,18 @@ class User < Principal
|
|||||||
self.pref[:comments_sorting] == 'desc'
|
self.pref[:comments_sorting] == 'desc'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return user's RSS key (a 40 chars long string), used to access feeds
|
# Return user's ATOM key (a 40 chars long string), used to access feeds
|
||||||
def rss_key
|
def atom_key
|
||||||
if rss_token.nil?
|
if atom_token.nil?
|
||||||
create_rss_token(:action => 'feeds')
|
create_atom_token(:action => 'feeds')
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
# Return user's API key (a 40 chars long string), used to access the API
|
# Return user's API key (a 40 chars long string), used to access the API
|
||||||
@@ -530,10 +536,16 @@ class User < Principal
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_rss_key(key)
|
def self.find_by_atom_key(key)
|
||||||
Token.find_active_user('feeds', key)
|
Token.find_active_user('feeds', key)
|
||||||
end
|
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)
|
def self.find_by_api_key(key)
|
||||||
Token.find_active_user('api', key)
|
Token.find_active_user('api', key)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
|
|||||||
@@ -38,11 +38,11 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title l(:label_board_plural) %>
|
<% html_title l(:label_board_plural) %>
|
||||||
|
|||||||
@@ -58,10 +58,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title @board.name %>
|
<% html_title @board.name %>
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
|
||||||
<%= f.link_to_with_query_parameters 'PDF' %>
|
<%= f.link_to_with_query_parameters 'PDF' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -80,12 +80,12 @@
|
|||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom,
|
<%= auto_discovery_link_tag(:atom,
|
||||||
{:query_id => @query, :format => '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)) %>
|
:title => l(:label_issue_plural)) %>
|
||||||
<%= auto_discovery_link_tag(:atom,
|
<%= auto_discovery_link_tag(:atom,
|
||||||
{:controller => 'journals', :action => 'index',
|
{:controller => 'journals', :action => 'index',
|
||||||
:query_id => @query, :format => 'atom',
|
:query_id => @query, :format => 'atom',
|
||||||
:page => nil, :key => User.current.rss_key},
|
:page => nil, :key => User.current.atom_key},
|
||||||
:title => l(:label_changes_details)) %>
|
:title => l(:label_changes_details)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ end %>
|
|||||||
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
|
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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' %>
|
<%= f.link_to 'PDF' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ end %>
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<%= context_menu %>
|
<%= context_menu %>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xml.instruct!
|
xml.instruct!
|
||||||
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||||
xml.title @title
|
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.link "rel" => "alternate", "href" => home_url
|
||||||
xml.id home_url
|
xml.id home_url
|
||||||
xml.icon favicon_url
|
xml.icon favicon_url
|
||||||
|
|||||||
@@ -10,12 +10,12 @@
|
|||||||
<h4><%= l(:label_feeds_access_key) %></h4>
|
<h4><%= l(:label_feeds_access_key) %></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<% if @user.rss_token %>
|
<% if @user.atom_token %>
|
||||||
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
|
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.atom_token.created_on)) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= l(:label_missing_feeds_access_key) %>
|
<%= l(:label_missing_feeds_access_key) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
(<%= link_to l(:button_reset), my_rss_key_path, :method => :post %>)
|
(<%= link_to l(:button_reset), my_atom_key_path, :method => :post %>)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<% if Setting.rest_api_enabled? %>
|
<% if Setting.rest_api_enabled? %>
|
||||||
|
|||||||
@@ -36,6 +36,6 @@
|
|||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom,
|
<%= 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}) %>
|
{:title => query.name}) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -38,11 +38,11 @@
|
|||||||
<span class="pagination"><%= pagination_links_full @news_pages %></span>
|
<span class="pagination"><%= pagination_links_full @news_pages %></span>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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' %>
|
<%= stylesheet_link_tag 'scm' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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' %>
|
<% if @query.display_type == 'list' %>
|
||||||
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
|
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title(l(:label_overview)) -%>
|
<% html_title(l(:label_overview)) -%>
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
<%= stylesheet_link_tag "scm" %>
|
<%= stylesheet_link_tag "scm" %>
|
||||||
<%= auto_discovery_link_tag(
|
<%= auto_discovery_link_tag(
|
||||||
:atom,
|
: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') %>
|
:format => 'atom') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title(l(:label_revision_plural)) -%>
|
<% html_title(l(:label_revision_plural)) -%>
|
||||||
|
|||||||
@@ -45,14 +45,14 @@
|
|||||||
:atom,
|
:atom,
|
||||||
:action => 'revisions', :id => @project,
|
:action => 'revisions', :id => @project,
|
||||||
:repository_id => @repository.identifier_param,
|
:repository_id => @repository.identifier_param,
|
||||||
:key => User.current.rss_key) %>
|
:key => User.current.atom_key) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% other_formats_links do |f| %>
|
||||||
<%= f.link_to 'Atom',
|
<%= f.link_to 'Atom',
|
||||||
:url => {:action => 'revisions', :id => @project,
|
:url => {:action => 'revisions', :id => @project,
|
||||||
:repository_id => @repository.identifier_param,
|
:repository_id => @repository.identifier_param,
|
||||||
:key => User.current.rss_key} %>
|
:key => User.current.atom_key} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
|
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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;" %>
|
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
@@ -67,5 +67,5 @@
|
|||||||
<% html_title(@query.new_record? ? l(:label_spent_time) : @query.name, l(:label_details)) %>
|
<% html_title(@query.new_record? ? l(:label_spent_time) : @query.name, l(:label_details)) %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|||||||
@@ -122,11 +122,11 @@
|
|||||||
<%= render :partial => 'activities/activities', :locals => {:events_by_day => @events_by_day} %>
|
<%= render :partial => 'activities/activities', :locals => {:events_by_day => @events_by_day} %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= call_hook :view_account_right_bottom, :user => @user %>
|
<%= call_hook :view_account_right_bottom, :user => @user %>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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)}") %>
|
: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)}") %>
|
:title => "#{Setting.app_title}: #{l(:label_activity)}") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
<% unless @pages.empty? %>
|
<% unless @pages.empty? %>
|
||||||
<% other_formats_links do |f| %>
|
<% 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) %>
|
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||||
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
||||||
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
||||||
@@ -38,5 +38,5 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<%= f.link_to 'Atom',
|
<%= f.link_to 'Atom',
|
||||||
:url => {:controller => 'activities', :action => 'index',
|
:url => {:controller => 'activities', :action => 'index',
|
||||||
:id => @project, :show_wiki_edits => 1,
|
: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) %>
|
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||||
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
||||||
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
||||||
@@ -37,5 +37,5 @@
|
|||||||
<%= auto_discovery_link_tag(
|
<%= auto_discovery_link_tag(
|
||||||
:atom, :controller => 'activities', :action => 'index',
|
:atom, :controller => 'activities', :action => 'index',
|
||||||
:id => @project, :show_wiki_edits => 1, :format => 'atom',
|
:id => @project, :show_wiki_edits => 1, :format => 'atom',
|
||||||
:key => User.current.rss_key) %>
|
:key => User.current.atom_key) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Rails.application.routes.draw do
|
|||||||
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
|
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'
|
get 'my/api_key', :to => 'my#show_api_key', :as => 'my_api_key'
|
||||||
post 'my/api_key', :to => 'my#reset_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/password', :controller => 'my', :action => 'password', :via => [:get, :post]
|
||||||
match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
|
match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
|
||||||
match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
|
match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class JournalsControllerTest < Redmine::ControllerTest
|
|||||||
:index,
|
:index,
|
||||||
:params => {
|
:params => {
|
||||||
:format => 'atom',
|
:format => 'atom',
|
||||||
:key => user.rss_key
|
:key => user.atom_key
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@fields.each_with_index do |field, i|
|
@fields.each_with_index do |field, i|
|
||||||
|
|||||||
@@ -787,22 +787,22 @@ class MyControllerTest < Redmine::ControllerTest
|
|||||||
User.find(2).pref.my_page_layout)
|
User.find(2).pref.my_page_layout)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reset_rss_key_with_existing_key
|
def test_reset_atom_key_with_existing_key
|
||||||
@previous_token_value = User.find(2).rss_key # Will generate one if it's missing
|
@previous_token_value = User.find(2).atom_key # Will generate one if it's missing
|
||||||
post :reset_rss_key
|
post :reset_atom_key
|
||||||
|
|
||||||
assert_not_equal @previous_token_value, User.find(2).rss_key
|
assert_not_equal @previous_token_value, User.find(2).atom_key
|
||||||
assert User.find(2).rss_token
|
assert User.find(2).atom_token
|
||||||
assert_match /reset/, flash[:notice]
|
assert_match /reset/, flash[:notice]
|
||||||
assert_redirected_to '/my/account'
|
assert_redirected_to '/my/account'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reset_rss_key_without_existing_key
|
def test_reset_atom_key_without_existing_key
|
||||||
Token.delete_all
|
Token.delete_all
|
||||||
assert_nil User.find(2).rss_token
|
assert_nil User.find(2).atom_token
|
||||||
post :reset_rss_key
|
post :reset_atom_key
|
||||||
|
|
||||||
assert User.find(2).rss_token
|
assert User.find(2).atom_token
|
||||||
assert_match /reset/, flash[:notice]
|
assert_match /reset/, flash[:notice]
|
||||||
assert_redirected_to '/my/account'
|
assert_redirected_to '/my/account'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ class ApplicationTest < Redmine::IntegrationTest
|
|||||||
get '/issues/4.atom'
|
get '/issues/4.atom'
|
||||||
assert_response 302
|
assert_response 302
|
||||||
|
|
||||||
rss_key = User.find(2).rss_key
|
atom_key = User.find(2).atom_key
|
||||||
get "/issues/4.atom?key=#{rss_key}"
|
get "/issues/4.atom?key=#{atom_key}"
|
||||||
assert_response 200
|
assert_response 200
|
||||||
assert_nil session[:user_id]
|
assert_nil session[:user_id]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class RoutingMyTest < Redmine::RoutingTest
|
|||||||
|
|
||||||
should_route 'GET /my/api_key' => 'my#show_api_key'
|
should_route 'GET /my/api_key' => 'my#show_api_key'
|
||||||
should_route 'POST /my/api_key' => 'my#reset_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 'GET /my/password' => 'my#password'
|
||||||
should_route 'POST /my/password' => 'my#password'
|
should_route 'POST /my/password' => 'my#password'
|
||||||
|
|||||||
@@ -798,19 +798,19 @@ class UserTest < ActiveSupport::TestCase
|
|||||||
assert_equal 1, anon2.errors.count
|
assert_equal 1, anon2.errors.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rss_key
|
def test_atom_key
|
||||||
assert_nil @jsmith.rss_token
|
assert_nil @jsmith.atom_token
|
||||||
key = @jsmith.rss_key
|
key = @jsmith.atom_key
|
||||||
assert_equal 40, key.length
|
assert_equal 40, key.length
|
||||||
|
|
||||||
@jsmith.reload
|
@jsmith.reload
|
||||||
assert_equal key, @jsmith.rss_key
|
assert_equal key, @jsmith.atom_key
|
||||||
end
|
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
|
assert_difference 'Token.count', 1 do
|
||||||
key1 = @jsmith.rss_key
|
key1 = @jsmith.atom_key
|
||||||
key2 = @jsmith.rss_key
|
key2 = @jsmith.atom_key
|
||||||
assert_equal key1, key2
|
assert_equal key1, key2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user