mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-20 06:18 am

[dw-free] Configure "Dreamwidth sends me a new notification" notification

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

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

Add ability to send official post notifications.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/User.pm
  • cgi-bin/ljprotocol.pl
  • doc/config-private.pl.txt
--------------------------------------------------------------------------------
diff -r 1dc64b86a2dc -r ddc27e4eb1e3 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Thu Mar 19 16:34:25 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Fri Mar 20 06:18:47 2009 +0000
@@ -618,6 +618,10 @@ sub is_news {
     return $u->{journaltype} eq "N";
 }
 
+sub is_official {
+    my $u = shift;
+    return $LJ::OFFICIAL_JOURNALS{$u->username} ? 1 : 0;
+}
 
 sub is_person {
     my $u = shift;
diff -r 1dc64b86a2dc -r ddc27e4eb1e3 cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Thu Mar 19 16:34:25 2009 +0000
+++ b/cgi-bin/ljprotocol.pl	Fri Mar 20 06:18:47 2009 +0000
@@ -1550,6 +1550,7 @@ sub postevent
     unless ( $flags->{nonotify} ) {
         push @jobs, LJ::Event::JournalNewEntry->new($entry)->fire_job;
         push @jobs, LJ::Event::UserNewEntry->new($entry)->fire_job if (!$LJ::DISABLED{'esn-userevents'} || $LJ::_T_FIRE_USERNEWENTRY);
+        push @jobs, LJ::Event::OfficialPost->new($entry)->fire_job if $uowner->is_official;        
     }
     push @jobs, LJ::EventLogRecord::NewEntry->new($entry)->fire_job;
 
diff -r 1dc64b86a2dc -r ddc27e4eb1e3 doc/config-private.pl.txt
--- a/doc/config-private.pl.txt	Thu Mar 19 16:34:25 2009 +0000
+++ b/doc/config-private.pl.txt	Fri Mar 20 06:18:47 2009 +0000
@@ -27,6 +27,13 @@
     # not logged in, this username will be used instead. (You should own this
     # account so that nobody can take it.)
     $EXAMPLE_USER_ACCOUNT = "username";
+    
+    # list of official journals, as a list of "'username' => 1" pairs
+    # used to determine whether to fire off an OfficialPost notification
+    # when an entry is posted; hash instead of array for efficiency
+    %OFFICIAL_JOURNALS = (
+        news => 1,
+    );
 }
 
 {
--------------------------------------------------------------------------------
janinedog: (Default)

[personal profile] janinedog 2009-03-20 06:31 am (UTC)(link)
Isn't the official journal [site community profile] dw_news?

Oh nevermind, just noticed that's the .txt file. :)
Edited 2009-03-20 06:31 (UTC)