Forem Creators and Builders 🌱

Alex Smith for Forem Core Team

Posted on with Michael Tharrington

Changelog: Lock Discussions on Posts

Starting today, post authors and site admins have the ability to lock discussions on posts to prevent comments from being added.


This feature is designed for both user safety and to allow authors the ability to manage the conversations happening under their own post.

It's our hope that providing authors and admins the ability to lock discussions will help relieve instances where "piling on" occurs in the comments section — e.g. think of those times where you've seen someone criticize an author for X and then lots of other folks comment inline to agree with and restate the criticism. Criticism isn't inherently bad of course, but when criticism is particularly biting and lots of people are joining in to repeat it, it can be excessive and unnecessarily hurtful. It can often set a pretty terrible tone and misplace the focus. We think it's totally reasonable for an author to lock a discussion when this happens.

We also believe this feature will be helpful to authors who want to post something particularly sensitive and would prefer for there not to be a discussion on the topic at all. We can definitely empathize with this decision and want to give authors that option.

We understand that it's possible a user might try to wield this ability to shield themselves from criticism. It is definitely not our intention to give authors a free pass to write anything they please without reserve. If we discover a user is misusing this feature on DEV to release Conduct-breaking material, we will act accordingly to hold the user accountable.

We're excited for you all to use this feature and hope that you'll share your feedback in the comments below.

How it works

To lock a discussion on a post, navigate to the Manage section of one of your posts. There are 3 ways to get there after you sign in:

  1. Append /manage to the URL of your post.
  2. Visit your dashboard and click the Manage button next to the post you'd like to modify: dashboard_screenshot.
  3. Visit your post and click the Manage button: post_screenshot

Locking a discussion

Once you're on the Manage page, you'll see the standard actions with a new button added that says Lock discussion:

Clicking that button takes you to a confirmation page:

As noted on the confirmation page, users will not be able to add new comments when a discussion is locked, but locking a discussion does not remove existing comments.

When locking a discussion, you can provide additional context:

  • reason - this will be displayed publicly on the post once you lock the discussion (see below). This is optional.
  • notes - this is only visible by the post author and admins. It is not publicly visible. This is optional.

Clicking Lock discussion confirms it. When you navigate back to your post, you'll see the discussion is locked and the reason will display, if you added one:

Unlocking a discussion

You also have the ability to unlock a discussion. To do this, repeat the first few steps above to navigate to the Manage page.

For a post that has its discussion locked, you'll now see a button that says Unlock discussion:

You'll be taken to a confirmation page where you'll also see the reason and notes that you originally put on the discussion lock:

Click Unlock discussion and your audience is able to leave comments on your post again 🎉

How We Built It

Check out this PR to see how this feature was built:

Create DiscussionLocks #13905

What type of PR is this? (check all applicable)

  • [x] Feature


This PR introduces functionality to allow article authors, admins, and super admins to lock discussions which basically prevents the ability for users to add any further comments to an article. We've also added some logic to allow a permitted user to include a reason that will display publicly when a discussion is locked and notes which are only visible to users permitted to lock the discussion.

Related Tickets & Documents


QA Instructions, Screenshots, Recordings

  1. Pull down this code.
  2. Fire up the Rails server locally - bin/startup.
  3. Login.
  4. Write a post.
  5. Go to /manage on your published post.
  6. Click Lock discussion.
  7. Add a reason and notes.
  8. Lock the discussion.
  9. View your article - you should see the discussion is locked and you're unable to add a comment.
  10. Go back to /manage on your post.
  11. Unlock the discussion.
  12. Go back to your post and leave a comment.

Lock discussion lock_discussion

Confirm lock discussion lock_discussion_confirm

Lock discussion success success

Post with discussion locked (with reason) with_reason

Post with discussion locked (without reason) without_reason

Unlock discussion unlock_discussion

Confirm unlock discussion unlock_discussion_confirm

Error example error

Added tests?

  • [x] Yes

[Forem core team only] How will this change be communicated?

  • [x] I'm not sure how best to communicate this change and need help


Top comments (4)

rhymes profile image

Great job Alex!
Now you can lock this discussion :P

ellativity profile image
Ella (she/her/elle)

Thanks for this write-up @alex and @michaeltharrington ! As a Forem admin I'm happy to have another tool to make our Forems safer for our users 💛

ben profile image
Ben Halpern

This is such a well thought out feature. Tremendous work @alex .

maestromac profile image
Mac Siri

Awesome job @alex !!