Skip to content

fix(harvester): improve View Changes modal UX on 403 #810

Open
TahaKhan998 wants to merge 1 commit into
CERNDocumentServer:masterfrom
TahaKhan998:fix/issue-788-view-changes-403-modal
Open

fix(harvester): improve View Changes modal UX on 403 #810
TahaKhan998 wants to merge 1 commit into
CERNDocumentServer:masterfrom
TahaKhan998:fix/issue-788-view-changes-403-modal

Conversation

@TahaKhan998

@TahaKhan998 TahaKhan998 commented Jun 9, 2026

Copy link
Copy Markdown

Closes #788

  • Show a clear error message in the View Changes modal when the revisions API returns 403, instead of a blank modal
image

@TahaKhan998 TahaKhan998 force-pushed the fix/issue-788-view-changes-403-modal branch from d293824 to 19b251d Compare June 9, 2026 14:28
@TahaKhan998 TahaKhan998 changed the title fix(harvester): improve View Changes modal UX on 403 and blank page fix(harvester): improve View Changes modal UX on 403 Jun 9, 2026
@TahaKhan998 TahaKhan998 force-pushed the fix/issue-788-view-changes-403-modal branch 3 times, most recently from 19d778a to 5510684 Compare June 9, 2026 15:13
onModalTriggerClick = (e, { dataActionKey }) => {
const { resource } = this.props;

if (dataActionKey === "view_changes") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AuditLogActions should already have this buttons and the modal trigger right? I am no sure I understand why this override is needed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You are right, the base class already has the buttons and opens the modal. The only reason for the override is that the base always puts the default ViewRecentChanges inside the modal and we need our own version that shows a clear message on 403. Everything else now just calls the base handler

};

const renderViewRecentChanges = ViewRecentChanges.prototype.render;
ViewRecentChanges.prototype.render = function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be written in a better and readable way by extending class and overriding the render method instead of injecting a new overriden render?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You are right, that was a bad way to do it so i changed it to a normal subclass (HarvesterViewRecentChanges extends ViewRecentChanges) that overrides render and fetchPreviousRevision.

@TahaKhan998 TahaKhan998 force-pushed the fix/issue-788-view-changes-403-modal branch from 5510684 to 6ad2279 Compare June 11, 2026 09:56
Refactor to subclasses instead of prototype patching per review.
@TahaKhan998 TahaKhan998 force-pushed the fix/issue-788-view-changes-403-modal branch from 6ad2279 to bd1b177 Compare June 11, 2026 10:01
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.

Harvester Reports revision access 403 and administration errors: improve UI error handling

2 participants