madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22583: LJSV-2372: Subscription to tagged entrie...

Committer: sbelyaev
LJSV-2372: Subscription to tagged entries incorrectly treat fast reposts
U   trunk/cgi-bin/LJ/Event/JournalNewRepost.pm
Modified: trunk/cgi-bin/LJ/Event/JournalNewRepost.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewRepost.pm	2012-08-07 10:44:16 UTC (rev 22582)
+++ trunk/cgi-bin/LJ/Event/JournalNewRepost.pm	2012-08-07 11:18:11 UTC (rev 22583)
@@ -111,6 +111,26 @@
     return 0 unless $entry && $entry->valid; # TODO: throw error?
     return 0 unless $entry->visible_to($subscr->owner);
 
+    my $or_entry = $entry->original_post;
+    if (!$or_entry || !$or_entry->valid) {
+        return;
+    }
+
+    #
+    # filtering by tags
+    #
+    my $stagid = $subscr->arg1;
+    if ($stagid) {
+        my $reposter_tags = LJ::Tags::get_usertags($entry->journal);
+
+        if ($reposter_tags) {
+            my $reposter_taginfo = $reposter_tags->{$stagid};
+            my $reposter_tag_name = $reposter_taginfo->{'name'} || '';
+
+            return 0 unless grep { $_ eq $reposter_tag_name } $or_entry->tags;
+        }
+    }
+
     # all posts by friends
     return 1 if ! $subscr->journalid && LJ::is_friend($subscr->owner, $self->event_journal);
 
@@ -411,6 +431,7 @@
         my $row = { userid      => $subsc->{'userid'},
                     journalid   => $subsc->{'journalid'},
                     ntypeid     => $subsc->{'ntypeid'},
+                    arg1        => $subsc->{'arg1'},
                   };
 
         push @subs, LJ::Subscription->new_from_row($row);

Tags: livejournal, madeon, pm, sbelyaev
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