Skip to content

Fix isReviewer in manage record menu#9271

Merged
josegar74 merged 2 commits into
geonetwork:mainfrom
tylerjmchugh:fix-isReviewer
May 9, 2026
Merged

Fix isReviewer in manage record menu#9271
josegar74 merged 2 commits into
geonetwork:mainfrom
tylerjmchugh:fix-isReviewer

Conversation

@tylerjmchugh
Copy link
Copy Markdown
Contributor

@tylerjmchugh tylerjmchugh commented May 7, 2026

Currently, the manage record menu initializes some record-dependent values in the template using ng-init.

This pattern already existed before #9254 which split the record actions menu into separate manage and download menus. However, that split changed the timing of when the manage menu template is created.

Before the split, the relevant menu content was still guarded inside the original template by an ng-if, so ng-init usually ran only after md had already been set. After the split, the manage menu is now its own directive and the template can be linked before the directive has finished setting its local md value.

As a result, the reviewer state can be initialized incorrectly. When logged in as a reviewer, the workflow step label key is built with the -editor suffix instead of -reviewer. Those translation/status keys do not exist for reviewer-only workflow steps, so the workflow actions are not displayed correctly. When logged in as an editor, the actions do not show, which is expected. When logged in as an administrator, the actions still show correctly because isReviewer is initialized correctly from user.isAdmin().
image

This PR aims to fix the regression introduced by the menu split by removing the record-dependent ng-init usage and calculating the reviewer state and workflow step label key from the current directive scope instead.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@ianwallen ianwallen added the bug label May 7, 2026
@ianwallen ianwallen added this to the 4.4.11 milestone May 7, 2026
Copy link
Copy Markdown
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

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

I see the following error in the Javascript console:

angular.js?v=54a909cc6308f9989690b07aedc2e7ead0fe849a:15697 TypeError: Cannot read properties of undefined (reading 'groupOwner')
    at scope.isReviewer (ToolbarDirective.js:329:78)
    at scope.getStatusEffects (ToolbarDirective.js:324:46)
    at scope.anyWorkflowOptionDisplayed (ToolbarDirective.js:313:39)

Complaints about scope.md.groupOwner in https://github.com/geonetwork/core-geonetwork/pull/9271/changes#diff-2a3359d9bd35129adf44d18ec994584f8e22dbfaf3e41dcb1b58cb87b47b1547R329

var isReviewer =
user.isAdmin() || user.isReviewerForGroup(scope.md.groupOwner);
return scope.statusEffects[isReviewer ? "reviewer" : "editor"];
scope.getStatusEffects = function () {
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.

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.

Fixed in latest push

@tylerjmchugh tylerjmchugh requested a review from josegar74 May 8, 2026 13:27
@josegar74 josegar74 merged commit d1334bd into geonetwork:main May 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants