If a comment is screened, and you're not allowed to see the text, print 
out "(screened comment)".  Also add relevant classes to the CSS 
(.poster-hidden, for comments which are deleted/from suspended users/screened 
and with no ability to view the comment)

        Patch by 900degrees. 

diffs (81 lines):

diff -r e218801419bf -r f355fddd7005 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2   Thu Jun 17 17:02:24 2010 +0800
+++ b/bin/upgrading/s2layers/core2.s2   Thu Jun 17 17:37:49 2010 +0800
@@ -417,6 +417,7 @@ class Comment extends EntryLite
     var readonly string thread_url "URL to view threaded rooted at this 
comment, or blank if comment has no children.";
     var readonly string threadroot_url "URL to view the entire thread this 
comment is part of, or blank if a top-level comment.";
     var readonly bool screened "True if comment is in screened state.";
+    var readonly bool screened_noshow "True if comment is in screened state 
and user isn't allowed to see it.";
     var readonly bool frozen "True if comment is in frozen state.";
     var readonly bool deleted "True if comment has been deleted. Deleted 
comments still show up if they are the parent of a thread.";
     var readonly bool fromsuspended "True if comment's author has been 
suspended.";
@@ -2553,7 +2554,7 @@ set text_comment_edittime = "Edited";
 
 property string text_screened {
    des = "The text used when a comment is screened";
-   example = "(screened) ";
+   example = "(screened comment) ";
 }
 
 property string text_deleted {
@@ -2602,7 +2603,7 @@ property string text_reply_nocomments {
 
 property string text_website_default_name { noui = 1; des = "If an account's 
website is specified, but there's no website name, use this text instead"; }
 
-set text_screened = "(screened) ";
+set text_screened = "(screened comment) ";
 set text_deleted = "(deleted comment)";
 set text_fromsuspended = "(reply from suspended user)";
 set text_frozen = "(frozen) ";
@@ -4352,11 +4353,12 @@ function Comment::print_wrapper_start() 
 function Comment::print_wrapper_start() {
     var EntryPage ep = get_page() as EntryPage;
     var string alternate = alternate ("comment-wrapper-odd", 
"comment-wrapper-even");
-    var string screened = $this.screened ? "screened" : "visible";
+    var string screened = ($this.screened and not $this.fromsuspended) ? 
"screened" : "visible";
     var string deletedstate = $this.deleted ? "deleted" : "";
     var string suspendedstate = $this.fromsuspended ? "from-suspended" : "";
     var string frozen = $this.frozen ? "frozen" : "";
     var string poster = defined $this.poster ? "poster-" + 
$this.poster.username : "poster-anonymous";
+    if ($this.deleted or $this.fromsuspended or $this.screened_noshow) { 
$poster =  "poster-hidden"; }
     var string full = $this.full ? "full" : "partial";
     var string userpic = $this.userpic ? "has-userpic" : "no-userpic";
     var string entryauthor = "";
@@ -5308,6 +5310,7 @@ function EntryPage::print_comment_partia
     $c->print_wrapper_start();
     if ($c.deleted) { print $*text_deleted; }
     elseif ($c.fromsuspended) { print $*text_fromsuspended; }
+    elseif ($c.screened_noshow) { print $*text_screened; }
     else {
         var string poster = defined $c.poster ? $c.poster->as_string() : 
"<i>$*text_poster_anonymous</i>";
         $c->print_subject();
diff -r e218801419bf -r f355fddd7005 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm        Thu Jun 17 17:02:24 2010 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm        Thu Jun 17 17:37:49 2010 +0800
@@ -266,6 +266,7 @@ sub EntryPage
                 'parent_url' => $par_url,
                 threadroot_url => $threadroot_url,
                 'screened' => $com->{'state'} eq "S" ? 1 : 0,
+                'screened_noshow' => 0,
                 'frozen' => $com->{'state'} eq "F" ? 1 : 0,
                 'deleted' => 0,
                 'fromsuspended' => 0,
@@ -307,6 +308,18 @@ sub EntryPage
                 $s2com->{'subject_icon'} = undef;
                 $s2com->{'text'} = "";
                 $s2com->{'screened'} = undef;
+            }
+
+            # don't show info for screened comments if user can't see
+            if ($com->{'state'} eq "S" && !$com->{'_show'}) {
+                $s2com->{'screened'} = 1;
+                $s2com->{'screened_noshow'} = 1;
+                $s2com->{'full'} = 0;
+                $s2com->{'poster'} = undef;
+                $s2com->{'userpic'} = undef;
+                $s2com->{'subject'} = "";
+                $s2com->{'subject_icon'} = undef;
+                $s2com->{'text'} = "";
             }
 
             # Conditionally add more links to the keyseq
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to