apostrophe-workflow icon indicating copy to clipboard operation
apostrophe-workflow copied to clipboard

join between types included from workflow and another excluded from it

Open GiuseppeCM opened this issue 5 years ago • 8 comments

I have one piece type excluded from the workflow, and in this type I have a join with 'apostrophe-images'. Apostrophe-images is included in the workflow. If I edit the first type in mode live, and I populate this join, is ok, but if I switch in mode draft, I can not see the images in the manager modal. I have the apostrophe-pieces-page too, and in the show page, in mode live I see the image, but in draft no... sounds like a problem in populating joins between one type excluded from the workflow and another included in the workflow.

GiuseppeCM avatar Jul 18 '19 16:07 GiuseppeCM

This is a legitimate issue. Unfortunately it probably isn't possible to resolve it when the join is from the excluded type to the included type, at least without a major change to the engineering of how joins are implemented in workflow. That's because joins are by _id and the _id is different across locales, and for a type that is excluded there is simply nowhere to store the different ids per locale, etc.

This is unlikely to change at least until the 3.x version of workflow.

However is it possible, in your case, to edit this via a join from the other end (the type that has workflow), and use a joinByOneReverse or joinByArrayReverse to access that content from the end that does not have workflow? That ought to work correctly.

boutell avatar Jul 22 '19 15:07 boutell

Hi @boutell I can't create a joinByArrayReverse because it's too big to do right now, since the images are around 3000. At this moment I solve this issue inserting in a join with apostrophe-image this filter: workflowLocale: 'forDetailPage' and I have extended apostrophe-workflow/lib/modules/apostrophe-workflow-docs/lib/cursor.js whit this condition if (setting === 'forDetailPage') { return; }(with this condition, does not apply self.and({ workflowLocale: setting });). I know it's not an optimal way to do this but right now it works. If it were to give me any other problems, I think I would exclude the apostrophe-image from workflow.

GiuseppeCM avatar Jul 29 '19 14:07 GiuseppeCM

Most likely this restriction will be lifted in 3.0, probably by building a workflowGuid directly into the _id.

boutell avatar Jul 29 '19 16:07 boutell

Hi @boutell

I tried to follow your advice to create a join and use the reverse, but even in this case it doesn't work and the behavior is the same.

GiuseppeCM avatar Sep 06 '19 15:09 GiuseppeCM

OK, I would need to see a test project replicating the issue.

boutell avatar Sep 06 '19 16:09 boutell

I created this repository: https://github.com/GiuseppeCM/joinWorkflow and I noticed that this issue occurs only in the case where the joinByArray has an array of more than two pieces as the value of the withType field, and as I told you on git, the same issue the same behavior has it with the joinByArrayReverse.

GiuseppeCM avatar Sep 09 '19 12:09 GiuseppeCM

OK, can you open a new issue on this ("reverse join does not work with polymorphic join to two or more types...") to avoid confusion and we'll go from there. I want to keep this ticket open for the 3.x feature to allow what you originally wanted. Thanks!

boutell avatar Sep 09 '19 13:09 boutell

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 19 '20 00:06 stale[bot]