Standardize behavior: if the journal the comment was posted in trusts
the OpenID user, then keep the links. Otherwise, treat the OpenID comment as an
anonymous one, and delinkify all existing links.
Patch by kareila.
diffs (94 lines):
diff -r 217e5f370e56 -r f34d507591d3 cgi-bin/LJ/Comment.pm
--- a/cgi-bin/LJ/Comment.pm Mon Jul 19 21:20:14 2010 -0700
+++ b/cgi-bin/LJ/Comment.pm Mon Jul 19 22:07:55 2010 -0700
@@ -862,7 +862,7 @@ sub body_html {
my $opts;
$opts->{preformatted} = $self->prop("opt_preformatted");
- $opts->{anon_comment} = $self->poster ? 0 : 1;
+ $opts->{anon_comment} = LJ::Talk::treat_as_anon( $self->poster,
$self->journal );
my $body = $self->body_raw;
LJ::CleanHTML::clean_comment(\$body, $opts) if $body;
diff -r 217e5f370e56 -r f34d507591d3 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm Mon Jul 19 21:20:14 2010 -0700
+++ b/cgi-bin/LJ/S2/EntryPage.pm Mon Jul 19 22:07:55 2010 -0700
@@ -136,9 +136,9 @@ sub EntryPage
my $dtalkid = $com->{'talkid'} * 256 + $entry->anum;
my $text = LJ::CleanHTML::quote_html( $com->{body}, $get->{nohtml}
);
- LJ::CleanHTML::clean_comment(\$text, { 'preformatted' =>
$com->{'props'}->{'opt_preformatted'},
- 'anon_comment' => !$pu || (
$pu->is_identity && !$u->trusts_or_has_member( $pu ) ),
- });
+ LJ::CleanHTML::clean_comment( \$text, { preformatted =>
$com->{props}->{opt_preformatted},
+ anon_comment =>
LJ::Talk::treat_as_anon( $pu, $u ),
+ } );
# local time in mysql format to gmtime
my $datetime = DateTime_unix($com->{'datepost_unix'});
diff -r 217e5f370e56 -r f34d507591d3 cgi-bin/LJ/S2/ReplyPage.pm
--- a/cgi-bin/LJ/S2/ReplyPage.pm Mon Jul 19 21:20:14 2010 -0700
+++ b/cgi-bin/LJ/S2/ReplyPage.pm Mon Jul 19 22:07:55 2010 -0700
@@ -189,8 +189,8 @@ sub ReplyPage
LJ::CleanHTML::clean_comment(\$parpost->{'body'},
{
- 'preformatted' =>
$parpost->{'props'}->{'opt_preformatted'},
- 'anon_comment' =>
!$parpost->{posterid} || ( $pu->is_identity && !$u->trusts_or_has_member( $pu )
),
+ preformatted =>
$parpost->{props}->{opt_preformatted},
+ anon_comment =>
LJ::Talk::treat_as_anon( $pu, $u ),
});
diff -r 217e5f370e56 -r f34d507591d3 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm Mon Jul 19 21:20:14 2010 -0700
+++ b/cgi-bin/LJ/Talk.pm Mon Jul 19 22:07:55 2010 -0700
@@ -2304,6 +2304,14 @@ sub comment_anchor {
return "#cmt$id";
}
+sub treat_as_anon {
+ my ( $pu, $u ) = @_;
+ return 1 unless LJ::isu( $pu ); # anonymous is not OK
+ return 0 unless $pu->is_identity; # OK unless OpenID
+ # if OpenID, not OK unless they're granted access
+ return LJ::isu( $u ) ? ! $u->trusts_or_has_member( $pu ) : 1;
+}
+
package LJ::Talk::Post;
use Text::Wrap;
diff -r 217e5f370e56 -r f34d507591d3 htdocs/talkread.bml
--- a/htdocs/talkread.bml Mon Jul 19 21:20:14 2010 -0700
+++ b/htdocs/talkread.bml Mon Jul 19 22:07:55 2010 -0700
@@ -611,9 +611,9 @@ 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 && !$u->trusts_or_has_member( $pu
) ),
- });
+ LJ::CleanHTML::clean_comment( \$post->{body}, { preformatted
=> $post->{'props'}->{'opt_preformatted'},
+ anon_comment
=> LJ::Talk::treat_as_anon( $pu, $u ),
+ } );
BML::ebml(\$post->{'body'});
my $event = LJ::CleanHTML::quote_html( $post->{body},
$GET{nohtml} );
my $edit_html = $edittime ? "<br /><br /><span
class='edittime'><em>" . BML::ml('.edittime', { editreason => $editreason,
edittime => $edittime }) . "</em></span>" : "";
diff -r 217e5f370e56 -r f34d507591d3 htdocs/tools/recent_comments.bml
--- a/htdocs/tools/recent_comments.bml Mon Jul 19 21:20:14 2010 -0700
+++ b/htdocs/tools/recent_comments.bml Mon Jul 19 22:07:55 2010 -0700
@@ -244,10 +244,10 @@ body<=
}
my $comment = $comment_text->{$r->{jtalkid}}[1];
- LJ::CleanHTML::clean_comment(\$comment, { 'preformatted' =>
$r->{'props'}->{'opt_preformatted'},
- 'anon_comment' =>
!LJ::isu($pu),
- 'nocss' => 1,
- });
+ LJ::CleanHTML::clean_comment( \$comment, { preformatted =>
$r->{props}->{opt_preformatted},
+ anon_comment =>
LJ::Talk::treat_as_anon( $pu, $u ),
+ nocss => 1,
+ } );
BML::ebml(\$comment);
$ret .= "$comment<br /><br />";
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog