mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 21:25:19 +02:00
Refactor location handling in Immich integration components for consistency
This commit is contained in:
parent
1f94b39b27
commit
10418f85cc
3 changed files with 8 additions and 8 deletions
|
@ -297,7 +297,7 @@ class ImmichIntegrationView(viewsets.ViewSet):
|
|||
is_authorized = True
|
||||
|
||||
# Level 3: Owner access
|
||||
elif request.user.is_authenticated and request.user.id == owner_id:
|
||||
elif request.user.is_authenticated and request.user == owner_id:
|
||||
is_authorized = True
|
||||
|
||||
# Level 4: Shared collection access - check if user has access to any collection
|
||||
|
@ -314,7 +314,7 @@ class ImmichIntegrationView(viewsets.ViewSet):
|
|||
}, status=status.HTTP_403_FORBIDDEN)
|
||||
else:
|
||||
# No LocationImage exists; allow only the integration owner
|
||||
if not request.user.is_authenticated or request.user.id != owner_id:
|
||||
if not request.user.is_authenticated or request.user != owner_id:
|
||||
return Response({
|
||||
'message': 'Image is not linked to any location and you are not the owner.',
|
||||
'error': True,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
let immichNextURL: string = '';
|
||||
let loading = false;
|
||||
|
||||
export let adventure: Location | null = null;
|
||||
export let location: Location | null = null;
|
||||
export let copyImmichLocally: boolean = false;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
@ -21,7 +21,7 @@
|
|||
let currentAlbum: string = '';
|
||||
|
||||
let selectedDate: string =
|
||||
(adventure as Location | null)?.visits
|
||||
(location as Location | null)?.visits
|
||||
.map((v) => new Date(v.end_date || v.start_date))
|
||||
.sort((a, b) => +b - +a)[0]
|
||||
?.toISOString()
|
||||
|
@ -57,8 +57,8 @@
|
|||
}
|
||||
|
||||
async function saveImmichRemoteUrl(imageId: string) {
|
||||
if (!adventure) {
|
||||
console.error('No adventure provided to save the image URL');
|
||||
if (!location) {
|
||||
console.error('No location provided to save the image URL');
|
||||
return;
|
||||
}
|
||||
let res = await fetch('/api/images', {
|
||||
|
@ -68,7 +68,7 @@
|
|||
},
|
||||
body: JSON.stringify({
|
||||
immich_id: imageId,
|
||||
adventure: adventure.id
|
||||
location: location.id
|
||||
})
|
||||
});
|
||||
if (res.ok) {
|
||||
|
|
|
@ -847,7 +847,7 @@
|
|||
|
||||
{#if immichIntegration}
|
||||
<ImmichSelect
|
||||
adventure={location}
|
||||
{location}
|
||||
on:fetchImage={(e) => {
|
||||
url = e.detail;
|
||||
fetchImage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue