Skip to content

Commit

Permalink
Merge branch 'hotfix/24.11.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mfraezz committed Jan 9, 2025
2 parents 887875a + a42ee32 commit 183d14f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
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 183d14f

Please sign in to comment.