fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-02-04 11:40 am

[dw-free] Add ability to subscribe to a particular user's posts to a community

[commit: http://hg.dwscoalition.org/dw-free/rev/2c754f90cdc7]

http://bugs.dwscoalition.org/show_bug.cgi?id=8

Add a notification for subscribing to a user's posts to a community. You can
get to it by clicking on "track this" under an entry by the desired user.

Patch by [personal profile] sophie.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/Event/JournalNewEntry.pm
  • htdocs/manage/tracking/entry.bml
--------------------------------------------------------------------------------
diff -r c1545996122e -r 2c754f90cdc7 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Sat Feb 04 17:55:23 2012 +0800
+++ b/bin/upgrading/en.dat	Sat Feb 04 19:42:13 2012 +0800
@@ -1600,6 +1600,8 @@
 
 event.journal_new_entry.friendlist=Someone I subscribe to posts a new entry
 
+event.journal_new_entry.poster=[[poster]] posts a new entry to [[user]]
+
 event.journal_new_entry.tag.community=Someone posts an entry tagged [[tags]] to [[user]]
 
 event.journal_new_entry.tag.user=[[user]] posts a new entry tagged [[tags]]
diff -r c1545996122e -r 2c754f90cdc7 cgi-bin/LJ/Event/JournalNewEntry.pm
--- a/cgi-bin/LJ/Event/JournalNewEntry.pm	Sat Feb 04 17:55:23 2012 +0800
+++ b/cgi-bin/LJ/Event/JournalNewEntry.pm	Sat Feb 04 19:42:13 2012 +0800
@@ -13,6 +13,7 @@
 
 # Event that is fired when there is a new post in a journal.
 # sarg1 = optional tag id to filter on
+# sarg2 = optional poster id to filter on (in a community)
 
 package LJ::Event::JournalNewEntry;
 use strict;
@@ -60,6 +61,13 @@
         }
     }
 
+    # filter by user?
+    my $suserid = $subscr->arg2;
+    my $su = LJ::load_userid ( $suserid );
+    if ( $su ) {
+        return 0 unless $subscr->journalid && $entry->poster->equals( $su );
+    }
+
     # all posts by friends
     return 1 if ! $subscr->journalid && $subscr->owner->watches( $self->event_journal );
 
@@ -396,6 +404,20 @@
                 });
     }
 
+    # are we filtering on a poster?
+    my $arg2 = $subscr->arg2;
+
+    if ( $arg2 ) {
+        my $postu = LJ::load_userid( $arg2 );
+        if ( $postu ) {
+            return BML::ml( 'event.journal_new_entry.poster',
+                    {
+                        user    => $journal->ljuser_display,
+                        poster  => $postu->ljuser_display,
+                    } );
+        }
+    }
+
     return BML::ml('event.journal_new_entry.friendlist') unless $journal;
 
     return BML::ml('event.journal_new_entry.' . ($journal->is_comm ? 'community' : 'user'),
diff -r c1545996122e -r 2c754f90cdc7 htdocs/manage/tracking/entry.bml
--- a/htdocs/manage/tracking/entry.bml	Sat Feb 04 17:55:23 2012 +0800
+++ b/htdocs/manage/tracking/entry.bml	Sat Feb 04 19:42:13 2012 +0800
@@ -88,7 +88,17 @@
             journal => $journal,
             entry   => $entry,
             flags   => LJ::Subscription::TRACKING,
-        ),
+        );
+
+    push @{ @$categories[0]->{$cat_title} },
+        LJ::Subscription::Pending->new( $remote,
+            event   => "JournalNewEntry",
+            arg2    => $entry->posterid,
+            journal => $journal,
+            flags   => LJ::Subscription::TRACKING,
+        ) if $journal->is_community;
+
+    push @{ @$categories[0]->{$cat_title} },
         LJ::Subscription::Pending->new( $remote,
             event   => "JournalNewEntry",
             journal => $journal,
--------------------------------------------------------------------------------
ninetydegrees: Art: self-portrait (badass)

[personal profile] ninetydegrees 2012-02-04 12:13 pm (UTC)(link)
#8! Wow! And the feature is awesome too!
allen: extras (extras)

[personal profile] allen 2012-02-04 03:13 pm (UTC)(link)
Woo!
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2012-02-04 04:21 pm (UTC)(link)
Yep! And it's the last one-digit bug that hadn't yet been resolved. :D
jb_slasher: enter shikari; common dreads (some boys are singing)

[personal profile] jb_slasher 2012-02-07 09:50 am (UTC)(link)
So cool that I was trying it out already, only to realize that it's not live yet. Oops. :D
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2012-03-26 09:29 am (UTC)(link)
So I was looking at this feature just now and realised that the user tag at the beginning prevents you from clicking on the rest of the line to select it - you have to click the checkbox specifically. (The same thing happens for "Someone comments in [comm], on any entry." - you can click the "Someone comments in" part, but not the "on any entry" part.)

I'm trying to think of a good way to get around this as it seems like an accessibility issue, but the issue is that the <label> tag is deliberately cut off before the link so that clicking the link doesn't activate the checkbox, which makes sense. In Firefox, it looks like having multiple <label> tags would work, but I'm not sure if it works in other browsers.

Do you think it's worth me opening a bug for this?
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2012-03-26 04:34 pm (UTC)(link)
Hmmm. Yeah, worth opening a bug to re-open the label tag to help in FF at least.