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
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org