Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
f3822e92
Commit
f3822e92
authored
5 years ago
by
Fredrik Jonsson
Browse files
Options
Downloads
Patches
Plain Diff
Fix to Automatic workflow actions after creating seperate view for review edits.
parent
2af690f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/apply/review/views.py
+40
-26
40 additions, 26 deletions
opentech/apply/review/views.py
with
40 additions
and
26 deletions
opentech/apply/review/views.py
+
40
−
26
View file @
f3822e92
...
...
@@ -96,6 +96,10 @@ class ReviewEditView(UserPassesTestMixin, BaseStreamForm, UpdateView):
related
=
review
,
)
response
=
super
().
form_valid
(
form
)
# Automatic workflow actions.
review_workflow_actions
(
self
.
request
,
review
.
submission
)
return
response
def
get_success_url
(
self
):
...
...
@@ -164,32 +168,7 @@ class ReviewCreateOrUpdateView(BaseStreamForm, CreateOrUpdateView):
)
# Automatic workflow actions.
submission_stepped_phases
=
self
.
submission
.
workflow
.
stepped_phases
action
=
None
if
self
.
submission
.
status
==
INITIAL_STATE
:
# Automatically transition the application to "Internal review".
action
=
submission_stepped_phases
[
1
][
0
].
name
elif
self
.
submission
.
status
==
submission_stepped_phases
[
1
][
0
].
name
and
self
.
submission
.
reviews
.
count
()
>
1
:
# Automatically transition the application to "Ready for discussion".
action
=
submission_stepped_phases
[
2
][
0
].
name
elif
self
.
submission
.
status
==
'
proposal_discussion
'
:
# Automatically transition the proposal to "Internal review".
action
=
'
proposal_internal_review
'
elif
self
.
submission
.
status
==
'
external_review
'
and
self
.
submission
.
reviews
.
by_reviewers
().
count
()
>
1
:
# Automatically transition the proposal to "Ready for discussion".
action
=
'
post_external_review_discussion
'
# If action is set run perform_transition().
if
action
:
try
:
self
.
submission
.
perform_transition
(
action
,
self
.
request
.
user
,
request
=
self
.
request
,
notify
=
False
,
)
except
(
PermissionDenied
,
KeyError
):
pass
review_workflow_actions
(
self
.
request
,
self
.
submission
)
return
response
...
...
@@ -197,6 +176,41 @@ class ReviewCreateOrUpdateView(BaseStreamForm, CreateOrUpdateView):
return
self
.
submission
.
get_absolute_url
()
def
review_workflow_actions
(
request
,
submission
):
submission_stepped_phases
=
submission
.
workflow
.
stepped_phases
action
=
None
if
submission
.
status
==
INITIAL_STATE
:
# Automatically transition the application to "Internal review".
action
=
submission_stepped_phases
[
1
][
0
].
name
elif
submission
.
status
==
'
proposal_discussion
'
:
# Automatically transition the proposal to "Internal review".
action
=
'
proposal_internal_review
'
elif
submission
.
status
==
submission_stepped_phases
[
1
][
0
].
name
and
submission
.
reviews
.
count
()
>
1
:
# Automatically transition the application to "Ready for discussion".
action
=
submission_stepped_phases
[
2
][
0
].
name
elif
submission
.
status
==
'
ext_external_review
'
and
submission
.
reviews
.
by_reviewers
().
count
()
>
1
:
# Automatically transition the application to "Ready for discussion".
action
=
'
ext_post_external_review_discussion
'
elif
submission
.
status
==
'
com_external_review
'
and
submission
.
reviews
.
by_reviewers
().
count
()
>
1
:
# Automatically transition the application to "Ready for discussion".
action
=
'
com_post_external_review_discussion
'
elif
submission
.
status
==
'
external_review
'
and
submission
.
reviews
.
by_reviewers
().
count
()
>
1
:
# Automatically transition the proposal to "Ready for discussion".
action
=
'
post_external_review_discussion
'
# If action is set run perform_transition().
if
action
:
try
:
submission
.
perform_transition
(
action
,
request
.
user
,
request
=
request
,
notify
=
False
,
)
except
(
PermissionDenied
,
KeyError
):
pass
class
ReviewDisplay
(
UserPassesTestMixin
,
DetailView
):
model
=
Review
raise_exception
=
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment