Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix draft access when published record deleted #1572

Conversation

zzacharo
Copy link
Member

@zzacharo zzacharo force-pushed the fix-draft-access-when-published-record-deleted branch from 99ee684 to 63ca84d Compare October 23, 2023 13:34
record = self.record_cls.pid.resolve(id_)
if record.deletion_status.is_deleted:
result = super().read(identity, id_, expand=expand)
raise RecordDeletedException(record, result_item=result)
Copy link
Member Author

Choose a reason for hiding this comment

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

this will result in /uploads/<id> giving back the record's tombstone's page

Screenshot 2023-10-23 at 15 24 25

Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

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

Minor comment on the draft indexer, but otherwise LGTM.

# reindex associated draft
try:
draft = self.draft_cls.pid.resolve(id_)
uow.register(RecordIndexOp(draft, indexer=self.indexer))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
uow.register(RecordIndexOp(draft, indexer=self.indexer))
uow.register(RecordIndexOp(draft, indexer=self.draft_indexer))

I recently found out, this is a thing :)

ditto above I guess when deleting from the index.

@zzacharo zzacharo force-pushed the fix-draft-access-when-published-record-deleted branch from 63ca84d to 5b2662a Compare October 23, 2023 15:11
@zzacharo zzacharo force-pushed the fix-draft-access-when-published-record-deleted branch from 5b2662a to a5f853d Compare October 23, 2023 15:41
@zzacharo zzacharo merged commit 16d30c0 into inveniosoftware:master Oct 23, 2023
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.

2 participants