Make s2 behave like the site scheme when you have deleted comments and 
comments from suspended users, by displaying "(deleted comment)" or "(reply 
from suspended user)" . Hide the poster name, the userpic, and the 
subject_icon, and unset the screened status, because deleted/suspended 
overrides that. Also hide the subject and text (these wouldn't have been loaded 
in the first place but good to explicitly state it).

        Unofficial styles may assume that the comments were from anonymous 
users, when they see no username.

        Patch by 900degrees. 

diffs (107 lines):

diff -r f6bcfe133fe2 -r 1ecf2cc492d5 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2   Fri Jun 11 17:48:52 2010 +0800
+++ b/bin/upgrading/s2layers/core2.s2   Fri Jun 11 19:48:57 2010 +0800
@@ -419,6 +419,7 @@ class Comment extends EntryLite
     var readonly bool screened "True if comment is in screened state.";
     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.";
     var readonly string anchor "Direct link to comment, via HTML name anchors";
     var readonly bool comment_posted "True if comment was just posted by the 
current user.";
     var readonly bool edited "True if the comment has been edited.";
@@ -2555,6 +2556,16 @@ property string text_screened {
    example = "(screened) ";
 }
 
+property string text_deleted {
+   des = "The text used when a comment has been deleted";
+   example = "(deleted comment)";
+}
+
+property string text_fromsuspended {
+   des = "The text used when the comment's author has been suspended";
+   example = "(reply from suspended user)";
+}
+
 property string text_frozen {
    des = "The text used when a comment is frozen";
    example = "(frozen) ";
@@ -2592,6 +2603,8 @@ property string text_website_default_nam
 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_deleted = "(deleted comment)";
+set text_fromsuspended = "(reply from suspended user)";
 set text_frozen = "(frozen) ";
 set text_poster_anonymous = "(Anonymous)";
 set text_openid_from = "from";
@@ -5292,12 +5305,16 @@ function EntryPage::print_comment (Comme
 
 function EntryPage::print_comment_partial (Comment c) {
     $c->print_wrapper_start();
-    var string poster = defined $c.poster ? $c.poster->as_string() : 
"<i>$*text_poster_anonymous</i>";
-    $c->print_subject();
-    print safe " - $poster";
-    var Link expand_link = $c->get_link("expand_comments");
-    if (defined $expand_link) {
-        " "; $c->print_expand_link();
+    if ($c.deleted) { print $*text_deleted; }
+    elseif ($c.fromsuspended) { print $*text_fromsuspended; }
+    else {
+        var string poster = defined $c.poster ? $c.poster->as_string() : 
"<i>$*text_poster_anonymous</i>";
+        $c->print_subject();
+        print safe " - $poster";
+        var Link expand_link = $c->get_link("expand_comments");
+        if (defined $expand_link) {
+            " "; $c->print_expand_link();
+        }
     }
     $c->print_wrapper_end();
 }
diff -r f6bcfe133fe2 -r 1ecf2cc492d5 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm        Fri Jun 11 17:48:52 2010 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm        Fri Jun 11 19:48:57 2010 +0800
@@ -1,3 +1,4 @@
+#!/usr/bin/perl
 #!/usr/bin/perl
 #
 # This code was forked from the LiveJournal project owned and operated
@@ -261,7 +262,8 @@ sub EntryPage
                 threadroot_url => $threadroot_url,
                 'screened' => $com->{'state'} eq "S" ? 1 : 0,
                 'frozen' => $com->{'state'} eq "F" ? 1 : 0,
-                'deleted' => $com->{'state'} eq "D" ? 1 : 0,
+                'deleted' => 0,
+                'fromsuspended' => 0,
                 'link_keyseq' => [ 'delete_comment' ],
                 'anchor' => LJ::Talk::comment_htmlid( $dtalkid ),
                 'dom_id' => LJ::Talk::comment_htmlid( $dtalkid ),
@@ -280,11 +282,26 @@ sub EntryPage
             # FIXME: ideally the load_comments should only return these
             # items if there are children, otherwise they should be hidden 
entirely
             if ($pu && $pu->is_suspended && !$viewsome) {
+                $s2com->{'fromsuspended'} = 1;
+                $s2com->{'full'} = 0;
+                $s2com->{'poster'} = undef;
+                $s2com->{'userpic'} = undef;
+                $s2com->{'subject'} = "";
+                $s2com->{'subject_icon'} = undef;
                 $s2com->{'text'} = "";
+                $s2com->{'screened'} = undef;
+            }
+
+            # don't show info for deleted comments
+            if ($com->{'state'} eq "D") {
+                $s2com->{'deleted'} = 1;
+                $s2com->{'full'} = 0;
+                $s2com->{'poster'} = undef;
+                $s2com->{'userpic'} = undef;
                 $s2com->{'subject'} = "";
-                $s2com->{'full'} = 0;
                 $s2com->{'subject_icon'} = undef;
-                $s2com->{'userpic'} = undef;
+                $s2com->{'text'} = "";
+                $s2com->{'screened'} = undef;
             }
 
             # 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