Skip to content

Conversation

@ptamarit
Copy link
Member

Partially fixes #489

@ptamarit ptamarit requested a review from zzacharo January 22, 2026 15:16
@ptamarit ptamarit force-pushed the 489-comment-file-attachment branch 3 times, most recently from 54697d7 to 0d5843d Compare January 22, 2026 17:37
["object_version_id"],
unique=False,
)
# TODO: Is ix_request_files_record_id needed? (We do not have it in Zenodo prod for communities)
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

Copy link
Member Author

@ptamarit ptamarit Jan 23, 2026

Choose a reason for hiding this comment

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

Oh, I removed it in the 2nd commit instead of the first one, my bad.
And indeed, I checked and I don't think that these indexes make sense.

We decided that commits will be squashed.

Same for comment below.

# op.create_index(
# "uidx_request_files_id_key", "request_files", ["id", "key"], unique=True
# )
# TODO: Is uidx_request_files_record_id_key needed? (We do not have it in Zenodo prod for communities, but instead have uidx_request_files_id_key)
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

yield projection


class RequestFileLink(Link):
Copy link
Member

Choose a reason for hiding this comment

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

This will have to change after @fenekku changes regarding links. @fenekku would there be any guide on how to move to the new way of defining links?

Copy link
Contributor

@fenekku fenekku Jan 23, 2026

Choose a reason for hiding this comment

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

Guidance on the change would be to:

  • replace Link by EndpointLink imported with from invenio_records_resources.services import EndpointLink
  • replace the "{api}/..." by the name of the endpoint
  • add params=[...] argument with string name of the route variables
  • define vars=lambda obj, vars: ... to update vars with those route variables

You can see: https://github.com/inveniosoftware/invenio-requests/pull/522/changes#diff-1dc8e4a7059ecea92c9ede417ea4f8e769f1963c9d94a7f37d8e80d3e4d8222eR131 for the Request work. (and invenio-records-resources and so on for various takes)

Copy link
Member

Choose a reason for hiding this comment

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

@ptamarit I think we need to note down the above so that we upgrade the links after the next major release including the above changes. @fenekku we plan to release this feature first as part of the current major release so that we avoid having to bump to the major including your work on links refactoring among others.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify that part:

we plan to release this feature first as part of the current major release so that we avoid having to bump to the major including your work on links refactoring among others.

given the below: ?

The links change in this repo will necessitate a major bump of invenio-requests. The UTC change that Christoph will apply: #487 would also necessitate a major bump of this repo. The current plan, was to get the Links and UTC changes as part of the same major bump.

Either this PR can be part of that same major bump or it can be part of its own separate major bump (ordering to your liking).

Copy link
Member

Choose a reason for hiding this comment

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

We will release this as part of the major bump inveniosoftware/invenio-app-rdm@c540fa1 which includes already the commenting features. Of course, after you bump the major with the Links and UTC we will need to include the feature applying the changes as you pointed out in https://github.com/inveniosoftware/invenio-requests/pull/522/changes#diff-1dc8e4a7059ecea92c9ede417ea4f8e769f1963c9d94a7f37d8e80d3e4d8222eR131 .

We want to do this because we dont want to block you but also Zenodo wants to deploy all the commenting features rather soon without having to bump to the changes you introduce with Christoph. @ptamarit correct me if I am wrong :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. If you want to get commenting and files sooner, it makes sense to do your own major bump. That major bump will have to be incremented again on invenio-app-rdm once my work and @utnapischtim's work is merged and released.

Copy link
Member

Choose a reason for hiding this comment

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

We had done our own last December so we will continue in that one as a maint release if you are faster than us :)

Additional replies can be loaded via pagination.
"""

REQUESTS_FILES_DEFAULT_QUOTA_SIZE = 100 * 10**6 # 100MB
Copy link
Member

Choose a reason for hiding this comment

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

Make sure there is some nice error when we reach that in the UI

Copy link
Member Author

Choose a reason for hiding this comment

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

I just tested, and we get an HTTP status code 400 and the following response:
{'message': 'Bucket quota exceeded.', 'status': 400}

(This makes me think that my explicit check and custom exception RequestFileSizeLimitError are not that useful, since the underlying bucket already takes care of returning errors which are properly handled.)

Copy link
Member

Choose a reason for hiding this comment

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

Unless, we want to have a specific error for comments when this bubbles up

raise RequestFileNotFoundError()

return deleted_file.file.dumps()
return request_file.file
Copy link
Member

Choose a reason for hiding this comment

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

Return it via result item?

Copy link
Member Author

Choose a reason for hiding this comment

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

Using file_result_item in the last commit (different than the 2 other results, so that we can rely on the send_file implemented by FileService).

@ptamarit ptamarit changed the title feat(comment-file): file upload and delete and get content feat(comment-file): file upload delete read Jan 23, 2026
@ptamarit ptamarit force-pushed the 489-comment-file-attachment branch from d4a0708 to 76a06fd Compare January 23, 2026 17:02
@ptamarit
Copy link
Member Author

ptamarit commented Jan 23, 2026

FYI, I disabled assertions in the Alembic test which are failing since SQLAlchemy-Continuum 1.6.0 (not related to changes on this PR, failing in master too).

@ptamarit ptamarit force-pushed the 489-comment-file-attachment branch from 76a06fd to 5e51ffb Compare January 26, 2026 09:55
@ptamarit
Copy link
Member Author

Just squashed commits before merging.

@ptamarit ptamarit merged commit 1969df2 into inveniosoftware:feature/comments Jan 26, 2026
4 checks passed
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.

3 participants