Opened 14 months ago

Last modified 9 months ago

#20262 new defect (bug)

When "Automatically close comments on articles older than X days" is enabled, comments appear closed on draft posts

Reported by: evarlese Owned by:
Priority: normal Milestone: Awaiting Review
Component: Comments Version: 3.3
Severity: normal Keywords: has-patch dev-feedback
Cc: evarlese@…

Description

If the setting to "Automatically close comments on articles older than X days" is enabled via Settings -> Discussion, comments automatically appear as closed on draft posts until the post is published. This is regardless of the Discussion settings configured on the Post Edit page for the draft post.

To replicate:

  1. Via Settings -> Discussion, click on "Automatically close comments on articles older than X days."
  1. Create a new post and save it as a draft. Make sure comments are enabled in your Discussion module.
  1. When previewing the draft post, it will say "Comments closed" regardless of the Discussion settings.

The post will show comments as being allowed once it's published, they only show up as closed when in the draft format.

Attachments (1)

20262.diff (908 bytes) - added by solarissmoke 14 months ago.
Only close comments on published posts

Download all attachments as: .zip

Change History (4)

Only close comments on published posts

  • Component changed from General to Comments
  • Keywords has-patch added

This is being caused by _close_comments_for_old_posts(), which uses post_date_gmt to work out when the post was published. But for drafts this is always set to 0, so the post always appears to be older than the max age threshold.

I'm thinking that the filter should only apply to published posts... see patch.

  • Keywords dev-feedback added

... although you can't comment on drafts anyway, so maybe we should never be displaying a comment form on draft previews?

This does not seem like it would be a problem to me since no one can comment on a draft anyway. I guess if you leave a draft for months before you publish it, it could cause problems but I would hope you would update the post date in this case.

Note: See TracTickets for help on using tickets.