fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-11-21 09:06 am

[dw-free] Include entry subject line in Take a look at this Dreamwidth entry

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

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

"Take a look at this Dreamwidth entry" => "Take a look at this Dreamwidth
entry: subject goes here" if the entry has a subject.

Patch by [personal profile] fu.

Files modified:
  • htdocs/tools/tellafriend.bml
  • htdocs/tools/tellafriend.bml.text
--------------------------------------------------------------------------------
diff -r b53b65e17a12 -r f50a0695c16f htdocs/tools/tellafriend.bml
--- a/htdocs/tools/tellafriend.bml	Fri Nov 18 16:24:25 2011 +0800
+++ b/htdocs/tools/tellafriend.bml	Mon Nov 21 17:05:20 2011 +0800
@@ -153,8 +153,6 @@
      my $ditemid = $itemid;
      my $uj;
 
-     $subject = BML::ml( ".email.subject.entry", { sitenameshort => $LJ::SITENAMESHORT } );
-
      $itemid = int($itemid / 256);
 
      $uj = LJ::load_user($journal);
@@ -162,7 +160,7 @@
 
      my $entry = LJ::Entry->new($uj->{'userid'}, jitemid => $itemid);
 
-     my $subject = $entry->subject_text;
+     my $entry_subject = $entry->subject_text;
      my $pu = $entry->poster;
      my $url = $entry->url;
 
@@ -182,8 +180,13 @@
      }
 
      $msg .= BML::ml( ".email.body", { user => $u->{'user'}, sitenameshort => $LJ::SITENAMESHORT } );
-     $msg .= BML::ml( ".email.sharedentry.title" ) . " $subject\n" if $subject;
+     $msg .= BML::ml( ".email.sharedentry.title" ) . " $entry_subject\n" if $entry_subject;
      $msg .= BML::ml( ".email.sharedentry.url" ) . " $url ";
+
+     # email subject
+     $subject = $entry_subject
+            ? BML::ml( ".email.subject.entryhassubject", { sitenameshort => $LJ::SITENAMESHORT, subject => $entry_subject } )
+            : BML::ml( ".email.subject.entrynosubject", { sitenameshort => $LJ::SITENAMESHORT } );
  }
 
  if ($GET{'user'} =~ /^\w{1,15}$/) {
diff -r b53b65e17a12 -r f50a0695c16f htdocs/tools/tellafriend.bml.text
--- a/htdocs/tools/tellafriend.bml.text	Fri Nov 18 16:24:25 2011 +0800
+++ b/htdocs/tools/tellafriend.bml.text	Mon Nov 21 17:05:20 2011 +0800
@@ -42,7 +42,9 @@
 
 .email.sharedentry.url=URL:
 
-.email.subject.entry=Take a look at this [[sitenameshort]] entry
+.email.subject.entryhassubject=Take a look at this [[sitenameshort]] entry: [[subject]]
+
+.email.subject.entrynosubject=Take a look at this [[sitenameshort]] entry
 
 .email.subject.journal=Take a look at this journal
 
--------------------------------------------------------------------------------
katherine: Sleeping Canada sheep with a thought bubble Dreamwidth (canada)

[personal profile] katherine 2011-11-22 03:55 am (UTC)(link)
Thank you! I've been hoping for this one for ages and from discussion on my suggestion got the impression it was in a big tangle of code thing or depend on something else or... anyway, I got the impression wasn't possible anytime soon so yay surprise change!
Edited (grammar) 2011-11-22 03:56 (UTC)
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2011-11-22 03:57 am (UTC)(link)
Redoing the whole thing is not outside the realm of possibility, but we like to avoid the whole "perfect is the enemy of good" thing as much as possible; a little change should not have to wait for the big changes to get done :)