-
Notifications
You must be signed in to change notification settings - Fork 73
Add "ExcludedPeople" setting to filter out specific people from "People" results #561
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughAdds an ExcludedPeople list across settings, test fixtures, and config samples, and updates PeopleAssetsPool to load excluded people’s assets and filter them out from the final asset set returned by LoadAssets. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Pool as PeopleAssetsPool
participant Helper as LoadAssetsForPerson
participant API as AssetAPI
Client->>Pool: LoadAssets(accountSettings, filter)
Note over Pool: Iterate accountSettings.People
loop included people
Pool->>Helper: LoadAssetsForPerson(personId, ct)
Helper->>API: Fetch IMAGE assets (paged) with Exif & People
API-->>Helper: Page of assets
Helper-->>Pool: Accumulate assets
end
Note over Pool: Iterate accountSettings.ExcludedPeople
loop excluded people
Pool->>Helper: LoadAssetsForPerson(excludedPersonId, ct)
Helper->>API: Fetch IMAGE assets (paged) with Exif & People
API-->>Helper: Page of assets
Helper-->>Pool: Accumulate excluded assets
end
Note over Pool: Filter out excludedPersonAssets by Id (WhereExcludes)
Pool-->>Client: Return filtered assets
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ImmichFrame.Core/Logic/Pool/PeopleAssetsPool.cs`:
- Around line 49-53: In PeopleAssetsPool (file PeopleAssetsPool.cs) the
pagination uses while (total == batchSize) but should loop while the current
page returned a full batch; change the loop condition to check the returned item
count (e.g., personInfo.Assets.Items.Count == batchSize or lastPageCount ==
batchSize) and remove the unused total variable; ensure you continue
incrementing page and adding personInfo.Assets.Items to assets until a page
returns fewer than batchSize items.
🧹 Nitpick comments (1)
ImmichFrame.Core.Tests/Logic/Pool/PersonAssetsPoolTests.cs (1)
42-42: Consider adding tests for the exclusion behavior.The mock setup for
ExcludedPeopleis correct and mirrors theAlbumAssetsPoolTestspattern. However, there are no tests verifying that assets from excluded people are actually filtered out from the results.Consider adding test cases similar to
AlbumAssetsPoolTests.LoadAssets_NoIncludedAlbums_ReturnsEmpty(see relevant snippet at lines 73-84) to verify:
- Assets belonging to excluded people are removed from results
- Assets appearing in both included and excluded people are omitted
|
I'm surprised this was so simple. It has been awhile since I attempted this, but I thought there was an Immich API issue where something (albums maybe?) didn't include person info? |
You're right, there is a limitation with the Album results. The Issue with Albums on the Immich side:
The implication: When you call To clarify the intent of this PR, the |
Summary
Adds a new
ExcludedPeoplesetting that allows users to exclude specific Immich people IDs from the slideshow when using thePeoplefilter. This mirrors the existingExcludedAlbumsfunctionality.Use Case
When displaying photos of specific people (e.g., family members), users may want to exclude photos that also contain certain other people. For example:
[bob, suzy][bertha, joe]Changes
Core Implementation
ImmichFrame.Core/Interfaces/IServerSettings.cs- AddedExcludedPeopleproperty toIAccountSettingsinterfaceImmichFrame.WebApi/Models/ServerSettings.cs- AddedExcludedPeopleproperty toServerAccountSettingsImmichFrame.WebApi/Helpers/Config/ServerSettingsV1.cs- Added V1 backward compatibility supportImmichFrame.Core/Logic/Pool/PeopleAssetsPool.cs- Implemented exclusion logic following theAlbumAssetsPoolpattern:ExcludedPeoplePeopleWhereExcludes()Test Updates
ImmichFrame.Core.Tests/Logic/Pool/PersonAssetsPoolTests.cs- Added mock forExcludedPeopleImmichFrame.WebApi.Tests/Resources/TestV2.json- AddedExcludedPeopletest dataImmichFrame.WebApi.Tests/Resources/TestV2.yml- AddedExcludedPeopletest dataDocumentation/Examples
docker/Settings.example.json- AddedExcludedPeopleexampledocker/Settings.example.yml- AddedExcludedPeopleexampledocker/example.env- AddedExcludedPeopleenvironment variableExample Configuration