Skip to content

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

Open
ihorsokhanexoft wants to merge 3 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 3 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?

Copy link
Copy Markdown
Contributor Author

@ihorsokhanexoft ihorsokhanexoft Apr 9, 2026

Choose a reason for hiding this comment

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

I believe I removed it accidentally because supposed I had to override this file removal workflow

</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.?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, you are right

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?

Copy link
Copy Markdown
Contributor Author

@ihorsokhanexoft ihorsokhanexoft Apr 9, 2026

Choose a reason for hiding this comment

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

If I got it correctly, then nothing will happen as we query files of a specific registration, which means file won't be found. We should delete a file only if it's attached to a registration, not project (because in the project user can manually delete a file unlike in the archived registration, this is the purpose of this PR to add such a functionality for product team)

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