Reply to Closed Topic thanks to Needs Approval and Keyboard Shortcuts

Okay, so this is a fun scenario, and took me a while to work out.

We had a Needs Approval post that was a reply to a topic that was closed in 2012! Colored with confusion, I’ve spent the last hour trying to figure out how to recreate it and I now have repo steps.

  1. Login as a new user, must be TL 0
  2. Navigate to a closed Topic
  3. Press SHIFT + R to open the composer to enter a reply
  4. Quickly paste a paragraph of text and press CTRL + Enter to submit your reply
  5. You will be told that your post is pending approval.

Expected:
You should be given the error “Something has gone wrong. Perhaps this topic was closed or deleted while you were looking at it?”

Actual:
Post ends up in the Needs Approval Queue where Moderators can’t approve it without re-opening the topic. So we have to Reject it (which removes all trace of the post) and unblock the user manually.

There is also a more convoluted way to do this too without the Keyboard Shortcut.

  1. Login as a new user, must be TL 0
  2. Navigate to a regular topic
  3. Use the search facility to navigate yourself to a closed topic (we’re building a browser history trail)
  4. Press ALT + to navigate back to the regular topic
  5. Click any of the Reply buttons and paste a paragraph of text
  6. Quick press ALT + to navigate to the closed topic and press CTRL + Enter to submit your reply
  7. You will be prompted to confirm which topic you want your reply to apply to, choose the “Current Topic” (aka, the closed topic)
  8. You will be told that your post is pending approval.

Edit
Ran both of these reproduction steps on my sandbox which is on latest.

10 Likes

We should fix this @eviltrout, some code path isn’t right here.

2 Likes

Really good catch! This fix prevents posts from being enqueued unless the user making them can actually post in that topic!

https://github.com/discourse/discourse/commit/e78b7a243eea344a17c34b1f8973a4d0bee59470

8 Likes