added rss/atom feeds at project levels for:
* news * new issues reported * details of issue changes issue cutom queries can be used as feeds git-svn-id: http://redmine.rubyforge.org/svn/trunk@339 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
|
||||
class Journal < ActiveRecord::Base
|
||||
belongs_to :journalized, :polymorphic => true
|
||||
# added as a quick fix to allow eager loading of the polymorphic association
|
||||
# since always associated to an issue, for now
|
||||
belongs_to :issue, :foreign_key => :journalized_id
|
||||
|
||||
belongs_to :user
|
||||
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
|
||||
end
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ class Token < ActiveRecord::Base
|
||||
|
||||
# Delete all expired tokens
|
||||
def self.destroy_expired
|
||||
Token.delete_all ["created_on < ?", Time.now - @@validity_time]
|
||||
Token.delete_all ["action <> 'feeds' AND created_on < ?", Time.now - @@validity_time]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -22,6 +22,7 @@ class User < ActiveRecord::Base
|
||||
has_many :projects, :through => :memberships
|
||||
has_many :custom_values, :dependent => :delete_all, :as => :customized
|
||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||
has_one :rss_key, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'"
|
||||
belongs_to :auth_source
|
||||
|
||||
attr_accessor :password, :password_confirmation
|
||||
@@ -133,6 +134,15 @@ class User < ActiveRecord::Base
|
||||
def pref
|
||||
self.preference ||= UserPreference.new(:user => self)
|
||||
end
|
||||
|
||||
def get_or_create_rss_key
|
||||
self.rss_key || Token.create(:user => self, :action => 'feeds')
|
||||
end
|
||||
|
||||
def self.find_by_rss_key(key)
|
||||
token = Token.find_by_value(key)
|
||||
token && token.user.active? ? token.user : nil
|
||||
end
|
||||
|
||||
private
|
||||
# Return password digest
|
||||
|
||||
Reference in New Issue
Block a user