Problem/Motivation
CommentForm uses $comment->isPublished() to get the default value for the status field on comment edit form.
But this isn't correct as the status fields are integers, not booleans.
Proposed resolution
Add ::getStatus method to CommentInterface and use that for the default value instead of isPublished.
Remaining tasks
Review
User interface changes
None
API changes
new method ::getStatus added to CommentInterface
Original report by @mgifford
In looking at #867830-118: "Unpublished" style of rendered entities is not accessible (and looks bad) I noticed that I couldn't unpublish a comment. The state just didn't stick.

Steps to reproduce.
1) Create a article page
2) Add a comment
3) Edit the comment
4) Expand on the Administration link
5) Click Unpublish
6) Save
7) Repeat the process, but stop at step 4 to see example above.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | comment-status-2318827.pass_.patch | 2.58 KB | larowlan |
| #6 | comment-status-2318827.fail_.patch | 765 bytes | larowlan |
| #4 | Screen Shot 2014-08-11 at 12.19.35 AM.png | 29.39 KB | mgifford |
| #2 | 2318827.diff | 738 bytes | thehong |
Comments
Comment #1
larowlanComment #2
thehong commentedComment #3
thehong commentedComment #4
mgifford@thehong - that fixes the problem. Including a screenshot from http://scee2738cdb9c0dc.s2.simplytest.me/comment/1/edit
Usually it should be labelled something like unpublish-comment-2318827-2.patch
But your .diff works fine. Thanks for the patch! Now we just need the tests (I think) till we can mark this RTBC.
Comment #5
larowlan/me working on tests
Comment #6
larowlanAdded a test.
Also added ::getStatus to CommentInterface.
Seems counter intuitive to use isPublished to convert status to a bool and then convert it back again.
Thanks @thehong!
Comment #7
larowlanComment #9
jibranThank you we have test fail which shows it is fixed so RTBC.
Comment #10
andypostI'd prefer do not introduce a new method without test coverage
$status = $comment->isPublished() ? CommentInterface::PUBLISHED : CommentInterface::NOT_PUBLISHEDshould work
Comment #11
larowlanWell, the regression test inherently tests the new method.
The reason I added a getStatus method is isPublished does this:
so if we use isPublished() we're effectively writing this:
Which I think is inefficient.
Happy to add a unit test for CommentInterface::getStatus if that helps
Comment #12
alexpottI'm not sure a unit test adds much value here. Committed 95019fa and pushed to 8.0.x. Thanks!
Fixed on commit.
Comment #14
mgiffordIn less than 72hrs.. Amazing!
Mostly tagging this so that it can be tracked as part of the sprint.