Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
95019fa6
Commit
95019fa6
authored
Aug 12, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2318827
by larowlan, thehong | mgifford: Fixed Can't unpublish a comment.
parent
36675eaa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
core/modules/comment/src/CommentForm.php
core/modules/comment/src/CommentForm.php
+1
-1
core/modules/comment/src/CommentInterface.php
core/modules/comment/src/CommentInterface.php
+8
-0
core/modules/comment/src/Entity/Comment.php
core/modules/comment/src/Entity/Comment.php
+7
-0
core/modules/comment/src/Tests/CommentAdminTest.php
core/modules/comment/src/Tests/CommentAdminTest.php
+2
-0
No files found.
core/modules/comment/src/CommentForm.php
View file @
95019fa6
...
...
@@ -114,7 +114,7 @@ public function form(array $form, FormStateInterface $form_state) {
// Prepare default values for form elements.
if
(
$is_admin
)
{
$author
=
$comment
->
getAuthorName
();
$status
=
$comment
->
isPublished
();
$status
=
$comment
->
getStatus
();
if
(
empty
(
$form_state
[
'comment_preview'
]))
{
$form
[
'#title'
]
=
$this
->
t
(
'Edit comment %title'
,
array
(
'%title'
=>
$comment
->
getSubject
(),
...
...
core/modules/comment/src/CommentInterface.php
View file @
95019fa6
...
...
@@ -212,6 +212,14 @@ public function getChangedTime();
*/
public
function
isPublished
();
/**
* Returns the comment's status.
*
* @return int
* One of CommentInterface::PUBLISHED or CommentInterface::NOT_PUBLISHED
*/
public
function
getStatus
();
/**
* Sets the published status of the comment entity.
*
...
...
core/modules/comment/src/Entity/Comment.php
View file @
95019fa6
...
...
@@ -471,6 +471,13 @@ public function isPublished() {
return
$this
->
get
(
'status'
)
->
value
==
CommentInterface
::
PUBLISHED
;
}
/**
* {@inheritdoc}
*/
public
function
getStatus
()
{
return
$this
->
get
(
'status'
)
->
value
;
}
/**
* {@inheritdoc}
*/
...
...
core/modules/comment/src/Tests/CommentAdminTest.php
View file @
95019fa6
...
...
@@ -136,6 +136,8 @@ function testApprovalNodeInterface() {
$this
->
assertResponse
(
403
,
'Forged comment approval was denied.'
);
$this
->
drupalGet
(
'comment/1/approve'
,
array
(
'query'
=>
array
(
'token'
=>
'forged'
)));
$this
->
assertResponse
(
403
,
'Forged comment approval was denied.'
);
$this
->
drupalGet
(
'comment/1/edit'
);
$this
->
assertFieldChecked
(
'edit-status-0'
);
$this
->
drupalGet
(
'node/'
.
$this
->
node
->
id
());
$this
->
clickLink
(
t
(
'Approve'
));
$this
->
drupalLogout
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment