app/models/content.rb in typo-5.4.4 vs app/models/content.rb in typo-5.5

- old
+ new

@@ -54,20 +54,23 @@ serialize :whiteboard attr_accessor :just_changed_published_status alias_method :just_changed_published_status?, :just_changed_published_status + after_save :invalidates_cache? + after_destroy lambda { |c| c.invalidates_cache?(true) } + include Stateful @@content_fields = Hash.new @@html_map = Hash.new def invalidates_cache?(on_destruction = false) - if on_destruction + @invalidates_cache ||= if on_destruction just_changed_published_status? || published? else - changed? && published? || just_changed_published_status? + (changed? && published?) || just_changed_published_status? end end class << self # FIXME: Quite a bit of this isn't needed anymore. @@ -166,11 +169,11 @@ list_function = [] if search_hash.nil? search_hash = {} end - if search_hash[:searchstring] + if search_hash[:searchstring] list_function << 'searchstring(search_hash[:searchstring])' unless search_hash[:searchstring].to_s.empty? end if search_hash[:published_at] and %r{(\d\d\d\d)-(\d\d)} =~ search_hash[:published_at] list_function << 'published_at_like(search_hash[:published_at])' @@ -178,15 +181,15 @@ if search_hash[:user_id] && search_hash[:user_id].to_i > 0 list_function << 'user_id(search_hash[:user_id])' end - if search_hash[:published] + if search_hash[:published] list_function << 'published' if search_hash[:published].to_s == '1' list_function << 'not_published' if search_hash[:published].to_s == '0' end - + list_function end end def content_fields @@ -326,9 +329,11 @@ def rss_comments(xml) end def rss_description(xml) post = html(blog.show_extended_on_rss ? :all : :body) + post = "<p>This article is password protected. Please <a href='#{permalink_url}'>fill in your password</a> to read it</p>" unless self.class.name == 'Article' and (self.password.nil? or self.password.empty?) + if blog.rss_description if respond_to?(:user) && self.user && self.user.name rss_desc = "<hr /><p><small>#{_('Original article writen by')} #{self.user.name} #{_('and published on')} <a href='#{blog.base_url}'>#{blog.blog_name}</a> | <a href='#{self.permalink_url}'>#{_('direct link to this article')}</a> | #{_('If you are reading this article elsewhere than')} <a href='#{blog.base_url}'>#{blog.blog_name}</a>, #{_('it has been illegally reproduced and without proper authorization')}.</small></p>" else rss_desc = ""