Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/371/seo image missing from draft #372

Merged
merged 5 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/services/fieldtranslator/SeomaticMetaFieldTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,8 @@ public function toPostArray(ElementTranslator $elementTranslator, Element $eleme

$meta = $element->getFieldValue($fieldHandle);

$source = array();
$source[$fieldHandle] = $field->serializeValue($meta);

if( $meta )
{
foreach($meta->metaGlobalVars as $key => $value)
{
$source[$fieldHandle]['metaGlobalVars'][$key] = $value;
}
}

return $source;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function updateDraft($element, $draft, $translatedContent, $sourceSite, $
$draft->title = isset($targetData['title']) ? $targetData['title'] : $draft->title;
$draft->slug = isset($targetData['slug']) ? $targetData['slug'] : $draft->slug;

$post = Translations::$plugin->elementTranslator->toPostArrayFromTranslationTarget($draft, $sourceSite, $targetSite, $targetData);
$post = Translations::$plugin->elementTranslator->toPostArrayFromTranslationTarget($element, $sourceSite, $targetSite, $targetData);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shnsumit @bhupeshappfoster could you please explain the change from $draft to $element? This may have unintended consequences.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidedwards
this change is because of drafts in target sites never contains localised nested blocks and hence can lead missing blocks from draft so we use source entry to get all content to target in case it is missing from target

Copy link
Collaborator

@sidedwards sidedwards Jul 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bhupeshappfoster, thanks for the explanation. We will need to do some comprehensive e2e testing to make sure this doesn't break other workflows, but we can proceed with merging for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change from draft to element is not required for the fix give me min i ll commit a revert and then we can proceed with merge and release

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidedwards
Please review again i think we can proceed with merge now.

$draft->setFieldValues($post);
$draft->siteId = $targetSite;

Expand Down