Skip to content

[ENG-10283] added ability to add/remove files of an archived registration under osf storage#11674

Open
ihorsokhanexoft wants to merge 2 commits intoCenterForOpenScience:feature/pbs-26-6from
ihorsokhanexoft:feature/ENG-10283
Open

[ENG-10283] added ability to add/remove files of an archived registration under osf storage#11674
ihorsokhanexoft wants to merge 2 commits intoCenterForOpenScience:feature/pbs-26-6from
ihorsokhanexoft:feature/ENG-10283

Conversation

@ihorsokhanexoft
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@felliott felliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. I've added a few nitpicks and some possibly-unhandled error cases. If those error cases are handled elsewhere, then I think you ignore them.

<a href="{% url 'nodes:search' %}" class="btn btn-primary"> <i class="fa fa-search"></i></a>
<a href="{% url 'nodes:node-logs' guid=node.guid %}" class="btn btn-primary">View Logs</a>
{% include "nodes/remove_node.html" with node=node %}
{% include "nodes/remove_file.html" with node=node %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Can we delete this file? Is it used anywhere else?

</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger" name="action" value="ham" type="submit">Confirm</button>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: value="ham"? Is that needed?

</div>
</div>
<div class="modal-footer">
<button class="btn btn-danger" name="action" value="ham" type="submit">Confirm</button>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: value="ham"?

messages.error(request, 'No file found with the provided guid.')
return redirect(self.get_success_url())

file = guid.referent
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to verify that the guid referent is actually a File and not another project, user, etc.?

messages.error(request, 'No file found with the provided guid.')
return redirect(self.get_success_url())

file = guid.referent
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

return redirect(self.get_success_url())

file = guid.referent
registration.files.filter(id=file.id).delete()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the file exists, but not under the registration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants