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

feat: unassign faces #9374

Closed
wants to merge 10 commits into from
Closed

feat: unassign faces #9374

wants to merge 10 commits into from

Conversation

martabal
Copy link
Member

@martabal martabal commented May 10, 2024

Continuing #5511, using the UI proposed here

Copy link

cloudflare-workers-and-pages bot commented May 10, 2024

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: e36b724
Status: ✅  Deploy successful!
Preview URL: https://cb4059a8.immich.pages.dev
Branch Preview URL: https://feat-unassign-faces.immich.pages.dev

View logs

@martabal martabal force-pushed the feat/unassign-faces branch 16 times, most recently from 7e7454a to 0c3a058 Compare May 11, 2024 16:53
@martabal martabal force-pushed the feat/unassign-faces branch from 0c3a058 to 7e9dcaa Compare May 11, 2024 17:52
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.

Server code looks pretty good, web is just always complex unfortunately :(


await expect(sut.unassignFace(authStub.admin, faceStub.face1.id)).resolves.toStrictEqual(
mapFaces(faceStub.unassignedFace, authStub.admin),
);
Copy link
Member

Choose a reason for hiding this comment

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

I think it would make sense to also expect some of the repo methods to have been called. Specifically that requirePermission gets called for PERSON_WRITE. Also, I would like to see a test without a personId, so that you don't run into that if but instead run into the createNewFeaturePhoto method. Basically try to cover the relevant branches.


await expect(
sut.unassignFaces(authStub.admin, { data: [{ assetId: faceStub.face1.id, personId: 'person-1' }] }),
).resolves.toStrictEqual([{ id: 'assetFaceId1', success: true }]);
Copy link
Member

Choose a reason for hiding this comment

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

Here as well, some branches remain untested.

Comment on lines +150 to +151
const changeFeaturePhoto: string[] = [];
const results: BulkIdResponseDto[] = [];
Copy link
Member

Choose a reason for hiding this comment

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

My OCD really likes that these two lines have the exact same length lmao

Copy link
Member

Choose a reason for hiding this comment

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

They just line up so perfectly!

Copy link
Member Author

Choose a reason for hiding this comment

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

What's the problem with it ?

Copy link
Member

Choose a reason for hiding this comment

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

Oh nothing, I was just happy about that lol

Copy link
Member

Choose a reason for hiding this comment

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

That was a positive comment :D

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh damn, I just saw it. Satisfying 😄

web/src/lib/components/faces-page/person-side-panel.svelte Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

The html in here is pretty complex (deeply nested, many branches, etc). I'm not really sure how to properly fix this? Maybe it's just a general issue of the page structure? Maybe sub-components could help as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure either, maybe I chose the wrong way to do this

web/src/lib/utils/people-utils.ts Outdated Show resolved Hide resolved
Comment on lines -46 to +51
people?: PersonWithFacesResponseDto[];
people?: PeopleWithFacesResponseDto;
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change! I'm not really sure how to handle this case, as it isn't covered by the PropertyLifecycle idea. The proper approach would probably be to introduce a new variable? Interested for @jrasm91 opinion on this though.

Copy link
Member Author

@martabal martabal May 11, 2024

Choose a reason for hiding this comment

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

Yep that's a breaking change. It's fine to have another variable, but I prefer to have everything in people.

Another simple fix would be to send all faces: currently we only filter faces associated with a person. But I prefer to represent faces/people like that:

  "people": {
    "visiblePeople": [
      {
        "birthDate": null,
        "id": "b70e6b20-2dce-4184-aa20-dac1c9717a16",
        "isHidden": false,
        "name": "Test Person",
        "thumbnailPath": "thumbnail.jpg",
        "faces": [
          {
            "id": "ef8c6a56-2891-424b-a521-11c673e9bfd3",
            "imageHeight": 1440,
            "imageWidth": 1920,
            "boundingBoxX1": 1494,
            "boundingBoxX2": 1705,
            "boundingBoxY1": 430,
            "boundingBoxY2": 733
          }
        ]
      }
    ],
    "numberOfFaces": 2
  }

@martabal martabal force-pushed the feat/unassign-faces branch 3 times, most recently from 5c42546 to ff865e3 Compare May 12, 2024 10:48
@martabal martabal force-pushed the feat/unassign-faces branch from ff865e3 to 8f683f8 Compare May 12, 2024 12:31
@martabal martabal force-pushed the feat/unassign-faces branch from 8f683f8 to 0f6e665 Compare May 12, 2024 15:25
@martabal martabal changed the title feat(server, web): unassign faces feat(server): unassign faces May 26, 2024
@martabal martabal changed the title feat(server): unassign faces feat: unassign faces May 26, 2024
@Gorbush
Copy link

Gorbush commented Dec 29, 2024

Hi. Any updates on this feature?
I just discovered you this project and working on my 700K library...
Would really appreciate this feature implemented.
If you have no time - please ping me your vision - I might help.

@alextran1502
Copy link
Contributor

Stale

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.

4 participants