From a42ee32fe08f98765b8e6e2b3722a6fbd1bb3dee Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Thu, 9 Jan 2025 10:36:41 -0500 Subject: [PATCH 1/2] Add view, form to update moderation state --- admin/nodes/urls.py | 1 + admin/nodes/views.py | 11 +++++++++++ admin/templates/nodes/node.html | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/admin/nodes/urls.py b/admin/nodes/urls.py index 5036b9dd06d..d081b544d61 100644 --- a/admin/nodes/urls.py +++ b/admin/nodes/urls.py @@ -38,4 +38,5 @@ re_path(r'^(?P[a-z0-9]+)/make_private/$', views.NodeMakePrivate.as_view(), name='make-private'), re_path(r'^(?P[a-z0-9]+)/make_public/$', views.NodeMakePublic.as_view(), name='make-public'), re_path(r'^(?P[a-z0-9]+)/remove_notifications/$', views.NodeRemoveNotificationView.as_view(), name='node-remove-notifications'), + re_path(r'^(?P[a-z0-9]+)/update_moderation_state/$', views.NodeUpdateModerationStateView.as_view(), name='node-update-mod-state'), ] diff --git a/admin/nodes/views.py b/admin/nodes/views.py index 74b6b08feae..f1e90d72c09 100644 --- a/admin/nodes/views.py +++ b/admin/nodes/views.py @@ -118,6 +118,17 @@ def post(self, request, *args, **kwargs): return redirect('nodes:node', guid=kwargs.get('guid')) + +class NodeUpdateModerationStateView(View): + def post(self, request, *args, **kwargs): + guid = kwargs.get('guid') + node = AbstractNode.load(guid) + node.update_moderation_state() + messages.success(request, 'Moderation state successfully updated.') + + return redirect('nodes:node', guid=kwargs.get('guid')) + + class NodeSearchView(PermissionRequiredMixin, FormView): """ Allows authorized users to search for a node by it's guid. """ diff --git a/admin/templates/nodes/node.html b/admin/templates/nodes/node.html index 6ec71e2dfdc..cb12f49c375 100644 --- a/admin/templates/nodes/node.html +++ b/admin/templates/nodes/node.html @@ -64,7 +64,12 @@

{{ node.type|cut:'osf.'|title }}: {{ node.title }} + {% csrf_token %} + + + Creator From 21c0d09db58cdcb404d0561a5fc012b64b3f671b Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Fri, 10 Jan 2025 13:21:47 -0500 Subject: [PATCH 2/2] Support older versions of Docker for Policy pulls --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d5dce5b303a..31fcb8ccbec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,7 +54,9 @@ RUN set -ex \ WORKDIR /code # Policies -ADD https://github.com/CenterForOpenScience/cos.io.git#master ./COS_POLICIES/ +RUN git clone https://github.com/CenterForOpenScience/cos.io.git ./COS_POLICIES/ +# When Jenkins uses a newer docker: +# ADD https://github.com/CenterForOpenScience/cos.io.git#master ./COS_POLICIES/ COPY pyproject.toml . COPY poetry.lock .