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] changelog2010-01-05 10:38 pm

[dw-free] URLs in entry subject lines force subject lines to appear as text, not entry hyperlinks

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

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

Remove links in subjects in some views so users can still click through to
the entry.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/S2.pm
--------------------------------------------------------------------------------
diff -r fc55d1b97341 -r a287fe71fadf cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Tue Jan 05 01:49:23 2010 +0000
+++ b/cgi-bin/LJ/S2.pm	Tue Jan 05 22:38:23 2010 +0000
@@ -3553,12 +3553,15 @@ sub EntryLite__formatted_subject {
         }
     }
 
-    # if subject has a link and is not collapsed display raw subject
+
+    # display subject as-is (cleaned but not wrapped in a link)
+    # if subject has a link and we are on a full comment/single entry view and don't need to click through
     # TODO: how about other HTML tags?
-    if ( $subject =~ /href/ && $this->{full} ) {
+    if ( $subject =~ /href/ && ( $this->{full} || $LJ::S2::CURR_PAGE->{view} eq "reply" ||  $LJ::S2::CURR_PAGE->{view} eq "entry" ) ) {
         return $subject;
-
-    } else {
+    } else {
+        # we need to be able to click through this subject, so remove links
+        LJ::CleanHTML::clean( \$subject, { noexpandembedded => 1, mode => "allow", remove => [ "a" ] } );
         my $class = $attrs->{class} ? " class=\"" . LJ::ehtml( $attrs->{class} ) . "\" " : '';
         my $style = $attrs->{style} ? " style=\"" . LJ::ehtml( $attrs->{style} ) . "\" " : '';
 
--------------------------------------------------------------------------------
cesy: "Cesy" - An old-fashioned quill and ink (Default)

[personal profile] cesy 2010-01-06 07:24 am (UTC)(link)
Yay! This has been bugging me for ages.
turlough: The Girl (Grace Jeanette) yay!ing from car window, Art is the Weapon video, Sept 2010 ((mcr) yay!)

[personal profile] turlough 2010-01-06 02:24 pm (UTC)(link)
Yay!!!