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-12-15 02:17 am

[dw-free] Respect lj-cut in the Inbox, as a user-defined parameter

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

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

Fix official post email notifications.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/Event/OfficialPost.pm
--------------------------------------------------------------------------------
diff -r 6d2c703db6a0 -r 48cd12e3c55f cgi-bin/LJ/Event/OfficialPost.pm
--- a/cgi-bin/LJ/Event/OfficialPost.pm	Tue Dec 15 02:16:33 2009 +0000
+++ b/cgi-bin/LJ/Event/OfficialPost.pm	Tue Dec 15 02:17:04 2009 +0000
@@ -18,11 +18,16 @@ sub entry {
 }
 
 sub content {
-    my ( $self, $target ) = @_;
-    return $self->entry->event_html( {
-            # double negatives, ouch!
-            ljcut_disable => ! $target->cut_inbox,
-            cuturl => $self->entry->url } );
+    my ( $self, $target, %opts ) = @_;
+    # force uncut for certain views (e-mail)
+    my $args = $opts{full} 
+            ? {} 
+            : { # double negatives, ouch!
+                ljcut_disable => ! $target->cut_inbox,
+                cuturl => $self->entry->url 
+              };
+
+    return $self->entry->event_html( $args );
 }
 
 sub content_summary {
@@ -78,14 +83,14 @@ sub as_email_html {
 
     return sprintf "%s<br />
 <br />
-%s", $self->as_html($u), $self->content;
+%s", $self->as_html($u), $self->content( $u, full => 1 );
 }
 
 sub as_email_string {
     my $self = shift;
     my $u = shift;
 
-    my $text = $self->content;
+    my $text = $self->content( $u, full => 1 );
     $text =~ s/\n+/ /g;
     $text =~ s/\s*<\s*br\s*\/?>\s*/\n/g;
     $text = LJ::strip_html($text);
--------------------------------------------------------------------------------