Fix bug.
This commit is contained in:
parent
9891568bb5
commit
a126481acb
|
@ -107,6 +107,7 @@ class Bulletin
|
|||
before_create :set_expire
|
||||
before_save :check_limit
|
||||
before_save do
|
||||
@is_hidden_changed = self.is_hidden_changed?
|
||||
if self.is_top_changed? && !self.is_top
|
||||
self.sort_number = nil
|
||||
end
|
||||
|
@ -431,6 +432,17 @@ class Bulletin
|
|||
related_feeds = BulletinFeed.any_of({:category_ids=>@category_id.to_s}, {:tag_ids.in=>@tag_ids.map(&:to_s)}).to_a
|
||||
end
|
||||
def notify_feed(type="create")
|
||||
if @is_hidden_changed
|
||||
if self.is_hidden
|
||||
if type == 'create'
|
||||
return []
|
||||
else
|
||||
type = 'destroy'
|
||||
end
|
||||
else
|
||||
type = 'create'
|
||||
end
|
||||
end
|
||||
related_feeds = self.get_related_feeds.select{|feed| feed.remote_urls.count != 0}
|
||||
if related_feeds.count != 0
|
||||
bulletin_data = self.get_data
|
||||
|
|
Loading…
Reference in New Issue