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(server, web): unassign faces #9374

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

feat(server, web): unassign faces #9374

wants to merge 6 commits into from

Conversation

martabal
Copy link
Member

@martabal martabal commented May 10, 2024

Continuing #5511, using the UI proposed here

Copy link

cloudflare-pages bot commented May 10, 2024

Deploying immich with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0f6e665
Status: ✅  Deploy successful!
Preview URL: https://99410572.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
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
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.

None yet

2 participants