-
Notifications
You must be signed in to change notification settings - Fork 16
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
Republish drafts of other translations on PUT of new translation #2769
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, just have a couple of qs/comments
@@ -200,6 +202,29 @@ def clear_draft_item_of_different_locale_but_matching_base_path | |||
) | |||
end | |||
|
|||
def update_draft_items_of_different_locale_but_matching_content_id | |||
return unless payload[:base_path] | |||
return if Document.where(content_id: payload[:content_id], locale: payload[:locale]).any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding a couple of tests for these early returns? Might also help serve as documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good idea, I'll add them.
.map(&:draft) | ||
.compact | ||
|
||
after_transaction_commit do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the transaction here? Is it that the rest of the call
method executes successfully and we only want to run this if it does? Or is it scoped to this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's after the call
(I think it's this line that executes the block), so we only send the payload to content store once the data has actually been committed to the database.
When a draft translation is added and another translation of the same content ID exists, we need to send the existing translation(s) downstream so their `available_translations` links can be updated to include the new translation. We're not currently doing this, which leads to a situation where the link to the new translation never appears on the draft of the existing translations.
c801987
to
d3c4199
Compare
When a draft translation is added and another translation of the same content ID exists, we need to send the existing translation(s) downstream so their
available_translations
links can be updated to include the new translation.We're not currently doing this, which leads to a situation where the link to the new translation never appears on the draft of the existing translations.
Trello card