Skip to content

Comments

refactor: star rating#26357

Open
meesfrensel wants to merge 5 commits intomainfrom
refactor/star-rating
Open

refactor: star rating#26357
meesfrensel wants to merge 5 commits intomainfrom
refactor/star-rating

Conversation

@meesfrensel
Copy link
Collaborator

@meesfrensel meesfrensel commented Feb 19, 2026

Description

Small refactor of the star rating system:

  • Add null to mean 'unrated'. 0 is not used anymore, metadata extract/write jobs convert from/to 0 to ensure proper values are saved.
  • Translation is updated to include special cases for -1 (rejected) and 0 (unrated).
  • Asset update endpoint converts 0 to null before passing through to the service.
  • Use mdi stars instead of custom svg
  • Search option & query chip is updated
  • Migration to convert all exif_info's rating=0 to rating=null

Fixes #26139

Changes to mobile app can be done separately because the server migrates to null and further changes with { rating: 0 } are auto transformed to null as well.

How Has This Been Tested?

  • Extra unit tests
  • Manually checked the correct xmp sidecar contents
  • Inspected API responses

API Changes

  • The search endpoint now accepts null as a rating filter
  • The asset update endpoints now accept null as a valid rating to write
    • rating: 0 is transformed to null
  • (the GET endpoints containing exifinfo already had number | null as the rating data type)

Please describe to which degree, if any, an LLM was used in creating this pull request.

None

@meesfrensel meesfrensel marked this pull request as ready for review February 19, 2026 21:35
@meesfrensel
Copy link
Collaborator Author

e2e test failures seem unrelated. The order of the faces is swapped?

@YarosMallorca
Copy link
Collaborator

YarosMallorca commented Feb 19, 2026

This is great, but needs coordination with the mobile app to be effective.
Will work on the mobile implementation in the coming days.

@meesfrensel
Copy link
Collaborator Author

@YarosMallorca I don't think it's required actually (but best of course). The rating could already be undefined for 'not set' which translates to null in the app right? And when updating the rating from the app, the request to PUT /api/assets/:id will auto transform the rating: 0 to null.

@YarosMallorca
Copy link
Collaborator

Oh yes, correct. Missed that it converts 0 to null. Then it's all fine! Actually, the mobile app can't send nulls apparently anyway.

Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

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

This looks great actually, thanks!

"rating": "Star rating",
"rating_clear": "Clear rating",
"rating_count": "{count, plural, one {# star} other {# stars}}",
"rating_count": "{count, plural, =-1 {Rejected} =0 {Unrated} one {# star} other {# stars}}",
Copy link
Member

Choose a reason for hiding this comment

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

What does "Rejected" even mean in this context? Usually it's rather bad to use a magic number like -1 to report such a state

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was introduced as being a valid exif rating in #15699. I can imagine using workflows or scripts you would use it to auto-archive assets, or when using an external tool to browse your library, etc. Unless you search for a rating and then explicitly change the url to use rating=-1, you'll never see that string.

Copy link
Member

Choose a reason for hiding this comment

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

We don't really see that use case. Could you update the PR to only support 1-5, and everything else becomes invalid (unrated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtering by 0 stars does not show unrated photos/videos

3 participants