Skip to content

Commit a32b543

Browse files
committed
fix logic issue
1 parent b0df413 commit a32b543

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/SmartAlbums/BaseSmartAlbum.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,16 @@ public function photos(): Builder
108108
if (!Configs::getValueAsBool('SA_override_visibility')) {
109109
return $this->photo_query_policy
110110
->applySearchabilityFilter(query: $base_query, origin: null, include_nsfw: !Configs::getValueAsBool('hide_nsfw_in_smart_albums'))
111+
->when(
112+
Configs::getValueAsBool('enable_smart_album_per_owner') && Auth::check(),
113+
fn (Builder $query) => $query->where('photos.owner_id', '=', Auth::id())
114+
)
111115
->where($this->smart_photo_condition);
112116
}
113117

114118
// If the smart album visibility override is enabled, we do not need to apply any security filter, as all photos are visible
115119
// in this smart album. We still need to apply the smart album condition, though.
116120
return $this->photo_query_policy->applySensitivityFilter(query: $base_query, origin: null, include_nsfw: !Configs::getValueAsBool('hide_nsfw_in_smart_albums'))
117-
->when(Configs::getValueAsBool('enable_smart_album_per_owner') && Auth::check(), fn (Builder $query) => $query->where('photos.owner_id', '=', Auth::id()))
118121
->where($this->smart_photo_condition);
119122
}
120123

0 commit comments

Comments
 (0)