Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into institutional-access-insti-admin-validation

* 'develop' of https://github.com/CenterForOpenScience/osf.io:
  Add view, form to update moderation state
  • Loading branch information
John Tordoff committed Jan 9, 2025
2 parents 8171f74 + 5941492 commit 56f0959
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions admin/nodes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def post(self, request, *args, **kwargs):

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
3 changes: 1 addition & 2 deletions osf/utils/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,14 @@ def save_changes(self, ev):
if ev.event.name == DefaultTriggers.ACCEPT.value:
if not self.machineable.target.is_contributor(self.machineable.creator):
contributor_permissions = ev.kwargs.get('permissions', permissions.READ)
make_curator = True if self.machineable.request_type == NodeRequestTypes.INSTITUTIONAL_REQUEST.value else False
try:
self.machineable.target.add_contributor(
self.machineable.creator,
auth=Auth(ev.kwargs['user']),
permissions=contributor_permissions,
visible=ev.kwargs.get('visible', True),
send_email=f'{self.machineable.request_type}_request',
make_curator=make_curator,
make_curator=self.machineable.request_type == NodeRequestTypes.INSTITUTIONAL_REQUEST.value,
)
except IntegrityError as e:
if 'Curators cannot be made bibliographic contributors' in str(e):
Expand Down

0 comments on commit 56f0959

Please sign in to comment.