diff -u b/core/modules/media_entity/media_entity.tokens.inc b/core/modules/media_entity/media_entity.tokens.inc --- b/core/modules/media_entity/media_entity.tokens.inc +++ b/core/modules/media_entity/media_entity.tokens.inc @@ -141,7 +141,7 @@ // Default values for the chained tokens handled below. case 'author': /** @var \Drupal\user\UserInterface $account */ - $account = $media->getPublisher(); + $account = $media->getOwner(); $bubbleable_metadata->addCacheableDependency($account); $replacements[$original] = $account->label(); break; diff -u b/core/modules/media_entity/src/Entity/Media.php b/core/modules/media_entity/src/Entity/Media.php --- b/core/modules/media_entity/src/Entity/Media.php +++ b/core/modules/media_entity/src/Entity/Media.php @@ -109,7 +109,7 @@ * {@inheritdoc} */ public function getOwner() { - $this->get('uid')->entity; + return $this->get('uid')->entity; } /** @@ -124,7 +124,7 @@ * {@inheritdoc} */ public function getOwnerId() { - $this->get('uid')->target_id; + return $this->get('uid')->target_id; } /** diff -u b/core/modules/media_entity/src/MediaAccessController.php b/core/modules/media_entity/src/MediaAccessController.php --- b/core/modules/media_entity/src/MediaAccessController.php +++ b/core/modules/media_entity/src/MediaAccessController.php @@ -23,7 +23,7 @@ $is_owner = ($account->id() && $account->id() == $entity->getPublisherId()) ? TRUE : FALSE; switch ($operation) { case 'view': - return AccessResult::allowedIf($account->hasPermission('view media') && $entity->status->value); + return AccessResult::allowedIf($account->hasPermission('view media') && $entity->status->value)->cachePerPermissions()->addCacheableDependency($entity); case 'update': return AccessResult::allowedIf(($account->hasPermission('update media') && $is_owner) || $account->hasPermission('update any media'))->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity); diff -u b/core/modules/media_entity/src/MediaForm.php b/core/modules/media_entity/src/MediaForm.php --- b/core/modules/media_entity/src/MediaForm.php +++ b/core/modules/media_entity/src/MediaForm.php @@ -33,7 +33,7 @@ // Set up default values, if required. if (!$this->entity->isNew()) { $this->entity->setRevisionLogMessage(NULL); - $this->entity->setPublisherId($this->currentUser()->id()); + $this->entity->setOwnerId($this->currentUser()->id()); $this->entity->setCreatedTime(\Drupal::time()->getRequestTime()); } } diff -u b/core/modules/media_entity/tests/src/FunctionalJavascript/MediaViewsWizardTest.php b/core/modules/media_entity/tests/src/FunctionalJavascript/MediaViewsWizardTest.php --- b/core/modules/media_entity/tests/src/FunctionalJavascript/MediaViewsWizardTest.php +++ b/core/modules/media_entity/tests/src/FunctionalJavascript/MediaViewsWizardTest.php @@ -25,7 +25,7 @@ $view_id = strtolower($this->randomMachineName(16)); $this->drupalGet('admin/structure/views/add'); $page->fillField('label', $view_id); - $session->wait(2000); + $this->waitUntilVisible('.machine-name-value'); $page->selectFieldOption('show[wizard_key]', 'media'); $assert_session->assertWaitOnAjaxRequest(); $page->checkField('page[create]'); @@ -59,7 +59,7 @@ $view_id = strtolower($this->randomMachineName(16)); $this->drupalGet('admin/structure/views/add'); $page->fillField('label', $view_id); - $session->wait(2000); + $this->waitUntilVisible('.machine-name-value'); $page->selectFieldOption('show[wizard_key]', 'media_revision'); $assert_session->assertWaitOnAjaxRequest(); $page->checkField('page[create]');