diff --git a/app/models/article.rb b/app/models/article.rb index 4d8550b1ba..eaeb059408 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -37,14 +37,13 @@ def html_urls urls end - def send_pings(serverurl = blog.server_url, articleurl = location(nil, false), urllist = []) + def really_send_pings(serverurl = blog.server_url, articleurl = location(nil, false)) return unless blog.send_outbound_pings weblogupdatesping_urls = blog.ping_urls.gsub(/ +/,'').split(/[\n\r]+/) - pingback_or_tracback_urls = self.html_urls - trackback_urls = urllist.to_a + pingback_or_trackback_urls = self.html_urls - ping_urls = weblogupdatesping_urls + pingback_or_tracback_urls + trackback_urls + ping_urls = weblogupdatesping_urls + pingback_or_trackback_urls ping_urls.uniq.each do |url| begin @@ -53,15 +52,10 @@ def send_pings(serverurl = blog.server_url, articleurl = location(nil, false), u if weblogupdatesping_urls.include?(url) ping.send_weblogupdatesping(serverurl, articleurl) - elsif pingback_or_tracback_urls.include?(url) + else pingback_or_trackback_urls.include?(url) ping.send_pingback_or_trackback(articleurl) - else - ping.send_trackback(articleurl) end - - ping.save end - rescue # in case the remote server doesn't respond or gives an error, # we should throw an xmlrpc error here. @@ -69,6 +63,10 @@ def send_pings(serverurl = blog.server_url, articleurl = location(nil, false), u end end + def send_pings + state.send_pings(self) + end + def next Article.find(:first, :conditions => ['published_at > ?', published_at], :order => 'published_at asc') diff --git a/app/models/content_state/base.rb b/app/models/content_state/base.rb index 64439b57cf..1da52c15a1 100644 --- a/app/models/content_state/base.rb +++ b/app/models/content_state/base.rb @@ -42,6 +42,10 @@ def post_trigger(content) def send_notifications(content) true end + + def send_pings(content) + true + end end end diff --git a/app/models/content_state/just_published.rb b/app/models/content_state/just_published.rb index d360586fd3..9552f40343 100644 --- a/app/models/content_state/just_published.rb +++ b/app/models/content_state/just_published.rb @@ -39,5 +39,9 @@ def send_notifications(content, controller) content.send_notification_to_user(controller, user) end end + + def send_pings(content) + content.really_send_pings + end end end