vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[ljcom] r9618: LJSUP-7147: do not add twitter-digest po...

Committer: vsukhanov
LJSUP-7147: do not add twitter-digest post if there is no new tweets.
U   trunk/cgi-bin/LJ/TwitterDigest.pm
Modified: trunk/cgi-bin/LJ/TwitterDigest.pm
===================================================================
--- trunk/cgi-bin/LJ/TwitterDigest.pm	2010-10-13 09:38:02 UTC (rev 9617)
+++ trunk/cgi-bin/LJ/TwitterDigest.pm	2010-10-14 05:02:55 UTC (rev 9618)
@@ -232,12 +232,14 @@
     LJ::set_remote($u);
 
     my $tweets = LJ::Client::Twitter->user_last_tweets($u);
+    return unless @$tweets;
 
     my @tweets_filtered =
         sort { $a->post_time <=> $b->post_time }
         grep { $_->post_time > time - 86400 }
         @$tweets;
-
+    return unless @tweets_filtered;
+    
     my @tweets_display;
     foreach my $tw (@tweets_filtered) {
         my $dt = DateTime->from_epoch( 
@@ -259,10 +261,12 @@
             'text' => $text,
         };
     }
+    return unless @tweets_display;
 
     my @tweets_under_cut = @tweets_display;
     @tweets_display =
         splice @tweets_under_cut, 0, $LJ::TWITTER_DIGEST_CUT_AFTER;
+    return unless @tweets_display;
 
     my @tweets_chunks;
     while (@tweets_under_cut) {

Tags: ljcom, pm, vadvs
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments