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

Add placeful workflow for mails in inbox area #5325

Merged
merged 3 commits into from Feb 8, 2019

Conversation

Projects
None yet
3 participants
@njohner
Copy link
Member

njohner commented Feb 5, 2019

Mails cannot be edited in the inbox, because of the inbox workflow introduced in #4648, preventing inbox group users are to edit the inbox. A placeful workflow was added for documents to allow editing of documents in the inbox, but not for mails. We correct this here.

For the upgrade step, we cannot simply use the PlacefulWorkflowPolicyActivator. The problem is that the opengever_inbox_policy is already active on the inbox and that we simply add a workflow for mails, so that as soon as we call self.install_upgrade_profile(), the objects in the inbox will be on the new workflow, and WorkflowChainUpdater called from PlacefulWorkflowPolicyActivator will not apply the state mapping. Hence we have to do this by hand.

For easier review I have a first commit simply copying the opengever_mail_workflow as a new placeful workflow, and then modifying it.

resolves #5198

@njohner njohner requested a review from 4teamwork/gever Feb 5, 2019

self.install_upgrade_profile()
for inbox in inboxes:
activator = PlacefulWorkflowPolicyActivator(inbox)
activator._activate_placeful_policy(

This comment has been minimized.

@jone

jone Feb 5, 2019

Member

I think you don't need a PlacefulWorkflowPolicyActivator at all, because you are not activating a new placeful policy, right? The PlacefulWorkflowPolicyActivator actually just enables a new placeful workflow policy and then uses the WorkflowChainUpdater. So this should be doable with only using WorkflowChainUpdater.

I would do it like this:

from operator import methodcaller

inbox_paths = map(methodcaller('getPath'),
                  self.catalog_unrestricted_search(…, full_objects=False))

mails_in_inboxes = self.catalog_unrestricted_search(
    {'path': inbox_paths, portal_type='ftw.mail.mail'},
    full_objects=True)

with WorkflowChainUpdater(mails_in_inboxes, review_state_mapping):
    self.install_upgrade_profile()

This comment has been minimized.

@njohner

njohner Feb 5, 2019

Author Member

Thanks for the clarification

@njohner njohner force-pushed the nj_inbox_mail branch from b84fa03 to 8d9fa5e Feb 5, 2019

@deiferni deiferni added this to the Release 2019.1 milestone Feb 6, 2019

@deiferni
Copy link
Member

deiferni left a comment

LGTM 👍

@njohner njohner merged commit bb2e1f3 into master Feb 8, 2019

8 checks passed

CI Governor: test-docs-intern.cfg Task #361969 succeeded
Details
CI Governor: test-docs-public-fr.cfg Task #361970 succeeded
Details
CI Governor: test-docs-public.cfg Task #361971 succeeded
Details
CI Governor: test-i18n-de.cfg Task #361972 succeeded
Details
CI Governor: test-plone-4.3.x.cfg Task #361973 succeeded
Details
CI Governor: test-qa.cfg Task #361974 succeeded
Details
CI Governor: test-testserver-selftest.cfg Task #361975 succeeded
Details
CI Governor: test-xml-convention.cfg Task #361976 succeeded
Details

@njohner njohner deleted the nj_inbox_mail branch Feb 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment