153 ror shared helper#159
Open
kosarko wants to merge 3 commits into
Open
Conversation
…eativework.publisher Follow-up cleanup on the ROR publisher support (PR #153): - Add buildAuthoritySearchFilter() in clarin-shared-util.ts and use it from getLinkToSearch (generic item field), the search-result box view, and loadItemAuthors, so the authority-vs-equals operator logic lives in one place. - Drop creativework.publisher from the CLARIN item view (untyped-item fields, the ROR icon condition and convertMetadataFieldIntoSearchType) so the item page and the search card agree on dc.publisher. Journal entity pages, which use the upstream ds-generic-item-page-field, are unaffected. - Add a clarin-generic-item-field spec covering getLinkToSearch branches and a unit test for the new helper.
There was a problem hiding this comment.
Pull request overview
This PR extracts repeated “authority vs equals” search-filter construction logic into a shared helper and updates components to use it, with accompanying unit tests to validate the new behavior.
Changes:
- Added
buildAuthoritySearchFilterhelper to centralize discovery filter query fragment generation (authority-aware). - Refactored author/publisher search-link creation to use the helper.
- Added unit tests for the helper and for
ClarinGenericItemFieldComponent.getLinkToSearch.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/app/shared/clarin-shared-util.ts | Introduces buildAuthoritySearchFilter and reuses it for author search links. |
| src/app/shared/clarin-shared-util.spec.ts | Adds unit coverage for buildAuthoritySearchFilter and convertMetadataFieldIntoSearchType. |
| src/app/shared/clarin-item-box-view/clarin-item-box-view.component.ts | Switches publisher search-link building to the shared helper and broadens publisher metadata lookup. |
| src/app/shared/clarin-item-box-view/clarin-item-box-view.component.html | Simplifies publisher link rendering (but currently introduces an async-initialization link issue). |
| src/app/item-page/simple/field-components/clarin-generic-item-field/clarin-generic-item-field.component.ts | Refactors search link creation to use the shared helper and handle explicit-value searches. |
| src/app/item-page/simple/field-components/clarin-generic-item-field/clarin-generic-item-field.component.spec.ts | Adds unit tests for authority vs equals link generation and edge cases. |
| <div *ngIf="isSearchResult" class="pt-1"> | ||
| <div class="font-weight-bold">{{ 'item.view.box.publisher.message' | translate }}</div> | ||
| <span>(<span *ngIf="itemPublisher != null"><a *ngIf="publisherRedirectLink" [href]="publisherRedirectLink">{{itemPublisher}} <img *ngIf="hasPublisherRorAuthority" src="assets/images/ror-icon.svg" alt="ROR ID" height="16" class="ml-1 align-middle"></a><span *ngIf="!publisherRedirectLink">{{itemPublisher}}</span> / </span>{{itemDate}})</span> | ||
| <span>(<span *ngIf="itemPublisher != null"><a [href]="publisherRedirectLink">{{itemPublisher}} <img *ngIf="hasPublisherRorAuthority" src="assets/images/ror-icon.svg" alt="ROR ID" height="16" class="ror-icon ml-1 align-middle"></a> / </span>{{itemDate}})</span> |
amadulhaxxani
approved these changes
Jun 30, 2026
Use [attr.href] instead of [href] so Angular omits the attribute while publisherRedirectLink is still undefined (before assignBaseUrl resolves), rendering the publisher as plain text until the URL is ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extracted the repeated code to a helper method
autogenerated tests