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-02-14 03:39 am

[dw-free] change how links are formatted in comments made by OpenID users

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

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

Do not strip links from comments by trusted OpenID users. Also, warn when
comments are going to have links stripped.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/LJ/S2/EntryPage.pm
  • cgi-bin/LJ/S2/ReplyPage.pm
  • cgi-bin/LJ/Talk.pm
  • cgi-bin/weblib.pl
  • htdocs/talkpost.bml.text
  • htdocs/talkread.bml
--------------------------------------------------------------------------------
diff -r 1da32e20a5ee -r 666dca7810f8 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Sat Feb 13 01:40:19 2010 +0000
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Sun Feb 14 03:39:46 2010 +0000
@@ -146,8 +146,9 @@ sub EntryPage
                 # quote all non-LJ tags
                 $text =~ s{<(?!/?lj)(.*?)>} {&lt;$1&gt;}gi;
             }
+
             LJ::CleanHTML::clean_comment(\$text, { 'preformatted' => $com->{'props'}->{'opt_preformatted'},
-                                                   'anon_comment' => (!$pu || $pu->is_identity),
+                                                   'anon_comment' => !$pu || ( $pu->is_identity && !$u->trusts_or_has_member( $pu ) ),
                                                });
 
             # local time in mysql format to gmtime
diff -r 1da32e20a5ee -r 666dca7810f8 cgi-bin/LJ/S2/ReplyPage.pm
--- a/cgi-bin/LJ/S2/ReplyPage.pm	Sat Feb 13 01:40:19 2010 +0000
+++ b/cgi-bin/LJ/S2/ReplyPage.pm	Sun Feb 14 03:39:46 2010 +0000
@@ -182,7 +182,7 @@ sub ReplyPage
         LJ::CleanHTML::clean_comment(\$parpost->{'body'},
                                      {
                                          'preformatted' => $parpost->{'props'}->{'opt_preformatted'},
-                                         'anon_comment' => !$parpost->{posterid} || $pu->is_identity,
+                                         'anon_comment' => !$parpost->{posterid} || ( $pu->is_identity && !$u->trusts_or_has_member( $pu ) ),
                                      });
 
 
diff -r 1da32e20a5ee -r 666dca7810f8 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Sat Feb 13 01:40:19 2010 +0000
+++ b/cgi-bin/LJ/Talk.pm	Sun Feb 14 03:39:46 2010 +0000
@@ -1860,6 +1860,9 @@ LOGIN
     if ($journalu->opt_logcommentips eq "S") {
         $ret .= "<br />$BML::ML{'.loganonip'}";
         $ret .= LJ::help_icon_html("iplogging", " ");
+    }
+    if ( !$remote || ( $remote && $remote->is_identity && !$journalu->trusts_or_has_member( $remote ) ) ) {
+        $ret .= "<br />$BML::ML{'.linkstripped'}";
     }
 
     $ret .= LJ::html_hidden( editid => $editid );
diff -r 1da32e20a5ee -r 666dca7810f8 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Sat Feb 13 01:40:19 2010 +0000
+++ b/cgi-bin/weblib.pl	Sun Feb 14 03:39:46 2010 +0000
@@ -831,6 +831,10 @@ QQ
         $qrhtml .= '<br />';
         $qrhtml .= LJ::deemp(BML::ml('/talkpost.bml.logyourip'));
         $qrhtml .= LJ::help_icon_html("iplogging", " ");
+    }
+    if ( !$remote || ( $remote && $remote->is_identity && !$u->trusts_or_has_member( $remote ) ) ) {
+        $qrhtml .= '<br />';
+        $qrhtml .= LJ::deemp( BML::ml( '/talkpost.bml.linkstripped' ) );
     }
 
     $qrhtml .= "</td></tr></table>";
diff -r 1da32e20a5ee -r 666dca7810f8 htdocs/talkpost.bml.text
--- a/htdocs/talkpost.bml.text	Sat Feb 13 01:40:19 2010 +0000
+++ b/htdocs/talkpost.bml.text	Sun Feb 14 03:39:46 2010 +0000
@@ -36,6 +36,8 @@
 .noedithtml=No HTML allowed in reason for edit
 
 .nosubjecthtml=No HTML allowed in subject
+
+.linkstripped=Links will be displayed as unclickable URLs to help prevent spam.
 
 .opt.anonymous=Anonymous
 
diff -r 1da32e20a5ee -r 666dca7810f8 htdocs/talkread.bml
--- a/htdocs/talkread.bml	Sat Feb 13 01:40:19 2010 +0000
+++ b/htdocs/talkread.bml	Sun Feb 14 03:39:46 2010 +0000
@@ -676,7 +676,7 @@ body<=
                 $ret .= "</td></tr><tr><td class='commentbody usercontent'>";
 
                 LJ::CleanHTML::clean_comment(\$post->{'body'}, { 'preformatted' => $post->{'props'}->{'opt_preformatted'},
-                                                                 'anon_comment' => ( !$pu || $pu->is_identity ),
+                                                                 'anon_comment' => !$pu || ( $pu->is_identity && !$u->trusts_or_has_member( $pu ) ),
                                                              });
                 BML::ebml(\$post->{'body'});
                 my $event = $post->{'body'};
--------------------------------------------------------------------------------