Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature/preprint…
Browse files Browse the repository at this point in the history
…s-doi-versioning
  • Loading branch information
cslzchen committed Jan 16, 2025
2 parents 2d8c54e + 6a226ac commit 80d4263
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
1 change: 1 addition & 0 deletions admin/nodes/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@
re_path(r'^(?P<guid>[a-z0-9]+)/make_private/$', views.NodeMakePrivate.as_view(), name='make-private'),
re_path(r'^(?P<guid>[a-z0-9]+)/make_public/$', views.NodeMakePublic.as_view(), name='make-public'),
re_path(r'^(?P<guid>[a-z0-9]+)/remove_notifications/$', views.NodeRemoveNotificationView.as_view(), name='node-remove-notifications'),
re_path(r'^(?P<guid>[a-z0-9]+)/update_moderation_state/$', views.NodeUpdateModerationStateView.as_view(), name='node-update-mod-state'),
]
11 changes: 11 additions & 0 deletions admin/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
7 changes: 6 additions & 1 deletion admin/templates/nodes/node.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ <h2>{{ node.type|cut:'osf.'|title }}: <b>{{ node.title }}</b> <a href="{{ node.a
</tr>
<tr>
<td>Moderation State</td>
<td>{{ node.moderation_state }}</td>
<td>{{ node.moderation_state }}
<form method="post" action="{% url 'nodes:node-update-mod-state' node.guid %}">
{% csrf_token %}
<button type="submit" class="btn btn-primary">Update Moderation State</button>
</form>
</td>
</tr>
<tr>
<td>Creator</td>
Expand Down

0 comments on commit 80d4263

Please sign in to comment.