116

I realized something curious recently: that the AJAX backend feature that lets moderators view deleted comments also works for any users with the "access to moderator tools" privilege (10k+ rep on graduated sites, 4k+ on beta sites). There's no official user interface to it (that I know of), but it only takes a couple of lines of jQuery to write one.

My question to the SE folks is, is this a bug or a feature?

According to this old answer, only ♦ mods can view deleted comments. However, that answer was originally written back in 2009, before anyone could view deleted comments, and was updated in 2012 when the ability was added to the moderator interface, so I'm not sure if it can be taken as a 100% reliable and up-to-date statement that this is precisely the way it should be.

If this ability is an unintentional security loophole, I hope it will be fixed quickly. If it's an intentional (but undocumented) feature, I have a nice little user script I can post to make it a bit more accessible. ;-)


Ps. Some notes about the script:

  • Yes, it shows both mod-deleted and self-deleted comments.

  • It does require the "access to moderator tools" privilege; otherwise the AJAX call will just fail. For example, it doesn't work for me here on MSO, since I don't have 10k here yet.

  • It does not appear to be possible for non-mods to undelete comments, not even those they've posted and deleted themselves.

  • The main limitation is that, in order to view deleted comments on a post, you first have to guess that there might be some. (Technically, the script could try to automatically load deleted comments for every viewed post in the background, but that would be incredibly obnoxious and bandwidth-wasting behavior.)

Pps. Just to show that it works, here's a screenshot from the comments to the highest-voted question on SO, showing a couple of mod-deleted comments (with non-deleted replies) and one self-deleted one:

Screenshot of deleted comments on SO
(Actual text of the deleted comments pixelated, just in case.)

Personally, based on the limited testing I've done, I've found the script quite useful in making sense of long comment threads that may include partially deleted conversations, like the one shown above. That said, while I'd be sad to see this ability removed, I can certainly live without it, if it turns out to be an unintentional loophole.

17
  • 12
    Good find! Personally I'd rather not people be able to see deleted comments (just because they are second-class citizens -- I'm ok with everyone seeing deleted posts in their profile).
    – George Stocker Mod
    Commented Mar 12, 2014 at 17:56
  • 10
    Ooh I'd love to see 'em. Maybe hide by default, but if I can see deleted answers then I should have an option to see deleted comments, too. Commented Mar 12, 2014 at 17:58
  • 24
    Yeah, given that there's a lot of offensive content or personal information in deleted comments, I'd prefer for those not to be widely viewable by general users. We didn't clean up a lot of that more thoroughly because we thought that it wouldn't be visible to anyone after deletion, and we now have no way to search or go back through these. Almost all of the comments we've deleted were removed for a good reason.
    – Brad Larson Mod
    Commented Mar 12, 2014 at 17:59
  • 3
    @BradLarson I wouldn't care about offensive content when it occurs in posts it's generally just edited out/the post is soft deleted, without hard deleting the revisions. Private information is the only thing I'd worry about, but I doubt it's that common. Commented Mar 12, 2014 at 18:03
  • 29
    @Brad You're right, there's no good reason to see the offensive and off topic deleted comments, but god do I want to Commented Mar 12, 2014 at 18:03
  • 3
    @BradLarson: FWIW, based on my brief foray into deleted-comments-land, 90% of the time the "good reason" appears to be simple irrelevance, with 9% apparently having been deleted due to a more or less incivil tone. I don't doubt that the remaining 1% might include a few pieces of truly nasty / personal content, though, even if I haven't really stumbled across any so far. (Also, obviously, what I've seen is biased by the selection of posts I've tried the feature on, i.e. mostly those where there's discussion that has some obvious gaps in it.) Commented Mar 12, 2014 at 18:05
  • 2
    @IlmariKaronen: Yet one day someone will recreate your script and put it up on StackApps.com, and then someone will find some personal details in comments that would have been nuked from the post revisions had this been in a post and not in a comment. Commented Mar 12, 2014 at 18:09
  • So what about "Comments are second-class citizens and those are not expected to be permanent."? Did anyone think that rm -rf / is easy?
    – devnull
    Commented Mar 12, 2014 at 18:20
  • @Mysticial Is there an interface that allows you to search comments based on the # of votes?
    – devnull
    Commented Mar 12, 2014 at 18:25
  • @devnull The Data Explorer. But only for non-deleted comments.
    – Mysticial
    Commented Mar 12, 2014 at 18:26
  • 7
    @Mysticial: Yes, you did. I doesn't seem to have been a particularly interesting comment, though, except for the remarkable vote count. (And yes, it was on exactly the answer I guessed it would be on.) Commented Mar 12, 2014 at 18:30
  • 1
    I can't replicate this, can you show me how?
    – Kermit
    Commented Mar 12, 2014 at 18:35
  • 13
    @FreshPrinceOfSO: I deliberately left out the details until I heard back from the SE staff about whether this is an exploit or just an undocumented feature. If it's the former, I'll wait until it's fixed before posting the code. It's not actually complicated at all, but finding the right "magic word" to use does require some source-diving. Commented Mar 12, 2014 at 18:36
  • 1
    @IlmariKaronen Ah. I guess that brings some closure to the fate of that comment. I'm not strongly against the deletion of it, since it's clearly meta. But I was still sad to see it go...
    – Mysticial
    Commented Mar 12, 2014 at 18:38
  • 2
    @blahdiblah: Here you go. Commented Mar 14, 2014 at 21:19

2 Answers 2

48

Not anymore. This option has been locked down to moderators only.

I've found the script quite useful in making sense of long comment threads that may include partially deleted conversations, like the one shown above.

Yeah, that is useful - and that's why it was implemented, so that moderators could sort through these messes when necessary. There's a good argument to be made that 10k users should be able to get this information for the same reason...

...However, we don't have (and don't plan to implement) the additional tooling necessary for this to actually be productive. Moderators can wipe entire comment threads and restore inadvertently-deleted comments when need-be, but making those tools more widely available was something we tried in the past with... Bad results. To make this work smoothly, the system would need to be enhanced to make comment deletion more obvious and less confusing - things we've researched in the past and found entirely too expensive for what are intended to be temporary notes.

And the hard truth is, there's a lot of bad stuff lurking in deleted comments. Stuff that, quite frankly, no one needs to see. Showing it to moderators upon request is a necessary evil; showing it to anyone else isn't doing anyone any favors.

Related: Let us view our deleted comments

10
  • 4
    I strongly suspect anyone who routinely has to dig into that content can testify it is all but fun. Commented Mar 12, 2014 at 19:15
  • 16
    Well... If your idea of fun is being reminded daily of the depths of human depravity, then... perhaps, @Frédéric.
    – Shog9
    Commented Mar 12, 2014 at 19:16
  • This answer appears to conflate viewing deleted comments with managing deleted comments, unless I'm missing something? Commented Mar 12, 2014 at 19:33
  • 2
    The only reason this route exists is for managing comments, @Lightness - deleted and remaining. It's useful beyond that for purely informational purposes, but still the intent is that the information will be useful when it comes to cleaning up the rest of the comments / making sense of a post's history when there's a dispute / etc.
    – Shog9
    Commented Mar 12, 2014 at 19:42
  • 2
    I was the one that posted the feature request to enable moderators to see deleted comments. My primary motive was that I wanted to easily counter users that misrepresented deleted comments when they complained about the deletion. We moderators sometimes also take action based on removed content, that is the second important purpose. Anything else is pure curiosity, and while that is certainly sufficient individual motive, it is not really useful. Commented Mar 12, 2014 at 19:57
  • 5
    If your idea of fun is being reminded daily of the depths of human depravity -- You have to go to YouTube to find those kinds of comments, and they aren't even moderated to any significant degree, as far as I can tell.
    – user102937
    Commented Mar 12, 2014 at 21:12
  • 1
    @Shog9: One might say the same about deleted answers. Why, then do we have viewership rights on them over 10k? Ah, that's right, it's because "you are the site"! This is not site where, other than for extreme measures like suspensions, a social heirarchy exists. At least not beyond rep points. It never was. Commented Mar 13, 2014 at 1:29
  • Behold, the ever more elaborate rules, tools and behaviors associated with deleted posts, @Lightness. Philosophically, there's no reason why the same sort of system shouldn't exist for comments, offering folks the ability to view, salvage, moderate, etc... Or at least, offering them the chance to earn that ability. But practically-speaking... Why? What do we - me, you - get in return for that investment?
    – Shog9
    Commented Mar 13, 2014 at 1:40
  • 1
    @Shog9: Honestly, I can't answer that in a way that will satisfy you. It's a deep desire without strong practical justification. I just... want it! For fun! :) I wouldn't propose the entire system be implemented for comments; they are second-class citizens so the ability to salvage them is probably overkill. But I would still love to at least be able to see them, out of historical curiosity if nothing else. I'm a hoarder, and it's hard to let go. Commented Mar 13, 2014 at 12:29
  • (Sorry about my drunk comment 11 hours ago) Commented Mar 13, 2014 at 12:33
32

OK, looks like the hole has been plugged, so let me reveal how it worked.

It really was pretty simple: just take the normal AJAX URL used to load "N more comments", e.g.

and append the magic parameter ?includeDeleted=true, like this:

Conveniently, the StackExchange.comments.loadAll() function in full.en.js, used to load and display the comments, even takes an optional parameter to append to the URL just for this purpose.

Anyway, here's the full user script I wrote:

// ==UserScript==
// @name        Stack Exchange: view deleted comments
// @namespace   http://vyznev.net
// @description Kluge to let 10k+ non-moderators view deleted comments on Stack Exchange
// @include     *://*stackexchange.com/questions/*
// @include     *://*stackoverflow.com/questions/*
// @include     *://*superuser.com/questions/*
// @include     *://*serverfault.com/questions/*
// @include     *://*stackapps.com/questions/*
// @include     *://*mathoverflow.net/questions/*
// @include     *://*askubuntu.com/questions/*
// @version     1.0
// @grant       none
// ==/UserScript==

var className = 'userscript-load-deleted-comments';
var style = '<style type="text/css">.' + className + ' { color: #888; padding: 0px 3px 2px 15px }</style>';
var html = '<a class="' + className + '" href="#">load deleted comments</a>';

var rep = $('.topbar .reputation').text().replace(/[^0-9]+/g, '');
var beta = /(^|\/)beta(meta)?\//.test( $('.container').css('background-image') );

if ( +rep >= ( beta ? 2000 : 10000 ) ) { 
    $(style).appendTo(document.head);

    $(html).insertAfter('.comments-link').click( function (e) {
        var post = $(this).closest('#question, .question, .answer');
        StackExchange.comments.loadAll( post, '?includeDeleted=true' ).done( function () {
            post.find('.undelete-comment').hide();  // not implemented
        } );
        $(this).hide();
        e.preventDefault();
    } ).length;
}

I believe it should still work, if you happen to be a ♦ moderator. If not, the "load deleted comments" link it injects now just acts as a redundant duplicate of the "add/show N more comments" link next to it.

3
  • 5
    Ps. In case you're wondering how I figured this out, see loadAllComments() in moderator.en.js, which contains the JS code for both the moderator dashboard and the 10k tools page. Commented Mar 14, 2014 at 22:00
  • I don't see any difference when I compare the content of the two links provided...
    – draks ...
    Commented Sep 17, 2014 at 5:54
  • 1
    @draks: Yes, the "bug" was fixed, so there's no difference any more unless you're a moderator on that site. Commented Sep 17, 2014 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .