updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
@@ -18,6 +18,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Base handler for comment forms.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CommentForm extends ContentEntityForm {
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Base form handler for comment type edit forms.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CommentTypeForm extends EntityForm {
|
||||
|
||||
|
||||
@@ -279,9 +279,12 @@ class CommentController extends ControllerBase {
|
||||
// Check if the user has the proper permissions.
|
||||
$access = AccessResult::allowedIfHasPermission($account, 'post comments');
|
||||
|
||||
// If commenting is open on the entity.
|
||||
$status = $entity->{$field_name}->status;
|
||||
$access = $access->andIf(AccessResult::allowedIf($status == CommentItemInterface::OPEN)
|
||||
->addCacheableDependency($entity));
|
||||
->addCacheableDependency($entity))
|
||||
// And if user has access to the host entity.
|
||||
->andIf(AccessResult::allowedIf($entity->access('view')));
|
||||
|
||||
// $pid indicates that this is a reply to a comment.
|
||||
if ($pid) {
|
||||
|
||||
@@ -9,11 +9,13 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\user\PrivateTempStoreFactory;
|
||||
use Drupal\Core\TempStore\PrivateTempStoreFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides the comments overview administration form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CommentAdminOverview extends FormBase {
|
||||
|
||||
@@ -48,7 +50,7 @@ class CommentAdminOverview extends FormBase {
|
||||
/**
|
||||
* The tempstore factory.
|
||||
*
|
||||
* @var \Drupal\user\PrivateTempStoreFactory
|
||||
* @var \Drupal\Core\TempStore\PrivateTempStoreFactory
|
||||
*/
|
||||
protected $tempStoreFactory;
|
||||
|
||||
@@ -61,7 +63,7 @@ class CommentAdminOverview extends FormBase {
|
||||
* The date formatter service.
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
* The module handler.
|
||||
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
|
||||
* The tempstore factory.
|
||||
*/
|
||||
public function __construct(EntityTypeManagerInterface $entity_type_manager, DateFormatterInterface $date_formatter, ModuleHandlerInterface $module_handler, PrivateTempStoreFactory $temp_store_factory) {
|
||||
@@ -80,7 +82,7 @@ class CommentAdminOverview extends FormBase {
|
||||
$container->get('entity_type.manager'),
|
||||
$container->get('date.formatter'),
|
||||
$container->get('module_handler'),
|
||||
$container->get('user.private_tempstore')
|
||||
$container->get('tempstore.private')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a confirmation form for deleting a comment type entity.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CommentTypeDeleteForm extends EntityDeleteForm {
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Drupal\comment\Form;
|
||||
|
||||
use Drupal\comment\CommentStorageInterface;
|
||||
use Drupal\user\PrivateTempStoreFactory;
|
||||
use Drupal\Core\TempStore\PrivateTempStoreFactory;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
@@ -11,13 +11,15 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides the comment multiple delete confirmation form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ConfirmDeleteMultiple extends ConfirmFormBase {
|
||||
|
||||
/**
|
||||
* The tempstore factory.
|
||||
*
|
||||
* @var \Drupal\user\PrivateTempStoreFactory
|
||||
* @var \Drupal\Core\TempStore\PrivateTempStoreFactory
|
||||
*/
|
||||
protected $tempStoreFactory;
|
||||
|
||||
@@ -40,7 +42,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
|
||||
*
|
||||
* @param \Drupal\comment\CommentStorageInterface $comment_storage
|
||||
* The comment storage.
|
||||
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
|
||||
* The tempstore factory.
|
||||
*/
|
||||
public function __construct(CommentStorageInterface $comment_storage, PrivateTempStoreFactory $temp_store_factory) {
|
||||
@@ -54,7 +56,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('entity.manager')->getStorage('comment'),
|
||||
$container->get('user.private_tempstore')
|
||||
$container->get('tempstore.private')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
||||
/**
|
||||
* Provides the comment delete confirmation form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DeleteForm extends ContentEntityDeleteForm {
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Drupal\comment\Plugin\Action;
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\user\PrivateTempStoreFactory;
|
||||
use Drupal\Core\TempStore\PrivateTempStoreFactory;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
|
||||
/**
|
||||
* The tempstore object.
|
||||
*
|
||||
* @var \Drupal\user\PrivateTempStore
|
||||
* @var \Drupal\Core\TempStore\PrivateTempStore
|
||||
*/
|
||||
protected $tempStore;
|
||||
|
||||
@@ -43,7 +43,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
|
||||
* The plugin ID for the plugin instance.
|
||||
* @param array $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
|
||||
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
|
||||
* The tempstore factory.
|
||||
* @param \Drupal\Core\Session\AccountInterface $current_user
|
||||
* The current user.
|
||||
@@ -62,7 +62,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('user.private_tempstore'),
|
||||
$container->get('tempstore.private'),
|
||||
$container->get('current_user')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,37 +2,32 @@
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Action\Plugin\Action\PublishAction;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
|
||||
/**
|
||||
* Publishes a comment.
|
||||
*
|
||||
* @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Action\Plugin\Action\PublishAction instead.
|
||||
*
|
||||
* @see \Drupal\Core\Action\Plugin\Action\PublishAction
|
||||
* @see https://www.drupal.org/node/2919303
|
||||
*
|
||||
* @Action(
|
||||
* id = "comment_publish_action",
|
||||
* label = @Translation("Publish comment"),
|
||||
* type = "comment"
|
||||
* )
|
||||
*/
|
||||
class PublishComment extends ActionBase {
|
||||
class PublishComment extends PublishAction {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($comment = NULL) {
|
||||
$comment->setPublished(TRUE);
|
||||
$comment->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
|
||||
/** @var \Drupal\comment\CommentInterface $object */
|
||||
$result = $object->status->access('edit', $account, TRUE)
|
||||
->andIf($object->access('update', $account, TRUE));
|
||||
|
||||
return $return_as_object ? $result : $result->isAllowed();
|
||||
public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
|
||||
@trigger_error(__NAMESPACE__ . '\PublishComment is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\PublishAction instead. See https://www.drupal.org/node/2919303.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,33 +2,33 @@
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Component\Datetime\TimeInterface;
|
||||
use Drupal\Core\Action\Plugin\Action\SaveAction;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
|
||||
/**
|
||||
* Saves a comment.
|
||||
*
|
||||
* @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Action\Plugin\Action\SaveAction instead.
|
||||
*
|
||||
* @see \Drupal\Core\Action\Plugin\Action\SaveAction
|
||||
* @see https://www.drupal.org/node/2919303
|
||||
*
|
||||
* @Action(
|
||||
* id = "comment_save_action",
|
||||
* label = @Translation("Save comment"),
|
||||
* type = "comment"
|
||||
* )
|
||||
*/
|
||||
class SaveComment extends ActionBase {
|
||||
class SaveComment extends SaveAction {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($comment = NULL) {
|
||||
$comment->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
|
||||
/** @var \Drupal\comment\CommentInterface $object */
|
||||
return $object->access('update', $account, $return_as_object);
|
||||
public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, TimeInterface $time) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $time);
|
||||
@trigger_error(__NAMESPACE__ . '\SaveComment is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\SaveAction instead. See https://www.drupal.org/node/2919303.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,37 +2,32 @@
|
||||
|
||||
namespace Drupal\comment\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Action\Plugin\Action\UnpublishAction;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
|
||||
/**
|
||||
* Unpublishes a comment.
|
||||
*
|
||||
* @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
|
||||
* Use \Drupal\Core\Action\Plugin\Action\UnpublishAction instead.
|
||||
*
|
||||
* @see \Drupal\Core\Action\Plugin\Action\UnpublishAction
|
||||
* @see https://www.drupal.org/node/2919303
|
||||
*
|
||||
* @Action(
|
||||
* id = "comment_unpublish_action",
|
||||
* label = @Translation("Unpublish comment"),
|
||||
* type = "comment"
|
||||
* )
|
||||
*/
|
||||
class UnpublishComment extends ActionBase {
|
||||
class UnpublishComment extends UnpublishAction {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($comment = NULL) {
|
||||
$comment->setPublished(FALSE);
|
||||
$comment->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
|
||||
/** @var \Drupal\comment\CommentInterface $object */
|
||||
$result = $object->status->access('edit', $account, TRUE)
|
||||
->andIf($object->access('update', $account, TRUE));
|
||||
|
||||
return $return_as_object ? $result : $result->isAllowed();
|
||||
public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
|
||||
@trigger_error(__NAMESPACE__ . '\UnpublishComment is deprecated in Drupal 8.5.x, will be removed before Drupal 9.0.0. Use \Drupal\Core\Action\Plugin\Action\UnpublishAction instead. See https://www.drupal.org/node/2919303.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class CommentSelection extends DefaultSelection {
|
||||
|
||||
// Passing the query to node_query_node_access_alter() is sadly
|
||||
// insufficient for nodes.
|
||||
// @see SelectionEntityTypeNode::entityQueryAlter()
|
||||
// @see \Drupal\node\Plugin\EntityReferenceSelection\NodeSelection::buildEntityQuery()
|
||||
if (!$this->currentUser->hasPermission('bypass node access') && !count($this->moduleHandler->getImplementations('node_grants'))) {
|
||||
$query->condition($node_alias . '.status', 1);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Drupal\Core\Menu\LocalTaskDefault;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Provides a local task that shows the amount of unapproved comments.
|
||||
@@ -53,7 +54,7 @@ class UnapprovedComments extends LocalTaskDefault implements ContainerFactoryPlu
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTitle() {
|
||||
public function getTitle(Request $request = NULL) {
|
||||
return $this->t('Unapproved comments (@count)', ['@count' => $this->commentStorage->getUnapprovedCount()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Drupal\comment\Plugin\views\field;
|
||||
|
||||
use Drupal\system\Plugin\views\field\BulkForm;
|
||||
use Drupal\views\Plugin\views\field\BulkForm;
|
||||
|
||||
/**
|
||||
* Defines a comment operations bulk form element.
|
||||
|
||||
@@ -30,14 +30,6 @@ class Comment extends WizardPluginBase {
|
||||
* Set default values for the filters.
|
||||
*/
|
||||
protected $filters = [
|
||||
'status' => [
|
||||
'value' => TRUE,
|
||||
'table' => 'comment_field_data',
|
||||
'field' => 'status',
|
||||
'plugin_id' => 'boolean',
|
||||
'entity_type' => 'comment',
|
||||
'entity_field' => 'status',
|
||||
],
|
||||
'status_node' => [
|
||||
'value' => TRUE,
|
||||
'table' => 'node_field_data',
|
||||
|
||||
@@ -63,8 +63,8 @@ abstract class CommentTestBase extends ViewTestBase {
|
||||
*/
|
||||
protected $comment;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), ['comment_test_views']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user