Feature #609

Send pings in more places but only if published

Added by sit-amsterdam-lcs-mit-edu - 1063 days ago. Updated 341 days ago.

Status :New Start :
Priority :Normal Due date :
Assigned to :neuro - % Done :

0%

Category :sidebars
Target version :Maybe Someday
Resolution :


Description

Pings should only be sent if the article is published.

Index: models/article.rb
===================================================================
--- models/article.rb   (revision 722)
+++ models/article.rb   (working copy)
@@ -34,7 +34,7 @@
   end

   def send_pings(articleurl, urllist)
-    return unless config[:send_outbound_pings]
+    return unless config[:send_outbound_pings] and self.published?

     ping_urls = config[:ping_urls].gsub(/ +/,_).split(/[\n\r]+/)
     ping_urls += self.html_urls

Also, there are perhaps some places where pings should be sent but might not have been, including when posting through the blogger API.

Index: controllers/admin/content_controller.rb
===================================================================
--- controllers/admin/content_controller.rb     (revision 722)
+++ controllers/admin/content_controller.rb     (working copy)
@@ -61,6 +61,7 @@
       end unless params[:attachments].nil?

       if @article.save 
+        @article.send_pings(article_url(@article),[])
         flash[:notice] = 'Article was successfully updated.'
         redirect_to :action => 'show', :id => @article.id
       end
Index: apis/blogger_service.rb
===================================================================
--- apis/blogger_service.rb     (revision 722)
+++ apis/blogger_service.rb     (working copy)
@@ -88,6 +88,7 @@
       end
     end

+    article.send_pings(article_url(article),[])
     article.save
     article.id
   end
===================================================================
--- movable_type_service.rb     (revision 722)
+++ movable_type_service.rb     (working copy)
@@ -137,6 +137,7 @@
   def publishPost(postid, username, password)
     article = Article.find(postid)
     article.published = 1
+    article.send_pings(article_url(article), [])
     article.save    
   end

A possibility might be to hook sending pings into before_save or after_save but there are cases when that wouldn't be necessary (e.g. when receiving a trackback, deleting a category).

History

03/03/2006 02:52 AM - scott -

  • Status changed from New to Assigned

03/13/2006 09:49 AM - kevin -

Through the blogger api? Most weblog clients like to ping blogs themselves - in general, I expect my client to send pings, not my blog. If I'm posting via my blog's admin interface I would treat that like a "client" so it should send pings in that case.

12/21/2007 10:10 AM - neuro -

  • Status changed from Assigned to New

Also available in: Atom PDF