Skip to content

Commit

Permalink
Remove remaining traces of WorkflowStatus view
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormheg committed Aug 3, 2023
1 parent 662739a commit 7b5f821
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 77 deletions.
36 changes: 0 additions & 36 deletions wagtail/admin/views/generic/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,42 +214,6 @@ def get_context_data(self, **kwargs):
}


class WorkflowStatus(BaseObjectMixin, View):
workflow_history_url_name = None
revisions_compare_url_name = None

def setup(self, request, *args, **kwargs):
super().setup(request, *args, **kwargs)
self.workflow_state = self.object.current_workflow_state

def dispatch(self, request, *args, **kwargs):
if not self.workflow_state:
raise PermissionDenied
return super().dispatch(request, *args, **kwargs)

def get_workflow_history_url(self):
return reverse(self.workflow_history_url_name, args=(quote(self.object.pk),))

def get(self, request, *args, **kwargs):
return render_modal_workflow(
request,
"wagtailadmin/workflows/workflow_status.html",
None,
self.get_context_data(),
)

def get_context_data(self, **kwargs):
return {
"object": self.object,
"workflow_state": self.workflow_state,
"current_task_state": self.workflow_state.current_task_state,
"workflow_tasks": self.workflow_state.all_tasks_with_state(),
"workflow_history_url": self.get_workflow_history_url(),
"revisions_compare_url_name": self.revisions_compare_url_name,
**kwargs,
}


class PreviewRevisionForTask(BaseObjectMixin, View):
def setup(self, request, *args, task_id, **kwargs):
super().setup(request, *args, **kwargs)
Expand Down
20 changes: 0 additions & 20 deletions wagtail/snippets/tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,26 +283,6 @@ def test_get_detail_with_bad_permissions(self):
self.assertRedirects(response, reverse("wagtailadmin_home"))


class TestWorkflowStatus(BaseWorkflowsTestCase):
def setUp(self):
super().setUp()
self.object.text = "Edited!"
self.object.save_revision()
self.workflow_state = self.workflow.start(self.object, self.user)

def test_get_workflow_status(self):
response = self.client.get(self.get_url("workflow_status"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailadmin/workflows/workflow_status.html")

# Should show link to workflow history page
self.assertContains(response, self.get_url("workflow_history"))

# Should show the currently in progress workflow
self.assertContains(response, "Moderators approval")
self.assertContains(response, "In progress")


class TestConfirmWorkflowCancellation(BaseWorkflowsTestCase):
def setUp(self):
super().setUp()
Expand Down
21 changes: 0 additions & 21 deletions wagtail/snippets/views/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,6 @@ class ConfirmWorkflowCancellationView(workflow.ConfirmWorkflowCancellation):
pass


class WorkflowStatusView(PermissionCheckedMixin, workflow.WorkflowStatus):
permission_required = "change"


class WorkflowPreviewView(workflow.PreviewRevisionForTask):
pass

Expand Down Expand Up @@ -787,9 +783,6 @@ class SnippetViewSet(ModelViewSet):
#: The view class to use for confirming the cancellation of a workflow; must be a subclass of ``wagtail.snippet.views.snippets.ConfirmWorkflowCancellationView``.
confirm_workflow_cancellation_view_class = ConfirmWorkflowCancellationView

#: The view class to use for rendering the workflow status modal; must be a subclass of ``wagtail.snippet.views.snippets.WorkflowStatusView``.
workflow_status_view_class = WorkflowStatusView

#: The view class to use for previewing a revision for a specific task; must be a subclass of ``wagtail.snippet.views.snippets.WorkflowPreviewView``.
workflow_preview_view_class = WorkflowPreviewView

Expand Down Expand Up @@ -1152,15 +1145,6 @@ def collect_workflow_action_data_view(self):
def confirm_workflow_cancellation_view(self):
return self.confirm_workflow_cancellation_view_class.as_view(model=self.model)

@property
def workflow_status_view(self):
return self.workflow_status_view_class.as_view(
model=self.model,
permission_policy=self.permission_policy,
workflow_history_url_name=self.get_url_name("workflow_history"),
revisions_compare_url_name=self.get_url_name("revisions_compare"),
)

@property
def workflow_preview_view(self):
return self.workflow_preview_view_class.as_view(model=self.model)
Expand Down Expand Up @@ -1479,11 +1463,6 @@ def get_urlpatterns(self):
self.confirm_workflow_cancellation_view,
name="confirm_workflow_cancellation",
),
path(
"workflow/status/<str:pk>/",
self.workflow_status_view,
name="workflow_status",
),
path(
"workflow_history/<str:pk>/",
self.workflow_history_view,
Expand Down

0 comments on commit 7b5f821

Please sign in to comment.