diff --git a/multiversion.module b/multiversion.module index 1eae983..0cfe4a7 100644 --- a/multiversion.module +++ b/multiversion.module @@ -83,8 +83,8 @@ function multiversion_entity_base_field_info(EntityTypeInterface $entity_type) { ->setReadOnly(TRUE) ->setSetting('unsigned', TRUE); - // @todo Make this not revisionable, currently it's not possible. - // @see https://www.drupal.org/node/2362433 + // @todo: {@link https://www.drupal.org/node/2362433 Make this not + // revisionable, currently it's not possible.} $fields['workspace'] = BaseFieldDefinition::create('workspace_reference') ->setLabel('Workspace reference') ->setDescription('The workspace this entity belongs to.') @@ -253,7 +253,8 @@ function multiversion_workspace_uri(WorkspaceInterface $entity) { */ function multiversion_form_node_type_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { // Users don't have the option to disable revisions when using Multiversion. - // @todo: See if there's a way to just disable this particular option. + // @todo: {@link https://www.drupal.org/node/2597393 See if there's a way + // to just disable this particular option.} unset($form['workflow']['options']['#options']['revision']); } diff --git a/multiversion.services.yml b/multiversion.services.yml index 3179954..e6b717a 100644 --- a/multiversion.services.yml +++ b/multiversion.services.yml @@ -29,7 +29,8 @@ services: tags: - { name: service_collector, tag: workspace_negotiator, call: addNegotiator } - # @todo Simplify the container definition for negotiators + # @todo: {@link https://www.drupal.org/node/2597414 Simplify the container + # definition for negotiators.} workspace.negotiator.default: class: Drupal\multiversion\Workspace\DefaultWorkspaceNegotiator calls: diff --git a/multiversion_ui/src/Routing/RouteSubscriber.php b/multiversion_ui/src/Routing/RouteSubscriber.php index 2e6eafa..a802f7e 100644 --- a/multiversion_ui/src/Routing/RouteSubscriber.php +++ b/multiversion_ui/src/Routing/RouteSubscriber.php @@ -63,7 +63,10 @@ class RouteSubscriber extends RouteSubscriberBase { '_controller' => '\Drupal\multiversion_ui\Controller\RevisionsController::revisions', '_title' => 'Revisions', ), - // @todo: Provide more granular permissions here. + // @todo: {@link https://www.drupal.org/node/2596783 Provide more + // granular permissions.} + + array('_permission' => 'administer multiversion revisions'), $options ); @@ -80,7 +83,8 @@ class RouteSubscriber extends RouteSubscriberBase { '_controller' => '\Drupal\multiversion_ui\Controller\RevisionController::view', '_title_callback' => '\Drupal\multiversion_ui\Controller\RevisionController::viewTitle', ), - // @todo: Provide more granular permissions here. + // @todo: {@link https://www.drupal.org/node/2596783 Provide more + // granular permissions.} array('_permission' => 'administer multiversion revisions'), $options ); diff --git a/src/Entity/Index/RevisionTreeIndex.php b/src/Entity/Index/RevisionTreeIndex.php index 134b78b..94d5744 100644 --- a/src/Entity/Index/RevisionTreeIndex.php +++ b/src/Entity/Index/RevisionTreeIndex.php @@ -6,7 +6,8 @@ use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\multiversion\Workspace\WorkspaceManagerInterface; /** - * @todo Consider caching once/if rev and rev tree indices are merged. + * @todo: {@link https://www.drupal.org/node/2597444 Consider caching once/if + * rev and rev tree indices are merged.} */ class RevisionTreeIndex implements RevisionTreeIndexInterface { @@ -72,8 +73,8 @@ class RevisionTreeIndex implements RevisionTreeIndexInterface { /** * {@inheritdoc} * - * @todo The revision tree also contain missing revisions. We need a better - * way to count. + * @todo: {@link https://www.drupal.org/node/2597422 The revision tree also + * contain missing revisions. We need a better way to count.} */ public function countRevs($uuid) { $values = $this->buildTree($uuid); @@ -137,7 +138,8 @@ class RevisionTreeIndex implements RevisionTreeIndexInterface { * Returns an array containing the built tree, open revisions, default * revision, default branch and conflicts. * - * @todo Implement 'deleted_conflicts' + * @todo: {@link https://www.drupal.org/node/2597430 Implement + * 'deleted_conflicts'.} */ protected static function doBuildTree($revs, $revs_info, $parse = 0, &$tree = array(), &$open_revs = array(), &$conflicts = array()) { foreach ($revs as $rev => $parent_rev) { @@ -148,7 +150,7 @@ class RevisionTreeIndex implements RevisionTreeIndexInterface { if ($parent_rev == $parse) { // Avoid bad data to cause endless loops. - // @todo Needs test. + // @todo: {@link https://www.drupal.org/node/2597434 Needs test.} if ($rev == $parse) { throw new \InvalidArgumentException('Child and parent revision can not be the same value.'); } @@ -229,7 +231,8 @@ class RevisionTreeIndex implements RevisionTreeIndexInterface { * Helper method to update the default revision. */ protected static function updateDefaultRevision(&$tree, $default_rev) { - // @todo: We can temporarily flip the sort to find the default rev earlier. + // @todo: {@link https://www.drupal.org/node/2597442 We can temporarily + // flip the sort to find the default rev earlier.} foreach ($tree as &$element) { if (isset($element['#rev']) && $element['#rev'] == $default_rev) { $element['#rev_info']['default'] = TRUE; diff --git a/src/Entity/Query/QueryTrait.php b/src/Entity/Query/QueryTrait.php index 8e1be0c..cc1528c 100644 --- a/src/Entity/Query/QueryTrait.php +++ b/src/Entity/Query/QueryTrait.php @@ -79,7 +79,8 @@ trait QueryTrait { $current_request = \Drupal::service('request_stack')->getCurrentRequest(); $form_id = $current_request->request->get('form_id'); // Don't add this condition when a user tries to login. - // @todo: See if there is a cleaner way to detect login. + // @todo: {@link https://www.drupal.org/node/2597456 See if there is a + // cleaner way to detect login.} if ($form_id != 'user_login_form') { $this->condition('workspace', $this->workspaceId ?: \Drupal::service('multiversion.manager')->getActiveWorkspaceId()); } diff --git a/src/Entity/Storage/ContentEntityStorageTrait.php b/src/Entity/Storage/ContentEntityStorageTrait.php index 60d2344..8770337 100644 --- a/src/Entity/Storage/ContentEntityStorageTrait.php +++ b/src/Entity/Storage/ContentEntityStorageTrait.php @@ -54,7 +54,8 @@ trait ContentEntityStorageTrait { $current_request = \Drupal::service('request_stack')->getCurrentRequest(); $form_id = $current_request->request->get('form_id'); // Don't add this condition when an user tries to login. - // @todo: See if there is a cleaner way to detect login. + // @todo: {@link https://www.drupal.org/node/2597456 See if there is a + // cleaner way to detect login.} if ($form_id != 'user_login_form') { $query->condition("$revision_alias.workspace", $this->getActiveWorkspaceId()); } @@ -183,7 +184,7 @@ trait ContentEntityStorageTrait { if ($entity->_rev->value == $default_rev) { $entity->isDefaultRevision(TRUE); } - // @todo: Needs test. + // @todo: {@link https://www.drupal.org/node/2597538 Needs test.} else { $entity->isDefaultRevision(FALSE); } diff --git a/src/Entity/Storage/Sql/CommentStorage.php b/src/Entity/Storage/Sql/CommentStorage.php index 0f80624..4ebc4ab 100644 --- a/src/Entity/Storage/Sql/CommentStorage.php +++ b/src/Entity/Storage/Sql/CommentStorage.php @@ -17,7 +17,8 @@ use Drupal\comment\CommentStorage as CoreCommentStorage; class CommentStorage extends CoreCommentStorage implements ContentEntityStorageInterface { use ContentEntityStorageTrait { - // @todo Rename to doDelete for consistency with other storage handlers. + // @todo: {@link https://www.drupal.org/node/2597526 Rename to doDelete + // for consistency with other storage handlers.} delete as deleteEntities; } diff --git a/src/Entity/Storage/Sql/NodeStorage.php b/src/Entity/Storage/Sql/NodeStorage.php index c0f57ce..20cfbf9 100644 --- a/src/Entity/Storage/Sql/NodeStorage.php +++ b/src/Entity/Storage/Sql/NodeStorage.php @@ -14,7 +14,8 @@ use Drupal\node\NodeStorage as CoreNodeStorage; /** * Defines the controller class for nodes. * - * @todo Remove this, as it's not needed anymore. + * @todo: {@link https://www.drupal.org/node/2597534 Remove this, as it's not + * needed anymore.} */ class NodeStorage extends CoreNodeStorage implements ContentEntityStorageInterface { diff --git a/src/Entity/Storage/Sql/TermStorage.php b/src/Entity/Storage/Sql/TermStorage.php index 1335c47..359dfa4 100644 --- a/src/Entity/Storage/Sql/TermStorage.php +++ b/src/Entity/Storage/Sql/TermStorage.php @@ -17,14 +17,16 @@ use Drupal\taxonomy\TermStorage as CoreTermStorage; class TermStorage extends CoreTermStorage implements ContentEntityStorageInterface { use ContentEntityStorageTrait { - // @todo Rename to doDelete for consistency with other storage handlers. + // @todo: {@link https://www.drupal.org/node/2597526 Rename to doDelete + // for consistency with other storage handlers.} delete as deleteEntities; } /** * {@inheritdoc} * - * @todo Can we do a query alter instead of overriding this method? + * @todo: {@link https://www.drupal.org/node/2597530 Can we do a query alter + * instead of overriding this method?} */ public function loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE) { $cache_key = implode(':', func_get_args()); diff --git a/src/MultiversionManager.php b/src/MultiversionManager.php index 75f1a53..fc69a0c 100644 --- a/src/MultiversionManager.php +++ b/src/MultiversionManager.php @@ -30,7 +30,9 @@ class MultiversionManager implements MultiversionManagerInterface { * Multiversion's tests in really strange ways. * * @var array - * @todo Fix these some day. Some contrib modules might behave the same way? + * @todo: {@link https://www.drupal.org/node/2597333 Fix these some day. + * Some contrib modules might behave the same way?} + * */ protected $entityTypeBlackList = array( 'entity_test_no_id', @@ -76,7 +78,11 @@ class MultiversionManager implements MultiversionManagerInterface { /** * {@inheritdoc} * - * @todo Consider using the nextId API to generate more sequential IDs. + * @todo: {@link https://www.drupal.org/node/2597337 Consider using the + * nextId API to generate more sequential IDs.} + * + * + * @link * @see \Drupal\Core\Database\Connection::nextId */ public function newSequenceId() { @@ -106,7 +112,8 @@ class MultiversionManager implements MultiversionManagerInterface { if (in_array($entity_type_id, $this->entityTypeBlackList)) { return FALSE; } - // @todo Remove this when there are no entity types left to implement. + // @todo: {@link https://www.drupal.org/node/2597339 Remove this when there + // are no entity types left to implement.} if (in_array($entity_type_id, $this->entityTypeToDo)) { return FALSE; } @@ -142,15 +149,18 @@ class MultiversionManager implements MultiversionManagerInterface { } // The terms being serialized are: // - deleted - // - old sequence ID (@todo) + // - old sequence ID (@todo: {@link https://www.drupal.org/node/2597341 + // Address this property.}) // - old revision hash // - normalized entity (without revision info field) - // - attachments (@todo) + // - attachments (@todo: {@link https://www.drupal.org/node/2597341 + // Address this property.}) return ($index + 1) . '-' . md5($this->termToBinary(array($deleted, 0, $old_rev, $normalized_entity, array()))); } protected function termToBinary(array $term) { - // @todo: Switch to BERT serialization format instead of JSON. + // @todo: {@link https://www.drupal.org/node/2597478 Switch to BERT + // serialization format instead of JSON.} return $this->serializer->serialize($term, 'json'); } diff --git a/src/Tests/EntityStorageTest.php b/src/Tests/EntityStorageTest.php index 3466c8d..5c248b7 100644 --- a/src/Tests/EntityStorageTest.php +++ b/src/Tests/EntityStorageTest.php @@ -129,8 +129,8 @@ class EntityStorageTest extends MultiversionWebTestBase { $ids = array(); $entity = entity_create($entity_type_id, $info['info']); $return = $entity->save(); - // @todo Remove this check when https://www.drupal.org/node/2462265 will - // be commited. + // @todo: {@link https://www.drupal.org/node/2597496 Remove this check + // now that https://www.drupal.org/node/2462265 is committed.} if ($entity_type_id != 'user') { $this->assertEqual($return, SAVED_NEW, "$entity_type_id was saved."); } @@ -139,7 +139,8 @@ class EntityStorageTest extends MultiversionWebTestBase { $loaded = entity_load($entity_type_id, $ids[0]); $this->assertEqual($ids[0], $loaded->id(), "Single $entity_type_id was loaded."); - // @todo Test loadEntityByUuid + // @todo: {@link https://www.drupal.org/node/2597508 Test + // loadEntityByUuid.} // Update and save a new revision. $entity->{$info['name']} = $this->randomMachineName(); $entity->save(); @@ -260,7 +261,8 @@ class EntityStorageTest extends MultiversionWebTestBase { $first_rev = $entity->_rev->value; try { // Temporary solution. - // @todo Remove when https://www.drupal.org/node/2453153 will be fixed. + // @todo: {@link https://www.drupal.org/node/2597516 Remove now that + // https://www.drupal.org/node/2453153 is fixed.} $entity->original = clone $entity; // Trigger an error by setting the ID too large. diff --git a/src/Tests/MultiversionWebTestBase.php b/src/Tests/MultiversionWebTestBase.php index 569ab6c..5995257 100644 --- a/src/Tests/MultiversionWebTestBase.php +++ b/src/Tests/MultiversionWebTestBase.php @@ -12,7 +12,8 @@ use Drupal\Component\Utility\Unicode; use Drupal\simpletest\WebTestBase; /** - * @todo Change to extending DrupalUnitTestBase to increase performance. + * @todo: {@link https://www.drupal.org/node/2597492 Change to extending + * DrupalUnitTestBase to increase performance.} */ abstract class MultiversionWebTestBase extends WebTestBase { diff --git a/src/Tests/RevisionTreeIndexTest.php b/src/Tests/RevisionTreeIndexTest.php index 348df8e..bf0b7f9 100644 --- a/src/Tests/RevisionTreeIndexTest.php +++ b/src/Tests/RevisionTreeIndexTest.php @@ -12,7 +12,8 @@ namespace Drupal\multiversion\Tests; * * @group multiversion * - * @todo: Test more entity types, like in \Drupal\multiversion\Tests\EntityStorageTest + * @todo: {@link https://www.drupal.org/node/2597486 Test more entity types, + * like in \Drupal\multiversion\Tests\EntityStorageTest.} */ class RevisionTreeIndexTest extends MultiversionWebTestBase { diff --git a/src/Workspace/SessionWorkspaceNegotiator.php b/src/Workspace/SessionWorkspaceNegotiator.php index 02323eb..518e4a8 100644 --- a/src/Workspace/SessionWorkspaceNegotiator.php +++ b/src/Workspace/SessionWorkspaceNegotiator.php @@ -26,7 +26,9 @@ class SessionWorkspaceNegotiator extends WorkspaceNegotiatorBase implements Work public function getWorkspaceId(Request $request) { $workspace_id = $request->query->get('workspace') ?: NULL; if (!$workspace_id && isset($_SESSION['workspace'])) { - // @todo Review from a security perspective. + // @todo: {@link https://www.drupal.org/node/2597464 Review from a + // security + // perspective.} $workspace_id = $_SESSION['workspace']; } return $workspace_id ?: $this->container->getParameter('workspace.default');