If you view the history of a closed question you'll see a notice saying:

Post closed as "[close reason]" by [moderator name or user names of the voters].

  1. We know moderators can close any question immediately.
  2. We know a question remains open until it has 5 close votes.
  3. A close vote is saved in the postHistory table

How does the revisions page distinguish between:

  1. A question closed by a mod, that may have only one close vote row in the postHistory table
  2. A question that has 3 or 4 close vote entries, but is yet to be closed
  3. A question that has 5 close vote entries and is already closed

The postHistory table (in the data-dump), which is used in the revisions page, does not tell us if a post has been closed. It simply lists revisions, including those of type 10, or close votes.

So a post may or may not be closed. We don't know by just looking at the postHistory table.

How, then, does the revisions page determine whether to display the post closed as ... notice when looping over revisions?

  • 1
    Is this a question about using data.stackexchange.com? Or just about how the devs implemented something behind the scenes? Does that matter? – Matthew Read Aug 10 '11 at 18:35
  • It's about how devs implemented something behind the scenes. Gee, would I be asking if it didn't matter? It matters to me, which is enough. – Mohamad Aug 10 '11 at 19:08
  • 1
    @Mathew Read, and downvoter, can I point you to this in the FAQ: is your question about ... The core Stack Exchange engine that powers all Stack Exchange websites ... it's welcomed here – Mohamad Aug 10 '11 at 19:10
  • @Mohamad: Downvotes don't mean "this question is not welcome here". Can I point you to this in the FAQ? You have to read the whole thing, not just the part that you want to. – Cody Gray Aug 11 '11 at 13:05

I'm not sure I understand your question, so I'm sorry if this is off the mark.

The revision page just lists the names of people involved in closing the question. How many people were involved in the closing doesn't really matter, so I don't think there's a need to distinguish between any cases - if a post is closed, just print the names of people who cast close votes.

I believe the names are also listed in chronological order, so for example this revision history shows that I voted to close the question before I became a moderator and Walter was a moderator at the time and he cast his binding close vote. Now our roles are reversed, but my name still appears first in the list.

Determining whether a question is closed in the first place is likely a separate check to see if there are 5 close votes or a moderator vote. Or there might just be an 'IsClosed' field in the database that's set when a post is closed.

  • it's OK. Thank for responding. I'll clarify. The revisions view lists the revisions. The revisions will contain any revisions that are of type 10 (close votes). The revision alone does not tell us if the post is closed. It just tells us who voted. If it was a moderator, then the post is closed. If it was not, then the post could still be open. In other words, there is nothing in the postHistory table to say if the post has been closed or not. So how does the revisions view know this info when listing the post revisions and/or "post closed" notices? – Mohamad Aug 10 '11 at 18:08
  • I've re-worded the question part of my post to hopefully make it clearer. – Mohamad Aug 10 '11 at 18:12
  • Anna, the mystery is solved in case you were curious about the nature of my question. Seem my answer. Thanks again. – Mohamad Aug 10 '11 at 23:48

It took me some hours to figure this out, but after analysing the data-dump I found the answer:

A post is displayed as closed when there is an existing record in the postHistory table with a postHistoryTypeId of 10.

Voting to close a question does not create this history record. It gets created only when two things happen:

  1. A moderator closes a post.
  2. Five close votes accumulate.

I speculate that once either of those things happen, the close votes are rounded up and serialized, then saved to the postHistory table. The votes themselves are deleted.

My initial source of confusion was the false belief that a close vote creates a record in the history table. And if so, the view would need some elaborate mechanism to determine whether the post is on its way to being closed, or has already been closed.

You must log in to answer this question.

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