Skip to content

Commit

Permalink
Whee! Now we really do only send pings on publication.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.typosphere.org/typo/trunk@1053 820eb932-12ee-0310-9ca8-eeb645f39767
  • Loading branch information
pdcawley committed May 13, 2006
1 parent 8ae981a commit e68e570
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
18 changes: 8 additions & 10 deletions app/models/article.rb
Expand Up @@ -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
Expand All @@ -53,22 +52,21 @@ 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.
end
end
end

def send_pings
state.send_pings(self)
end

def next
Article.find(:first, :conditions => ['published_at > ?', published_at],
:order => 'published_at asc')
Expand Down
4 changes: 4 additions & 0 deletions app/models/content_state/base.rb
Expand Up @@ -42,6 +42,10 @@ def post_trigger(content)
def send_notifications(content)
true
end

def send_pings(content)
true
end
end
end

4 changes: 4 additions & 0 deletions app/models/content_state/just_published.rb
Expand Up @@ -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

0 comments on commit e68e570

Please sign in to comment.