-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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): include pictures of shared albums on map #7439
feat(server, web): include pictures of shared albums on map #7439
Conversation
exifInfo: { | ||
latitude: Not(IsNull()), | ||
longitude: Not(IsNull()), | ||
where: [ |
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.
Is there a better way to write this OR expression?
WHERE (ownerID IN ... OR albumId IN ...) AND isVisible = ... AND isArchived = ... AND ...
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.
This looks really good. Thanks!
if (options.withPartners) { | ||
const partners = await this.partnerRepository.getAll(auth.user.id); | ||
const partnersIds = partners | ||
.filter((partner) => partner.sharedBy && partner.sharedWith && partner.sharedById != auth.user.id) | ||
.map((partner) => partner.sharedById); | ||
userIds.push(...partnersIds); | ||
} | ||
return this.assetRepository.getMapMarkers(userIds, options); | ||
if (options.withSharedAlbums) { | ||
const sharedAlbums = await this.albumRepository.getShared(auth.user.id); |
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.
This doesn't include the asset relation does it?
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.
I don't understand, where should I include the asset relation?
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.
Okay so Jason answered me on Discord about this:
https://discord.com/channels/979116623879368755/994044917355663450/1238973376349864108
Jason said: "Just want to make sure this is not loading the album AND all the assets for it"
I said: "If I understand correctly, you are asking if it is loading only the shared albums when figuring out what to show on the map, versus loding the shared albums and all the assets. And the problem with that is loading all the assets in the shared album takes more resources."
Jason responded: "Yup"
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.
yes, this function does not query all assets, only the albums:
immich/server/src/repositories/album.repository.ts
Lines 154 to 166 in f667c95
@GenerateSql({ params: [DummyValue.UUID] }) | |
async getShared(ownerId: string): Promise<AlbumEntity[]> { | |
const albums = await this.repository.find({ | |
relations: { albumUsers: { user: true }, sharedLinks: true, owner: true }, | |
where: [ | |
{ albumUsers: { userId: ownerId } }, | |
{ sharedLinks: { userId: ownerId } }, | |
{ ownerId, albumUsers: { user: Not(IsNull()) } }, | |
], | |
order: { createdAt: 'DESC' }, | |
}); | |
return albums.map((album) => withoutDeletedUsers(album)); |
@@ -31,4 +31,10 @@ export class MapMarkerDto { | |||
@IsBoolean() | |||
@Transform(toBoolean) | |||
withPartners?: boolean; | |||
|
|||
@ApiProperty() |
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.
This should not be needed
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.
👍
The class got moved to server/src/dtos/search.dto.ts
and doesn't have this annotation anymore.
isVisible: true, | ||
isArchived, | ||
exifInfo: { | ||
latitude: Not(IsNull()), | ||
longitude: Not(IsNull()), | ||
}, | ||
isFavorite, | ||
fileCreatedAt: OptionalBetween(fileCreatedAfter, fileCreatedBefore), |
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.
This section is repeated twice. Can you move it up to a variable?
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.
Good idea, done.
<SettingSwitch title="Include shared with me" bind:checked={settings.withPartners} /> | ||
<SettingSwitch title="Include shared albums" bind:checked={settings.withSharedAlbums} /> |
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.
Should we remember this other option so it is more obvious what the difference is?
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.
I renamed Include shared with me
to Include shared from partners
. Another option would be Include assets from partners
.
What do you think, which option sounds better? Or do you have other suggestions?
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.
I'm not Jason but I would suggest Include partner assets
or Include shared partner assets
. Also, this rename is important for clarity.
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.
I renamed it to Include shared partner assets
now, thanks for the suggestion @NicholasFlamy
@andreasgerstmayr You've requested a review from me but you haven't yet addressed @jrasm91 comments and there are also lots of merge conflicts right now...? |
hi @danieldietzler, sorry about that, must have been some automated process (it's showing up as 2:35 in the night), maybe because you're listed as a codeowner. No idea why it's happening now and not when I created the PR though. Sorry for the late response, I was on holiday for a couple of weeks and then didn't get time so far. |
Ah ok got it. No rush then :) |
I fixed the merge conflicts and implemented (most of) @jrasm91 suggestions now (except the one I didn't understand, see above). |
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.
LGTM, will let @jrasm91 take a look over it before we merge though
I fixed a tsc error caused by changes in main since the branch was created as well as a prettier error in web. The PR should now be good to merge |
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.
I updated this to include assets that are in shared albums where the user is the owner.
Good catch! I didn't think of that. Thank you for merging! :) |
This PR adds a new setting "Include shared albums" to the map settings, to includes pictures of albums shared with the current user on the map.
Related: #3176