#2869056: Automatically set revision user/log information/created time on entity revisions
#2869056: Automatically set revision user/log information/created time on entity revisions
4 open threads
4 open threads
Closes #2869056
Merge request reports
Activity
572 555 * {@inheritdoc} 573 556 */ 574 557 public static function getRequestTime() { 558 @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. No replacement provided. See https://www.drupal.org/node/3349765', E_USER_DEPRECATED); changed this line in version 2 of the diff
added 225 commits
-
9567faf0...0a58c45e - 222 commits from branch
project:11.x
- 2920becc - 2869056
- 9daecbee - Issue #2869056: Update core version.
- 491d4fc4 - Fixing failed test cases
Toggle commit list-
9567faf0...0a58c45e - 222 commits from branch
28 28 return $fields; 29 29 } 30 30 31 /** 32 * {@inheritdoc} 33 */ 34 public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) { 35 parent::preSaveRevision($storage, $record); 36 $entityType = $this->getEntityType(); 37 $revision_log_field_name = $entityType->getRevisionMetadataKey('revision_log_message'); 38 $revision_created_field_name = $entityType->getRevisionMetadataKey('revision_created'); added 1 commit
- eec9c90a - Test coverage for setting revision user on edit to the current user.
76 79 $this->assertSame('Unnamed', $media->getName(), 'The media item was not created with the correct name.'); 77 80 $source_field_name = $media->bundle->entity->getSource()->getSourceFieldDefinition($media->bundle->entity)->getName(); 78 81 $this->assertSame('Nation of sheep, ruled by wolves, owned by pigs.', $media->get($source_field_name)->value, 'Source returns incorrect source field value.'); 82 $this->assertSame($media->getOwnerId(), $media->getRevisionUserId(), 'The media item was not created with the correct revision author.'); 83 84 // Editing the media entity when logged in as a different user should update 85 // the revision user. 86 $new_user = $this->setUpCurrentUser(); 87 $media->setNewRevision(TRUE); 88 $media->setName('a new revision') 89 ->save(); 90 $this->assertSame($new_user->id(), $media->getRevisionUserId()); added 224 commits
Toggle commit list476 477 $this->validated = FALSE; 477 478 } 478 479 480 // If no revision author has been set explicitly, make the current user the 481 // revision author. 482 if ($this instanceof RevisionLogInterface && !$this->getRevisionUser()) { So the test failure is because the revision user is set at this point. I don't know the rationale for putting this logic here and not alongside the other stuff in EditorialContentEntityBase but I also tried moving this there and it has the same issue - the revision user from the previous revision is still set.
Haven't found where the revision_created field gets cleared on a new revision yet.
...and changing to current user has caused a mass amount of failures.
Maybe we should keep author? I'm unsure now.We can't keep it at author as that doesn't change from revision to revision.Edited by Adam Bramley
Please register or sign in to reply