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

Group review task #25

Merged
merged 6 commits into from Apr 1, 2020
Merged

Conversation

jacobtoppm
Copy link

Adds a GroupReviewTask analogous to GroupApprovalTask in Wagtail core, email notifications, and tests for email notifications

Relies on wagtail/wagtail#5894

Copy link
Contributor

@gasman gasman left a comment

Choose a reason for hiding this comment

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

Just one quibble from code review, although it looks like tests are breaking too (it's reporting that no emails are being triggered).

reviewers = self.page.current_workflow_task.reviewers
if reviewers.filter(pk=self.reviewer.pk).exists():
try:
actions = {action[0] for action in self.page.current_workflow_task.get_actions(self.page, user=None, reviewer=self.reviewer)}
Copy link
Contributor

Choose a reason for hiding this comment

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

If current_workflow_task is defined for this page, but is something other than ReviewTask / GroupReviewTask, then its get_actions method will not accept a reviewer argument, and this will fail with a TypeError (which doesn't get caught). I think it's best to keep the type check in place here.

Copy link
Author

Choose a reason for hiding this comment

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

I've added an except for the TypeError, would this work? I agree the type check works currently, but ideally I'd like to make review functionality usable by custom tasks via the mixin factored out in the next PR, #27. Otherwise I could check for inheriting from that mixin, I suppose?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good - yep, I think that change is worth making in #27. I'm a bit wary about catching TypeError, as that could mask legitimate errors too - I guess the same is true to a lesser extent for AttributeError too, so it would be good to change that to an if self.page.current_workflow_task: (assuming that's the case it's meant to be catching...)

@gasman
Copy link
Contributor

gasman commented Mar 25, 2020

I can confirm that tests pass when run against the Wagtail feature/workflow branch now that wagtail/wagtail#5894 is merged.

@gasman gasman merged commit a14b737 into wagtail-nest:master Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants