janinedog: (Default)
Janine ([personal profile] janinedog) wrote in [site community profile] changelog2009-07-21 05:12 am

[dw-free] http://bugs.dwscoalition.org/show_bug.cgi?id=1435

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

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

Fix escaping issue and add alt text to userpics in sent PMs.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/Event/UserMessageRecvd.pm
  • cgi-bin/LJ/Event/UserMessageSent.pm
--------------------------------------------------------------------------------
diff -r 2683b3f8dcd2 -r 52abd8486b14 cgi-bin/LJ/Event/UserMessageRecvd.pm
--- a/cgi-bin/LJ/Event/UserMessageRecvd.pm	Mon Jul 20 16:10:26 2009 -0500
+++ b/cgi-bin/LJ/Event/UserMessageRecvd.pm	Tue Jul 21 05:11:37 2009 +0000
@@ -217,7 +217,7 @@ sub display_pic {
     my ( $userpic_src, $userpic_alt );
     if ( $pic ) {
         $userpic_src = $pic->url;
-        $userpic_alt = $pic->alttext;
+        $userpic_alt = LJ::ehtml( $pic->alttext( $msg->userpic ) );
     } else {
         $userpic_src = "$LJ::IMGPREFIX/nouserpic.png";
         $userpic_alt = "";
diff -r 2683b3f8dcd2 -r 52abd8486b14 cgi-bin/LJ/Event/UserMessageSent.pm
--- a/cgi-bin/LJ/Event/UserMessageSent.pm	Mon Jul 20 16:10:26 2009 -0500
+++ b/cgi-bin/LJ/Event/UserMessageSent.pm	Tue Jul 21 05:11:37 2009 +0000
@@ -115,10 +115,19 @@ sub display_pic {
         $pic = $u->userpic;
     }
 
+    # Get the image URL and the alternative text. Don't set
+    # alternative text if there isn't any userpic.
+    my ( $userpic_src, $userpic_alt );
+    if ( $pic ) {
+        $userpic_src = $pic->url;
+        $userpic_alt = LJ::ehtml( $pic->alttext( $msg->userpic ) );
+    } else {
+        $userpic_src = "$LJ::IMGPREFIX/nouserpic.png";
+        $userpic_alt = "";
+    }
+
     my $ret;
-    $ret .= '<img src="';
-    $ret .= $pic ? $pic->url : "$LJ::IMGPREFIX/nouserpic.png";
-    $ret .= '" width="50" align="top" />';
+    $ret .= '<img src="' . $userpic_src . '" alt="' .  $userpic_alt . '" width="50" align="top" />';
 
     return $ret;
 }
--------------------------------------------------------------------------------

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