Comments

edurenye created an issue. See original summary.

edurenye’s picture

Status: Active » Needs review
StatusFileSize
new7.15 KB

Done and added tests.

miro_dietiker’s picture

+++ b/translators/tmgmt_local/src/Form/LocalTaskForm.php
@@ -52,7 +52,7 @@ class LocalTaskForm extends ContentEntityForm {
+      '#default_value' => $local_task->getAssignee() ? $local_task->getAssignee()->id() : NULL,

getAssignee() thus has a wrong annotation. It needs to add null as a return option.

Also the code reads like this bug would make the form fail fatal if there is no assignee. Thus we would need test coverage for the bug.

Other than that, this patch looks really nice.

Additionally, the issue reminded me to the fact that our Provider UI should somehow list that / if a provider supports continuous operation or not.
Created issue #2735439: Display translator capabilities

edurenye’s picture

Added NULL and test for the fix in the LocalTaskForm (see test_only file).

miro_dietiker’s picture

+++ b/translators/tmgmt_local/src/LocalTaskInterface.php
@@ -48,8 +48,8 @@ interface LocalTaskInterface extends ContentEntityInterface, EntityChangedInterf
+   * @return \Drupal\Core\Session\AccountInterface|NULL

I think it's null, not NULL in phpdoc. ;-)

edurenye’s picture

StatusFileSize
new8.77 KB
new650 bytes

Done.

berdir’s picture

Status: Needs review » Needs work
  1. +++ b/translators/tmgmt_local/src/Plugin/tmgmt/Translator/LocalTranslator.php
    @@ -32,9 +33,25 @@ class LocalTranslator extends TranslatorPluginBase {
       public function requestTranslation(JobInterface $job) {
    +    $items = $job->getItems();
    +    if (!empty($items)) {
    +      $this->requestJobItemsTranslation($items);
    +    }
    

    is empty items something the translator needs to be project against? I think not when combined with the other issue that doesn't call requestTranslation() in that case?

  2. +++ b/translators/tmgmt_local/src/Tests/LocalTranslatorContinuousTest.php
    @@ -0,0 +1,102 @@
    +
    +    // Create an english node.
    +    /** @var \Drupal\node\NodeInterface $node */
    +    $node = \Drupal::entityTypeManager()->getStorage('node')->create([
    +      'title' => $this->randomMachineName(),
    +      'uid' => 0,
    +      'type' => 'test',
    +      'langcode' => 'en',
    +    ]);
    +    $node->save();
    +
    +    $continuous_job->addItem('test_source', $node->getEntityTypeId(), $node->id());
    +
    +    $continuous_job_items = $continuous_job->getItems();
    

    I don't really get why you add a manual job item, continuous is supposed to do that automatically for you? Don't you end up with two job items now?

Bambell’s picture

Status: Needs work » Needs review
StatusFileSize
new9.01 KB
new4.03 KB

I don't really get why you add a manual job item, continuous is supposed to do that automatically for you? Don't you end up with two job items now?

I'm not exactly sure why, but the job item wouldn't get created after creating the node. I changed the node type and how the node is created as a workaround to this. Mostly copied from Drupal\Tests\tmgmt_content\Kernel\ContentEntitySourceUnitTest\testContinuousJobItems.

edurenye’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, so RTBC.

berdir’s picture

Status: Reviewed & tested by the community » Fixed
+++ b/translators/tmgmt_local/src/Tests/LocalTranslatorContinuousTest.php
@@ -13,9 +14,22 @@ use Drupal\tmgmt\JobItemInterface;
+
+    // Enable entity translations for nodes.
+    $content_translation_manager = \Drupal::service('content_translation.manager');
+    $content_translation_manager->setEnabled('node', $type->label(), TRUE);

I guess this was the missing part, yes.

Looks good to me as well.

  • Berdir committed c61efe2 on 8.x-1.x authored by edurenye
    Issue #2730169 by edurenye, Bambell: Implement...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.