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

Moved MetadataValue methods to separate service #2875

Conversation

alexandrevryghem
Copy link
Member

References

Description

This creates a MetadataService similar to the backend service that can be used for metadata manipulation. By moving these methods out of the model classes we can prevent issues that happen when these classes are cloned (for example from SSR cache to CSR cache). I also chose to put it in a service instead of in a util class, since this easier to use services in the html templates.

Instructions for Reviewers

List of changes in this PR:

  • Renamed the current MetadataService to HeadTagService since it was not responsible for the metadata operations but only responsible for adding head tags. I also made all it's methods protected to make it easier to extend that class
  • Created a new MetadataService that can be used for metadata manipulation, this will be the equivalent of the backend metadata service

The best way to test this is by simply checking that everything that uses this new service still works

Checklist

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

… you HTML to HeadTagService & made its methods protected to make it easier to override them
…rvice-for-metadata-operations_contribute-main
@alexandrevryghem alexandrevryghem force-pushed the created-metadata-service-for-metadata-operations_contribute-main branch from 8e3d8ce to 548cc2d Compare March 22, 2024 15:19
@alanorth alanorth changed the title Moved MetadataValue methodes to separate service Moved MetadataValue methods to separate service Mar 26, 2024
Copy link

github-actions bot commented Apr 4, 2024

Hi @alexandrevryghem,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

…ions_contribute-main

# Conflicts:
#	src/app/core/metadata/metadata.service.spec.ts
#	src/modules/app/browser-init.service.ts
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @alexandrevryghem ! This looks good/correct. I tested it locally and the various <head> tags all still work and not noticing issues with metadata values either.

I am going to flag this as needs documentation as we may need to mention this change in the Release Notes, in case anyone has customized their <head> tags in the older metadata.service.ts, those changes need to move to the new head-tag.service.ts

@tdonohue tdonohue added the needs documentation PR is missing documentation. All new features and config changes require documentation. label May 8, 2024
@tdonohue tdonohue added this to the 8.0 milestone May 8, 2024
@tdonohue tdonohue merged commit ceca3bf into DSpace:main May 8, 2024
13 checks passed
@alexandrevryghem alexandrevryghem deleted the created-metadata-service-for-metadata-operations_contribute-main branch May 8, 2024 20:55
@tdonohue
Copy link
Member

@tdonohue tdonohue removed the needs documentation PR is missing documentation. All new features and config changes require documentation. label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Model classes should not contain any logic
2 participants