diff --git a/app/Actions/Album/SetProtectionPolicy.php b/app/Actions/Album/SetProtectionPolicy.php index d94322567cf..a3f1bf0a11d 100644 --- a/app/Actions/Album/SetProtectionPolicy.php +++ b/app/Actions/Album/SetProtectionPolicy.php @@ -62,8 +62,5 @@ public function do(BaseAlbum $album, AlbumProtectionPolicy $protectionPolicy, bo } $active_permissions->base_album_id = $album->id; $active_permissions->save(); - - // Reset permissions for photos - $album->photos()->update(['photos.is_public' => false]); } } diff --git a/app/Actions/Photo/Create.php b/app/Actions/Photo/Create.php index a8d59de8c3f..042f795e14b 100644 --- a/app/Actions/Photo/Create.php +++ b/app/Actions/Photo/Create.php @@ -25,7 +25,6 @@ use App\Models\Album; use App\Models\Photo; use App\SmartAlbums\BaseSmartAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\StarredAlbum; use Illuminate\Database\Eloquent\ModelNotFoundException; use function Safe\filemtime; @@ -214,9 +213,7 @@ protected function initParentAlbum(?AbstractAlbum $album = null): void $this->strategyParameters->album = $album; } elseif ($album instanceof BaseSmartAlbum) { $this->strategyParameters->album = null; - if ($album instanceof PublicAlbum) { - $this->strategyParameters->is_public = true; - } elseif ($album instanceof StarredAlbum) { + if ($album instanceof StarredAlbum) { $this->strategyParameters->is_starred = true; } } else { diff --git a/app/Actions/Photo/Strategies/AddDuplicateStrategy.php b/app/Actions/Photo/Strategies/AddDuplicateStrategy.php index 338ee5908a5..f9c9db8b222 100644 --- a/app/Actions/Photo/Strategies/AddDuplicateStrategy.php +++ b/app/Actions/Photo/Strategies/AddDuplicateStrategy.php @@ -48,7 +48,6 @@ public function do(): Photo $existing = $this->photo; $this->photo = $existing->replicate(); // Adopt settings of duplicated photo acc. to target album - $this->photo->is_public = $this->parameters->is_public; $this->photo->is_starred = $this->parameters->is_starred; $this->setParentAndOwnership(); $this->photo->save(); diff --git a/app/Actions/Photo/Strategies/AddStandaloneStrategy.php b/app/Actions/Photo/Strategies/AddStandaloneStrategy.php index bb960e342e7..da61f6ad478 100644 --- a/app/Actions/Photo/Strategies/AddStandaloneStrategy.php +++ b/app/Actions/Photo/Strategies/AddStandaloneStrategy.php @@ -72,7 +72,6 @@ public function do(): Photo { // Create and save "bare" photo object without size variants $this->hydrateMetadata(); - $this->photo->is_public = $this->parameters->is_public; $this->photo->is_starred = $this->parameters->is_starred; $this->setParentAndOwnership(); diff --git a/app/Actions/Photo/Strategies/AddStrategyParameters.php b/app/Actions/Photo/Strategies/AddStrategyParameters.php index d4a4f3f021c..525127ee205 100644 --- a/app/Actions/Photo/Strategies/AddStrategyParameters.php +++ b/app/Actions/Photo/Strategies/AddStrategyParameters.php @@ -15,9 +15,6 @@ class AddStrategyParameters /** @var Album|null the intended parent album */ public ?Album $album = null; - /** @var bool indicates whether the new photo shall be public */ - public bool $is_public = false; - /** @var bool indicates whether the new photo shall be starred */ public bool $is_starred = false; diff --git a/app/Enum/ColumnSortingPhotoType.php b/app/Enum/ColumnSortingPhotoType.php index 8cb61401f93..b29b4e15fcf 100644 --- a/app/Enum/ColumnSortingPhotoType.php +++ b/app/Enum/ColumnSortingPhotoType.php @@ -17,7 +17,6 @@ enum ColumnSortingPhotoType: string case CREATED_AT = 'created_at'; case TITLE = 'title'; case DESCRIPTION = 'description'; - case IS_PUBLIC = 'is_public'; case TAKEN_AT = 'taken_at'; case IS_STARRED = 'is_starred'; @@ -46,7 +45,6 @@ public static function localized(): array self::TAKEN_AT->value => __('lychee.SORT_PHOTO_SELECT_2'), self::TITLE->value => __('lychee.SORT_PHOTO_SELECT_3'), self::DESCRIPTION->value => __('lychee.SORT_PHOTO_SELECT_4'), - self::IS_PUBLIC->value => __('lychee.SORT_PHOTO_SELECT_5'), self::IS_STARRED->value => __('lychee.SORT_PHOTO_SELECT_6'), self::TYPE->value => __('lychee.SORT_PHOTO_SELECT_7'), ]; diff --git a/app/Enum/ColumnSortingType.php b/app/Enum/ColumnSortingType.php index c4a7d0a7293..c23a29d1f5f 100644 --- a/app/Enum/ColumnSortingType.php +++ b/app/Enum/ColumnSortingType.php @@ -13,7 +13,6 @@ enum ColumnSortingType: string case CREATED_AT = 'created_at'; case TITLE = 'title'; case DESCRIPTION = 'description'; - case IS_PUBLIC = 'is_public'; // from albums case MIN_TAKEN_AT = 'min_taken_at'; diff --git a/app/Enum/SmartAlbumType.php b/app/Enum/SmartAlbumType.php index db68bad4799..96688d66dd1 100644 --- a/app/Enum/SmartAlbumType.php +++ b/app/Enum/SmartAlbumType.php @@ -12,7 +12,6 @@ enum SmartAlbumType: string use DecorateBackedEnum; case UNSORTED = 'unsorted'; - case PUBLIC = 'public'; case STARRED = 'starred'; case RECENT = 'recent'; case ON_THIS_DAY = 'on_this_day'; diff --git a/app/Factories/AlbumFactory.php b/app/Factories/AlbumFactory.php index 11a0bc3a0e7..c8f4f1ffa1a 100644 --- a/app/Factories/AlbumFactory.php +++ b/app/Factories/AlbumFactory.php @@ -12,7 +12,6 @@ use App\Models\TagAlbum; use App\SmartAlbums\BaseSmartAlbum; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -24,7 +23,6 @@ class AlbumFactory public const BUILTIN_SMARTS_CLASS = [ SmartAlbumType::UNSORTED->value => UnsortedAlbum::class, SmartAlbumType::STARRED->value => StarredAlbum::class, - SmartAlbumType::PUBLIC->value => PublicAlbum::class, SmartAlbumType::RECENT->value => RecentAlbum::class, SmartAlbumType::ON_THIS_DAY->value => OnThisDayAlbum::class, ]; diff --git a/app/Http/Controllers/PhotoController.php b/app/Http/Controllers/PhotoController.php index 49136eb4727..55d2081d8fc 100644 --- a/app/Http/Controllers/PhotoController.php +++ b/app/Http/Controllers/PhotoController.php @@ -20,7 +20,6 @@ use App\Http\Requests\Photo\MovePhotosRequest; use App\Http\Requests\Photo\SetPhotoDescriptionRequest; use App\Http\Requests\Photo\SetPhotoLicenseRequest; -use App\Http\Requests\Photo\SetPhotoPublicRequest; use App\Http\Requests\Photo\SetPhotosStarredRequest; use App\Http\Requests\Photo\SetPhotosTagsRequest; use App\Http\Requests\Photo\SetPhotosTitleRequest; @@ -202,26 +201,6 @@ public function setDescription(SetPhotoDescriptionRequest $request): void $request->photo()->save(); } - /** - * Sets the `is_public` attribute of the given photo. - * - * We do not advise the use of this and would rather see people use albums - * visibility. - * This would highly simplify the code if we remove this. - * Do we really want to keep it ? - * - * @param SetPhotoPublicRequest $request - * - * @return void - * - * @throws LycheeException - */ - public function setPublic(SetPhotoPublicRequest $request): void - { - $request->photo()->is_public = $request->isPublic(); - $request->photo()->save(); - } - /** * Set the tags of a photo. * diff --git a/app/Http/Requests/Photo/SetPhotoPublicRequest.php b/app/Http/Requests/Photo/SetPhotoPublicRequest.php deleted file mode 100644 index 477fa720ceb..00000000000 --- a/app/Http/Requests/Photo/SetPhotoPublicRequest.php +++ /dev/null @@ -1,46 +0,0 @@ -photo = Photo::query()->findOrFail($photoID); - $this->isPublic = static::toBoolean($values[RequestAttribute::IS_PUBLIC_ATTRIBUTE]); - } - - public function isPublic(): bool - { - return $this->isPublic; - } -} diff --git a/app/Http/Resources/Models/PhotoResource.php b/app/Http/Resources/Models/PhotoResource.php index 6cb43408557..ebc98cab200 100644 --- a/app/Http/Resources/Models/PhotoResource.php +++ b/app/Http/Resources/Models/PhotoResource.php @@ -70,7 +70,6 @@ public function toArray($request) 'description' => $this->resource->description, 'focal' => $this->resource->focal, 'img_direction' => null, - 'is_public' => $this->resource->is_public, // TO BE REMOVED LATER 'is_starred' => $this->resource->is_starred, 'iso' => $this->resource->iso, 'latitude' => $this->resource->latitude, diff --git a/app/Http/RuleSets/Photo/SetPhotoPublicRuleSet.php b/app/Http/RuleSets/Photo/SetPhotoPublicRuleSet.php deleted file mode 100644 index 608c0d131c8..00000000000 --- a/app/Http/RuleSets/Photo/SetPhotoPublicRuleSet.php +++ /dev/null @@ -1,26 +0,0 @@ - ['required', new RandomIDRule(false)], - RequestAttribute::IS_PUBLIC_ATTRIBUTE => 'required|boolean', - ]; - } -} diff --git a/app/Livewire/Components/Pages/Gallery/Albums.php b/app/Livewire/Components/Pages/Gallery/Albums.php index e784170126a..982b37420ee 100644 --- a/app/Livewire/Components/Pages/Gallery/Albums.php +++ b/app/Livewire/Components/Pages/Gallery/Albums.php @@ -5,7 +5,6 @@ use App\Actions\Albums\Top; use App\Contracts\Livewire\Reloadable; use App\Contracts\Models\AbstractAlbum; -use App\Enum\SmartAlbumType; use App\Factories\AlbumFactory; use App\Http\Resources\Collections\TopAlbumsResource; use App\Livewire\DTO\AlbumRights; @@ -85,7 +84,6 @@ public function getSmartAlbumsProperty(): Collection { return $this->topAlbums->smart_albums // We filter out the public one (we don't remove it completely to not break the other front-end). - ->filter(fn (AbstractAlbum $e, $k) => $e->id !== SmartAlbumType::PUBLIC->value) ->concat($this->topAlbums->tag_albums) ->reject(fn ($album) => $album === null); } diff --git a/app/Models/Builders/AlbumBuilder.php b/app/Models/Builders/AlbumBuilder.php index f9343010fcc..d7d6b1aa86b 100644 --- a/app/Models/Builders/AlbumBuilder.php +++ b/app/Models/Builders/AlbumBuilder.php @@ -262,7 +262,6 @@ private function applyVisibilityConditioOnPhotos(Builder $countQuery, AlbumQuery ->orWhere('base_albums.owner_id', '=', $userID) ->orWhere('p.owner_id', '=', $userID) ); - $query2->orWhere('p.is_public', '=', true); }; return $countQuery->where($visibilitySubQuery); diff --git a/app/Models/Photo.php b/app/Models/Photo.php index 23d0ee7c501..bdefe2a72d4 100644 --- a/app/Models/Photo.php +++ b/app/Models/Photo.php @@ -39,7 +39,6 @@ * @property string $title * @property string|null $description * @property string[] $tags - * @property bool $is_public * @property int $owner_id * @property string|null $type * @property string|null $iso @@ -94,7 +93,6 @@ * @method static PhotoBuilder|Photo whereId($value) * @method static PhotoBuilder|Photo whereImgDirection($value) * @method static PhotoBuilder|Photo whereIn(string $column, string $values, string $boolean = 'and', string $not = false) - * @method static PhotoBuilder|Photo whereIsPublic($value) * @method static PhotoBuilder|Photo whereIsStarred($value) * @method static PhotoBuilder|Photo whereIso($value) * @method static PhotoBuilder|Photo whereLatitude($value) @@ -152,7 +150,6 @@ class Photo extends Model 'live_photo_url' => MustNotSetCast::class . ':live_photo_short_path', 'owner_id' => 'integer', 'is_starred' => 'boolean', - 'is_public' => 'boolean', 'tags' => ArrayCast::class, 'latitude' => 'float', 'longitude' => 'float', diff --git a/app/Policies/PhotoPolicy.php b/app/Policies/PhotoPolicy.php index b92ed979f17..48d91deb642 100644 --- a/app/Policies/PhotoPolicy.php +++ b/app/Policies/PhotoPolicy.php @@ -60,11 +60,6 @@ public function canSee(?User $user, Photo $photo): bool return true; } - // TODO: to be removed once migrated to v5. - if ($photo->is_public) { - return true; - } - return $photo->album !== null && $this->albumPolicy->canAccess($user, $photo->album); } diff --git a/app/Policies/PhotoQueryPolicy.php b/app/Policies/PhotoQueryPolicy.php index 3edec3031ca..133fab468b3 100644 --- a/app/Policies/PhotoQueryPolicy.php +++ b/app/Policies/PhotoQueryPolicy.php @@ -56,7 +56,6 @@ public function applyVisibilityFilter(FixedQueryBuilder $query): FixedQueryBuild // "OR"-clause. $visibilitySubQuery = function (FixedQueryBuilder $query2) use ($userId) { $this->albumQueryPolicy->appendAccessibilityConditions($query2->getQuery()); - $query2->orWhere('photos.is_public', '=', true); if ($userId !== null) { $query2->orWhere('photos.owner_id', '=', $userId); } diff --git a/app/SmartAlbums/PublicAlbum.php b/app/SmartAlbums/PublicAlbum.php deleted file mode 100644 index b494ef1126c..00000000000 --- a/app/SmartAlbums/PublicAlbum.php +++ /dev/null @@ -1,57 +0,0 @@ -value; - - /** - * Constructor. - * - * Note that the condition only includes photos which are explicitly made - * public, but does not include photos which are public due to being part - * of a public album. - * **This is intended behaviour!** - * See description of the whole class {@link PublicAlbum} for an - * explanation. - * - * @throws ConfigurationKeyMissingException - * @throws FrameworkException - */ - protected function __construct() - { - parent::__construct( - SmartAlbumType::PUBLIC, - fn (Builder $q) => $q->where('photos.is_public', '=', true) - ); - } - - public static function getInstance(): self - { - return self::$instance ??= new self(); - } -} diff --git a/database/factories/PhotoFactory.php b/database/factories/PhotoFactory.php index ebd1c46f66e..ae2f8384cfe 100644 --- a/database/factories/PhotoFactory.php +++ b/database/factories/PhotoFactory.php @@ -35,7 +35,6 @@ public function definition(): array 'title' => 'CR_' . fake()->numerify('####'), 'description' => null, 'tags' => '', - 'is_public' => false, 'owner_id' => 1, 'type' => 'image/jpeg', 'iso' => '100', diff --git a/database/migrations/2024_01_23_192800_remove_is_public_photo_sorting.php b/database/migrations/2024_01_23_192800_remove_is_public_photo_sorting.php new file mode 100644 index 00000000000..524a57db998 --- /dev/null +++ b/database/migrations/2024_01_23_192800_remove_is_public_photo_sorting.php @@ -0,0 +1,23 @@ +where('key', '=', 'sorting_photos_col')->where('value', '=', 'is_public')->update(['value' => 'taken_at']); + DB::table('configs')->where('key', '=', 'sorting_photos_col')->update(['type_range' => 'created_at|taken_at|title|description|is_starred|type']); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + DB::table('configs')->where('key', '=', 'sorting_photos_col')->update(['type_range' => 'created_at|taken_at|title|description|is_public|is_starred|type']); + } +}; diff --git a/database/migrations/2024_01_23_192814_remove_keys_and_column.php b/database/migrations/2024_01_23_192814_remove_keys_and_column.php new file mode 100644 index 00000000000..db603703606 --- /dev/null +++ b/database/migrations/2024_01_23_192814_remove_keys_and_column.php @@ -0,0 +1,63 @@ +getConnection(); + $this->schemaManager = $connection->getDoctrineSchemaManager(); + } + + /** + * Run the migrations. + */ + public function up(): void + { + Schema::table(self::TABLE, function (Blueprint $table) { + $this->dropIndexIfExists($table, 'photos_album_id_is_public_index'); + $this->dropIndexIfExists($table, 'photos_album_id_is_starred_is_public_index'); + }); + Schema::disableForeignKeyConstraints(); + Schema::table(self::TABLE, function (Blueprint $table) { + $table->dropColumn(self::COLUMN); + }); + Schema::enableForeignKeyConstraints(); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table(self::TABLE, function ($table) { + $table->boolean(self::COLUMN)->nullable(false)->default(false); + }); + Schema::table(self::TABLE, function (Blueprint $table) { + $table->index(['album_id', self::COLUMN]); + $table->index(['album_id', 'is_starred', self::COLUMN]); + }); + } + + /** + * A helper function that allows to drop an index if exists. + * + * @param Blueprint $table + * @param string $indexName + */ + private function dropIndexIfExists(Blueprint $table, string $indexName): void + { + $doctrineTable = $this->schemaManager->introspectTable($table->getTable()); + if ($doctrineTable->hasIndex($indexName)) { + $table->dropIndex($indexName); + } + } +}; diff --git a/lang/cz/lychee.php b/lang/cz/lychee.php index c2801e084a4..3c251af51a8 100644 --- a/lang/cz/lychee.php +++ b/lang/cz/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Data záznamu', 'SORT_PHOTO_SELECT_3' => 'Názvu', 'SORT_PHOTO_SELECT_4' => 'Popisu', - 'SORT_PHOTO_SELECT_5' => 'Stavu zveřejnění', 'SORT_PHOTO_SELECT_6' => 'Oblíbenosti', 'SORT_PHOTO_SELECT_7' => 'Formátu', diff --git a/lang/de/lychee.php b/lang/de/lychee.php index 6c7c4a798bb..80a671c7e2b 100644 --- a/lang/de/lychee.php +++ b/lang/de/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Aufnahmedatum', 'SORT_PHOTO_SELECT_3' => 'Titel', 'SORT_PHOTO_SELECT_4' => 'Beschreibung', - 'SORT_PHOTO_SELECT_5' => 'Öffentlich', 'SORT_PHOTO_SELECT_6' => 'Favorit', 'SORT_PHOTO_SELECT_7' => 'Fotoformat', diff --git a/lang/el/lychee.php b/lang/el/lychee.php index d0adfa0e13d..1699d497126 100644 --- a/lang/el/lychee.php +++ b/lang/el/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Ημερομηνία Λήψης', 'SORT_PHOTO_SELECT_3' => 'Τίτλος', 'SORT_PHOTO_SELECT_4' => 'Περιγραφή', - 'SORT_PHOTO_SELECT_5' => 'Δημόσιο', 'SORT_PHOTO_SELECT_6' => 'Αστέρια', 'SORT_PHOTO_SELECT_7' => 'Μορφή Φωτογραφίας', diff --git a/lang/en/lychee.php b/lang/en/lychee.php index beed9765719..da371a5f6c3 100644 --- a/lang/en/lychee.php +++ b/lang/en/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Take Date', 'SORT_PHOTO_SELECT_3' => 'Title', 'SORT_PHOTO_SELECT_4' => 'Description', - 'SORT_PHOTO_SELECT_5' => 'Public', 'SORT_PHOTO_SELECT_6' => 'Star', 'SORT_PHOTO_SELECT_7' => 'Photo Format', diff --git a/lang/es/lychee.php b/lang/es/lychee.php index d623fda6d1a..257883ce766 100644 --- a/lang/es/lychee.php +++ b/lang/es/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Fecha Realización', 'SORT_PHOTO_SELECT_3' => 'Título', 'SORT_PHOTO_SELECT_4' => 'Descripción', - 'SORT_PHOTO_SELECT_5' => 'Público', 'SORT_PHOTO_SELECT_6' => 'Estrella', 'SORT_PHOTO_SELECT_7' => 'Formato de foto', diff --git a/lang/fr/lychee.php b/lang/fr/lychee.php index 38f229ef131..b19c563f655 100644 --- a/lang/fr/lychee.php +++ b/lang/fr/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Date de prise de vue', 'SORT_PHOTO_SELECT_3' => 'Titre', 'SORT_PHOTO_SELECT_4' => 'Description', - 'SORT_PHOTO_SELECT_5' => 'Public', 'SORT_PHOTO_SELECT_6' => 'Favoris', 'SORT_PHOTO_SELECT_7' => 'Format de la photo', diff --git a/lang/hu/lychee.php b/lang/hu/lychee.php index 676d6f22462..2fd8f320bd3 100644 --- a/lang/hu/lychee.php +++ b/lang/hu/lychee.php @@ -348,7 +348,6 @@ 'SORT_PHOTO_SELECT_2' => 'Felvétel dátuma', 'SORT_PHOTO_SELECT_3' => 'Cím', 'SORT_PHOTO_SELECT_4' => 'Leírás', - 'SORT_PHOTO_SELECT_5' => 'Nyilvános', 'SORT_PHOTO_SELECT_6' => 'Csillag', 'SORT_PHOTO_SELECT_7' => 'Fénykép formátuma', diff --git a/lang/it/lychee.php b/lang/it/lychee.php index 1b4dd9692c4..905bce5f5bf 100644 --- a/lang/it/lychee.php +++ b/lang/it/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Data di Creazione', 'SORT_PHOTO_SELECT_3' => 'Titolo', 'SORT_PHOTO_SELECT_4' => 'Descrizione', - 'SORT_PHOTO_SELECT_5' => 'Pubblico', 'SORT_PHOTO_SELECT_6' => 'Speciale', 'SORT_PHOTO_SELECT_7' => 'Formato Photo', diff --git a/lang/nl/lychee.php b/lang/nl/lychee.php index f55ebba4dac..ddd10feead6 100644 --- a/lang/nl/lychee.php +++ b/lang/nl/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Aangemaakt op', 'SORT_PHOTO_SELECT_3' => 'Titel', 'SORT_PHOTO_SELECT_4' => 'Omschrijving', - 'SORT_PHOTO_SELECT_5' => 'Publiekelijk', 'SORT_PHOTO_SELECT_6' => 'Ster', 'SORT_PHOTO_SELECT_7' => 'Foto formaat', diff --git a/lang/no/lychee.php b/lang/no/lychee.php index 6bb7b891f24..abe78875b2a 100644 --- a/lang/no/lychee.php +++ b/lang/no/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Fangsdato', 'SORT_PHOTO_SELECT_3' => 'Tittel', 'SORT_PHOTO_SELECT_4' => 'Beskrivelse', - 'SORT_PHOTO_SELECT_5' => 'Offentlig', 'SORT_PHOTO_SELECT_6' => 'Stjernemerk', 'SORT_PHOTO_SELECT_7' => 'Bildeformat', diff --git a/lang/pl/lychee.php b/lang/pl/lychee.php index 16b258d3c2f..9df52cbc339 100644 --- a/lang/pl/lychee.php +++ b/lang/pl/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Take Date', 'SORT_PHOTO_SELECT_3' => 'tytuł', 'SORT_PHOTO_SELECT_4' => 'opis', - 'SORT_PHOTO_SELECT_5' => 'publiczny', 'SORT_PHOTO_SELECT_6' => 'oznaczony', 'SORT_PHOTO_SELECT_7' => 'format', diff --git a/lang/pt/lychee.php b/lang/pt/lychee.php index 9c7c378fe36..37e4246660b 100644 --- a/lang/pt/lychee.php +++ b/lang/pt/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Data de Modificação', 'SORT_PHOTO_SELECT_3' => 'Título', 'SORT_PHOTO_SELECT_4' => 'Descrição', - 'SORT_PHOTO_SELECT_5' => 'Público', 'SORT_PHOTO_SELECT_6' => 'Favorito', 'SORT_PHOTO_SELECT_7' => 'Formato da Fotografia', diff --git a/lang/ru/lychee.php b/lang/ru/lychee.php index 460ffca37d4..875cb75a2bf 100644 --- a/lang/ru/lychee.php +++ b/lang/ru/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'съёмки', 'SORT_PHOTO_SELECT_3' => 'заголовка', 'SORT_PHOTO_SELECT_4' => 'описания', - 'SORT_PHOTO_SELECT_5' => 'доступности', 'SORT_PHOTO_SELECT_6' => 'отметки', 'SORT_PHOTO_SELECT_7' => 'формата', diff --git a/lang/sk/lychee.php b/lang/sk/lychee.php index b2dfc03f0eb..b11c3f467b7 100644 --- a/lang/sk/lychee.php +++ b/lang/sk/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'čas snímku', 'SORT_PHOTO_SELECT_3' => 'Titul', 'SORT_PHOTO_SELECT_4' => 'Popis', - 'SORT_PHOTO_SELECT_5' => 'Verejný', 'SORT_PHOTO_SELECT_6' => 'Obľúbený', 'SORT_PHOTO_SELECT_7' => 'Formát', diff --git a/lang/sv/lychee.php b/lang/sv/lychee.php index 6fa9a1b39ec..d99ca9ebb35 100644 --- a/lang/sv/lychee.php +++ b/lang/sv/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Fotograferingsdatum', 'SORT_PHOTO_SELECT_3' => 'Titel', 'SORT_PHOTO_SELECT_4' => 'Beskrivning', - 'SORT_PHOTO_SELECT_5' => 'Publikt', 'SORT_PHOTO_SELECT_6' => 'Stjärnmärkning', 'SORT_PHOTO_SELECT_7' => 'Bildformat', diff --git a/lang/vi/lychee.php b/lang/vi/lychee.php index de2a7711db8..d606354eb3c 100644 --- a/lang/vi/lychee.php +++ b/lang/vi/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => 'Ngày chụp', 'SORT_PHOTO_SELECT_3' => 'Tên', 'SORT_PHOTO_SELECT_4' => 'Mô tả', - 'SORT_PHOTO_SELECT_5' => 'Chia sẻ công cộng', 'SORT_PHOTO_SELECT_6' => 'Được đánh dấu sao', 'SORT_PHOTO_SELECT_7' => 'Định dạng hình ảnh', diff --git a/lang/zh_CN/lychee.php b/lang/zh_CN/lychee.php index f901b154967..8072e5df708 100644 --- a/lang/zh_CN/lychee.php +++ b/lang/zh_CN/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => '创建时间', 'SORT_PHOTO_SELECT_3' => '标题', 'SORT_PHOTO_SELECT_4' => '描述', - 'SORT_PHOTO_SELECT_5' => '公开', 'SORT_PHOTO_SELECT_6' => '喜欢', 'SORT_PHOTO_SELECT_7' => '照片格式', diff --git a/lang/zh_TW/lychee.php b/lang/zh_TW/lychee.php index 3011a519e4d..963d56e299b 100644 --- a/lang/zh_TW/lychee.php +++ b/lang/zh_TW/lychee.php @@ -350,7 +350,6 @@ 'SORT_PHOTO_SELECT_2' => '創建時間', 'SORT_PHOTO_SELECT_3' => '標題', 'SORT_PHOTO_SELECT_4' => '描述', - 'SORT_PHOTO_SELECT_5' => '公開', 'SORT_PHOTO_SELECT_6' => '喜歡', 'SORT_PHOTO_SELECT_7' => '照片格式', diff --git a/phpstan.neon b/phpstan.neon index 6ac812e628f..7df223585b0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -47,7 +47,6 @@ parameters: - '#Dynamic call to static method (Illuminate\\Database\\Query\\Builder|Illuminate\\Database\\Eloquent\\(Builder|Relations\\.*)|App\\Models\\Builders\\.*|App\\Eloquent\\FixedQueryBuilder)(<.*>)?::groupBy\(\).#' - '#Dynamic call to static method App\\Models\\Builders\\.*::orderByDesc\(\).#' - '#Dynamic call to static method App\\Models\\Builders\\.*::selectRaw\(\).#' - - '#Call to an undefined method Illuminate\\Database\\Eloquent\\.*::update\(\)#' - '#Call to an undefined method Illuminate\\Database\\Eloquent\\.*::with(Only)?\(\)#' - '#Call to an undefined method App\\Relations\\HasManyPhotosRecursively::whereNotNull\(\)#' - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder|Illuminate\\Database\\Eloquent\\Relations\\Relation::whereNotNull\(\).#' diff --git a/resources/views/components/gallery/album/thumbs/album.blade.php b/resources/views/components/gallery/album/thumbs/album.blade.php index f1ca68f7992..59735d67c2b 100644 --- a/resources/views/components/gallery/album/thumbs/album.blade.php +++ b/resources/views/components/gallery/album/thumbs/album.blade.php @@ -57,9 +57,6 @@ class="album-thumb block relative {{ $aspect_ratio_class }} @case(App\SmartAlbums\StarredAlbum::ID) @break - @case(App\SmartAlbums\PublicAlbum::ID) - - @break @case(App\SmartAlbums\UnsortedAlbum::ID) @break diff --git a/routes/api.php b/routes/api.php index 39aac349521..25898ad9c33 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Exceptions\Internal\NotImplementedException; use Illuminate\Support\Facades\Route; /* @@ -70,7 +71,7 @@ Route::post('/Photo::setTitle', [PhotoController::class, 'setTitle']); Route::post('/Photo::setDescription', [PhotoController::class, 'setDescription']); Route::post('/Photo::setStar', [PhotoController::class, 'setStar']); -Route::post('/Photo::setPublic', [PhotoController::class, 'setPublic']); +Route::post('/Photo::setPublic', fn () => throw new NotImplementedException('This code is deprecated. Good bye.')); // just legacy stuff. Route::post('/Photo::setAlbum', [PhotoController::class, 'setAlbum']); Route::post('/Photo::setTags', [PhotoController::class, 'setTags']); Route::post('/Photo::delete', [PhotoController::class, 'delete']); diff --git a/tests/Feature/AlbumTest.php b/tests/Feature/AlbumTest.php index 973ce3d5040..76fc002d7a9 100644 --- a/tests/Feature/AlbumTest.php +++ b/tests/Feature/AlbumTest.php @@ -15,7 +15,6 @@ use App\Enum\DefaultAlbumProtectionType; use App\Models\Configs; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -81,7 +80,6 @@ public function testAddNotLogged(): void $this->albums_tests->get(RecentAlbum::ID, 401); $this->albums_tests->get(StarredAlbum::ID, 401); - $this->albums_tests->get(PublicAlbum::ID, 401); $this->albums_tests->get(UnsortedAlbum::ID, 401); $this->albums_tests->get(OnThisDayAlbum::ID, 401); @@ -97,7 +95,6 @@ public function testAddReadLogged(): void $this->albums_tests->get(RecentAlbum::ID); $this->albums_tests->get(StarredAlbum::ID); - $this->albums_tests->get(PublicAlbum::ID); $this->albums_tests->get(UnsortedAlbum::ID); $this->albums_tests->get(OnThisDayAlbum::ID); @@ -816,7 +813,6 @@ public function testHiddenSmartAlbums(): void 'smart_albums' => [ 'unsorted' => [], 'starred' => [], - 'public' => [], 'recent' => [], 'on_this_day' => [], ], @@ -837,7 +833,6 @@ public function testHiddenSmartAlbums(): void ]); $response->assertDontSee('unsorted'); $response->assertDontSee('starred'); - $response->assertDontSee('public'); $response->assertDontSee('recent'); Configs::set('SA_enabled', true); diff --git a/tests/Feature/Base/BaseSharingTestScenarios.php b/tests/Feature/Base/BaseSharingTestScenarios.php index 11c9a726634..2def700d7ea 100644 --- a/tests/Feature/Base/BaseSharingTestScenarios.php +++ b/tests/Feature/Base/BaseSharingTestScenarios.php @@ -173,7 +173,6 @@ protected function prepareUnsortedPublicAndPrivatePhoto(): void { $this->photoID1 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_TRAIN_IMAGE))->offsetGet('id'); $this->photoID2 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_MONGOLIA_IMAGE))->offsetGet('id'); - $this->photos_tests->set_public($this->photoID1, true); $this->photos_tests->set_star([$this->photoID1], true); Auth::logout(); Session::flush(); @@ -198,7 +197,6 @@ protected function preparePublicAndPrivatePhotoInPrivateAlbum(): void $this->albumID1 = $this->albums_tests->add(null, TestConstants::ALBUM_TITLE_1)->offsetGet('id'); $this->photoID1 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_TRAIN_IMAGE), $this->albumID1)->offsetGet('id'); $this->photoID2 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_MONGOLIA_IMAGE), $this->albumID1)->offsetGet('id'); - $this->photos_tests->set_public($this->photoID1, true); $this->photos_tests->set_star([$this->photoID1], true); Auth::logout(); Session::flush(); @@ -333,7 +331,6 @@ protected function preparePublicUnsortedPhotoAndPhotoInSharedAlbum(): void $this->photoID1 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_TRAIN_IMAGE))->offsetGet('id'); $this->photoID2 = $this->photos_tests->upload(static::createUploadedFile(TestConstants::SAMPLE_FILE_MONGOLIA_IMAGE), $this->albumID1)->offsetGet('id'); $this->sharing_tests->add([$this->albumID1], [$this->userID]); - $this->photos_tests->set_public($this->photoID1, true); $this->photos_tests->set_star([$this->photoID1, $this->photoID2], true); Auth::logout(); Session::flush(); diff --git a/tests/Feature/Base/BaseSharingWithNonAdminUser.php b/tests/Feature/Base/BaseSharingWithNonAdminUser.php index 7fba610b3da..d10bcb8e766 100644 --- a/tests/Feature/Base/BaseSharingWithNonAdminUser.php +++ b/tests/Feature/Base/BaseSharingWithNonAdminUser.php @@ -13,7 +13,6 @@ namespace Tests\Feature\Base; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -337,7 +336,6 @@ protected function generateExpectedRootJson( 'smart_albums' => [ UnsortedAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($unsortedAlbumThumbID)], StarredAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($starredAlbumThumbID)], - PublicAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($publicAlbumThumbID)], RecentAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($recentAlbumThumbID)], OnThisDayAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($onThisDayAlbumThumbID)], ], diff --git a/tests/Feature/BasePhotosAddHandler.php b/tests/Feature/BasePhotosAddHandler.php index 2cb5b2cd3f4..76bc9914563 100644 --- a/tests/Feature/BasePhotosAddHandler.php +++ b/tests/Feature/BasePhotosAddHandler.php @@ -490,7 +490,6 @@ public function testUploadMultibyteTitle(): void 'description' => null, 'tags' => [], 'license' => 'none', - 'is_public' => false, 'is_starred' => false, 'iso' => '400', 'make' => 'Canon', diff --git a/tests/Feature/GeoDataTest.php b/tests/Feature/GeoDataTest.php index 36d7377f1ba..638d8fb0422 100644 --- a/tests/Feature/GeoDataTest.php +++ b/tests/Feature/GeoDataTest.php @@ -102,7 +102,6 @@ public function testGeo(): void 'altitude' => 1633, 'taken_at' => $taken_at->format('Y-m-d\TH:i:sP'), 'taken_at_orig_tz' => $taken_at->getTimezone()->getName(), - 'is_public' => false, 'rights' => [ 'can_download' => true, ], @@ -255,7 +254,6 @@ public function testThumbnailsInsideHiddenAlbum(): void $responseForRoot->assertJsonMissing([ 'unsorted' => null, 'starred' => null, - 'public' => null, 'on_this_day' => null, ]); foreach ([$albumID1, $photoID1, $photoID11, $photoID12, $photoID121, $photoID13] as $id) { diff --git a/tests/Feature/LibUnitTests/PhotosUnitTest.php b/tests/Feature/LibUnitTests/PhotosUnitTest.php index 15986a54bd6..48f1efd8ffd 100644 --- a/tests/Feature/LibUnitTests/PhotosUnitTest.php +++ b/tests/Feature/LibUnitTests/PhotosUnitTest.php @@ -234,32 +234,6 @@ public function set_tag( } } - /** - * Set public. - * - * @param string $id - * @param bool $isPublic - * @param int $expectedStatusCode - * @param string|null $assertSee - */ - public function set_public( - string $id, - bool $isPublic, - int $expectedStatusCode = 204, - ?string $assertSee = null - ): void { - $response = $this->testCase->postJson( - '/api/Photo::setPublic', [ - 'photoID' => $id, - 'is_public' => $isPublic, - ] - ); - $this->assertStatus($response, $expectedStatusCode); - if ($assertSee !== null) { - $response->assertSee($assertSee, false); - } - } - /** * Set license. * diff --git a/tests/Feature/PhotosAddSpecialAlbumTest.php b/tests/Feature/PhotosAddSpecialAlbumTest.php index c05c387472e..da507bc1029 100644 --- a/tests/Feature/PhotosAddSpecialAlbumTest.php +++ b/tests/Feature/PhotosAddSpecialAlbumTest.php @@ -12,7 +12,6 @@ namespace Tests\Feature; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use Tests\AbstractTestCase; @@ -51,23 +50,6 @@ public function testSimpleUploadToSubAlbum(): void } } - /** - * A simple upload of an ordinary photo to the public album. - * - * @return void - */ - public function testSimpleUploadToPublic(): void - { - $response = $this->photos_tests->upload( - AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_NIGHT_IMAGE), - PublicAlbum::ID - ); - $response->assertJson([ - 'album_id' => null, - 'is_public' => true, - ]); - } - /** * A simple upload of an ordinary photo to the is-starred album. * diff --git a/tests/Feature/PhotosOperationsTest.php b/tests/Feature/PhotosOperationsTest.php index 07737df9a0a..2c724f7cccf 100644 --- a/tests/Feature/PhotosOperationsTest.php +++ b/tests/Feature/PhotosOperationsTest.php @@ -16,7 +16,6 @@ use App\Exceptions\Internal\NotImplementedException; use App\Models\Configs; use App\Models\Photo; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -80,7 +79,6 @@ public function testManyFunctionsAtOnce(): void $this->clearCachedSmartAlbums(); $this->albums_tests->get(UnsortedAlbum::ID, 200, $id); $this->albums_tests->get(RecentAlbum::ID, 200, $id); - $this->albums_tests->get(PublicAlbum::ID, 200, null, $id); $this->albums_tests->get(StarredAlbum::ID, 200, null, $id); $this->photos_tests->set_title($id, "Night in Ploumanac'h"); @@ -88,7 +86,6 @@ public function testManyFunctionsAtOnce(): void $this->photos_tests->set_star([$id], true); $this->photos_tests->set_tag([$id], ['night']); $this->photos_tests->set_tag([$id], ['trees'], false); - $this->photos_tests->set_public($id, true); $this->photos_tests->set_license($id, 'WTFPL', 422, 'The selected license is invalid.'); $this->photos_tests->set_license($id, 'CC0'); $this->photos_tests->set_license($id, 'CC-BY-1.0'); @@ -143,7 +140,6 @@ public function testManyFunctionsAtOnce(): void $this->clearCachedSmartAlbums(); $this->albums_tests->get(StarredAlbum::ID, 200, $id); - $this->albums_tests->get(PublicAlbum::ID, 200, $id); $response = $this->photos_tests->get($id); $response->assertJson([ @@ -151,7 +147,6 @@ public function testManyFunctionsAtOnce(): void 'id' => $id, 'created_at' => $updated_taken_at->setTimezone('UTC')->format('Y-m-d\TH:i:sP'), 'license' => 'reserved', - 'is_public' => true, 'is_starred' => true, 'tags' => ['night', 'trees'], ]); @@ -193,7 +188,6 @@ public function testManyFunctionsAtOnce(): void 'license' => 'reserved', 'make' => 'Canon', 'model' => 'Canon EOS R', - 'is_public' => true, 'shutter' => '30 s', 'is_starred' => true, 'tags' => [], @@ -294,8 +288,6 @@ public function testTrueNegative(): void $this->photos_tests->get('abcdefghijklmnopxyrstuvx', 404); $this->photos_tests->set_description('-1', 'test', 422); $this->photos_tests->set_description('abcdefghijklmnopxyrstuvx', 'test', 404); - $this->photos_tests->set_public('-1', true, 422); - $this->photos_tests->set_public('abcdefghijklmnopxyrstuvx', true, 404); $this->photos_tests->set_album('-1', ['-1'], 422); $this->photos_tests->set_album('abcdefghijklmnopxyrstuvx', ['-1'], 422); $this->photos_tests->set_album('-1', ['abcdefghijklmnopxyrstuvx'], 422); @@ -385,7 +377,6 @@ public function testThumbnailsInsideHiddenAlbum(): void $responseForRoot->assertJsonMissing([ 'unsorted' => null, 'starred' => null, - 'public' => null, ]); foreach ([$albumID1, $photoID11, $photoID12, $photoID121, $photoID13] as $id) { $responseForRoot->assertJsonMissing(['id' => $id]); diff --git a/tests/Feature/RSSTest.php b/tests/Feature/RSSTest.php index 1dc400a0d1f..645b7fc646b 100644 --- a/tests/Feature/RSSTest.php +++ b/tests/Feature/RSSTest.php @@ -88,16 +88,10 @@ public function testRSS1(): void AbstractTestCase::createUploadedFile(TestConstants::SAMPLE_FILE_NIGHT_IMAGE) )->offsetGet('id'); - // set it to public - $this->photos_tests->set_public($photoID, true); - // try to get the RSS feed. $response = $this->get('/feed'); $this->assertOk($response); - // set picture to private - $this->photos_tests->set_public($photoID, false); - // move picture to album $this->photos_tests->set_album($albumID, [$photoID]); $this->albums_tests->set_protection_policy($albumID); diff --git a/tests/Feature/SharingWithAnonUserTest.php b/tests/Feature/SharingWithAnonUserTest.php index ae7e5b278a6..146c1ee2e92 100644 --- a/tests/Feature/SharingWithAnonUserTest.php +++ b/tests/Feature/SharingWithAnonUserTest.php @@ -13,7 +13,6 @@ namespace Tests\Feature; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -310,7 +309,6 @@ protected function generateUnexpectedRootJson( $smartAlbums = [ UnsortedAlbum::ID => null, - PublicAlbum::ID => null, ]; if ($starredAlbumThumbID === null) { $smartAlbums[StarredAlbum::ID] = null; @@ -348,6 +346,11 @@ protected function getExpectedDefaultInaccessibleMessage(): string return TestConstants::EXPECTED_UNAUTHENTICATED_MSG; } + protected function getExpectedForbiddenHttpStatusCode(): int + { + return 403; + } + /** * Ensures that the user does not see the unsorted public photos as covers nor * inside "Recent", "On This Day" and "Favorites" (as public search is disabled). @@ -387,9 +390,7 @@ public function testUnsortedPublicAndPrivatePhoto(): void $responseForOnThisDay->assertJsonMissing(['id' => $this->photoID1]); $responseForOnThisDay->assertJsonMissing(['id' => $this->photoID2]); - // Even though the public photo is not searchable and hence does not - // show up in the smart albums, it can be fetched directly - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2, $this->getExpectedInaccessibleHttpStatusCode()); } @@ -436,11 +437,8 @@ public function testPublicAndPrivatePhotoInPrivateAlbum(): void $responseForTree->assertJsonMissing(['id' => $this->photoID1]); $responseForTree->assertJsonMissing(['id' => $this->photoID2]); - // The album and photo 2 are not accessible, but photo 1 is - // because it is public even though it is contained in an inaccessible - // album $this->albums_tests->get($this->albumID1, $this->getExpectedInaccessibleHttpStatusCode(), $this->getExpectedDefaultInaccessibleMessage(), TestConstants::EXPECTED_PASSWORD_REQUIRED_MSG); - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2, $this->getExpectedInaccessibleHttpStatusCode()); } @@ -477,7 +475,7 @@ public function testPublicUnsortedPhotoAndPhotoInSharedAlbum(): void $responseForTree->assertJsonMissing(['id' => $this->photoID2]); $this->albums_tests->get($this->albumID1, $this->getExpectedInaccessibleHttpStatusCode(), $this->getExpectedDefaultInaccessibleMessage(), TestConstants::EXPECTED_PASSWORD_REQUIRED_MSG); - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2, $this->getExpectedInaccessibleHttpStatusCode()); } } diff --git a/tests/Feature/SharingWithNonAdminUserTest.php b/tests/Feature/SharingWithNonAdminUserTest.php index 265e9475d7f..acc2d60bf53 100644 --- a/tests/Feature/SharingWithNonAdminUserTest.php +++ b/tests/Feature/SharingWithNonAdminUserTest.php @@ -13,7 +13,6 @@ namespace Tests\Feature; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -343,7 +342,6 @@ protected function generateExpectedRootJson( 'smart_albums' => [ UnsortedAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($unsortedAlbumThumbID)], StarredAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($starredAlbumThumbID)], - PublicAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($publicAlbumThumbID)], RecentAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($recentAlbumThumbID)], OnThisDayAlbum::ID => ['thumb' => $this->generateExpectedThumbJson($onThisDayAlbumThumbID)], ], @@ -434,7 +432,7 @@ public function testUnsortedPublicAndPrivatePhoto(): void // Even though the public photo is not searchable and hence does not // show up in the smart albums, it can be fetched directly - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2, $this->getExpectedInaccessibleHttpStatusCode()); } @@ -492,7 +490,7 @@ public function testPublicAndPrivatePhotoInPrivateAlbum(): void $this->albums_tests->get($this->albumID1, $this->getExpectedInaccessibleHttpStatusCode(), $this->getExpectedDefaultInaccessibleMessage(), TestConstants::EXPECTED_PASSWORD_REQUIRED_MSG); // Even though public search is disabled, the photo is accessible // by its direct link, because it is public. - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2, $this->getExpectedInaccessibleHttpStatusCode()); } @@ -567,7 +565,7 @@ public function testPublicUnsortedPhotoAndPhotoInSharedAlbum(): void ], ]); - $this->photos_tests->get($this->photoID1); + $this->photos_tests->get($this->photoID1, $this->getExpectedInaccessibleHttpStatusCode()); $this->photos_tests->get($this->photoID2); } } diff --git a/tests/Feature/Traits/InteractWithSmartAlbums.php b/tests/Feature/Traits/InteractWithSmartAlbums.php index dbcb287d0c8..18c0bfef43b 100644 --- a/tests/Feature/Traits/InteractWithSmartAlbums.php +++ b/tests/Feature/Traits/InteractWithSmartAlbums.php @@ -13,7 +13,6 @@ namespace Tests\Feature\Traits; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\RecentAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; @@ -30,7 +29,6 @@ trait InteractWithSmartAlbums protected function clearCachedSmartAlbums(): void { foreach ([ - PublicAlbum::class, RecentAlbum::class, StarredAlbum::class, UnsortedAlbum::class, diff --git a/tests/Feature/UsersTest.php b/tests/Feature/UsersTest.php index b36c32a241e..4676ba25245 100644 --- a/tests/Feature/UsersTest.php +++ b/tests/Feature/UsersTest.php @@ -15,7 +15,6 @@ use App\Models\Configs; use App\Models\User; use App\SmartAlbums\OnThisDayAlbum; -use App\SmartAlbums\PublicAlbum; use App\SmartAlbums\StarredAlbum; use App\SmartAlbums\UnsortedAlbum; use Illuminate\Support\Facades\Auth; @@ -62,7 +61,6 @@ public function testUsers(): void * 17. log out * * 18. log as 'test_abcde' - * 19. try access shared pictures (public) * 20. try access starred pictures * 21. try access recent pictures * 22. try access on_this_day pictures @@ -199,9 +197,6 @@ public function testUsers(): void $sessions_test->init(); $this->clearCachedSmartAlbums(); - // 19 - $album_tests->get(PublicAlbum::ID, 403); - // 20 $album_tests->get(StarredAlbum::ID, 403);