fix(web): misleading toast notification - #30976
Open
brn-lin wants to merge 2 commits into
Open
Conversation
…tead of only having toastManager.primary() for all scenarios.
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.
Description
Fixes #30849, misleading toast notification.
When trying to add a picture from an album that was shared from a different user into your own album, the toast message would say "Success", but with an appropriate "Asset cannot be added to the album" message. This happened because toastManager.primary() was used for all scenarios, including scenarios where assets cannot be added to the album.
I added the appropriate toastManager method to each of the branches in the if/else statement, so that each scenario will trigger the appropriate toast along with the appropriate message.
How Has This Been Tested?
Since no test file for album.service.ts in the frontend web folder existed, I created one. The test file that I created only has tests for the part of the album.service.ts file that had the issue. The test suite tests that the appropriate toastManager method is called with the appropriate scenario.
In order to reproduce, just click on album.service.spec.ts and click the green check marks to run the tests yourself.
Screenshots
Before
After
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
I used ChatGPT to help me trace the bug through the codebase, and also to understand what was going on in this part of the codebase. I also used it to help me figure out what the root of the problem was. I also used it to generate a template test file, and then I manually fixed any errors and double checked it to make sure that it was testing things properly.