diff --git a/database/migrations/2026_09_28_100000_remove_internal_profil_klett_grant_reports.php b/database/migrations/2026_09_28_100000_remove_internal_profil_klett_grant_reports.php new file mode 100644 index 000000000..41c9cd33b --- /dev/null +++ b/database/migrations/2026_09_28_100000_remove_internal_profil_klett_grant_reports.php @@ -0,0 +1,37 @@ +pluck('url', 'id') + ->filter(function ($url): bool { + $path = parse_url((string) $url, PHP_URL_PATH) ?: (string) $url; + $filename = rawurldecode(basename($path)); + + return in_array($filename, GrassrootsGrantsSeeder::EXCLUDED_EVIDENCE_FILES, true); + }) + ->keys(); + + if ($ids->isEmpty()) { + return; + } + + DB::table('grassroots_grants_project_images')->whereIn('id', $ids->all())->delete(); + } + + public function down(): void + { + // Internal reports stay unpublished. + } +}; diff --git a/database/seeders/GrassrootsGrantsSeeder.php b/database/seeders/GrassrootsGrantsSeeder.php index ee77d4db9..2deeede0e 100644 --- a/database/seeders/GrassrootsGrantsSeeder.php +++ b/database/seeders/GrassrootsGrantsSeeder.php @@ -13,6 +13,20 @@ class GrassrootsGrantsSeeder extends Seeder { + /** + * Internal grant reports that must not be published with project evidence. + * + * @var list + */ + public const EXCLUDED_EVIDENCE_FILES = [ + 'Pazin City Library_Final narrative report in English.pdf', + 'Article about workshops_My first code.pdf', + 'BETA_Evidence of conducted workshops.pdf', + 'BETA_Final narrative report in English.pdf', + 'BETA_Narrative report with evidence.pdf', + 'HROBOS_Final narrative report with evidence.pdf', + ]; + public function run(): void { if (! Schema::hasTable('grassroots_grants_page')) { @@ -95,6 +109,10 @@ private function seedProjectImages( $position = 0; foreach ($finder as $file) { + if (in_array($file->getFilename(), self::EXCLUDED_EVIDENCE_FILES, true)) { + continue; + } + $url = '/images/grants/'.$hubFolder.'/'.$projectFolder.'/'.$file->getFilename(); $extension = strtolower($file->getExtension()); diff --git a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Evidence of conducted workshops.pdf b/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Evidence of conducted workshops.pdf deleted file mode 100644 index 4854a4026..000000000 Binary files a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Evidence of conducted workshops.pdf and /dev/null differ diff --git a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Final narrative report in English.pdf b/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Final narrative report in English.pdf deleted file mode 100644 index 139303afd..000000000 Binary files a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Final narrative report in English.pdf and /dev/null differ diff --git a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Narrative report with evidence.pdf b/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Narrative report with evidence.pdf deleted file mode 100644 index 855b29bf8..000000000 Binary files a/public/images/grants/Croatia & Slovenia/Holiday creative workshops at the Garage for Children 13+/BETA_Narrative report with evidence.pdf and /dev/null differ diff --git a/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Article about workshops_My first code.pdf b/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Article about workshops_My first code.pdf deleted file mode 100644 index b3150789a..000000000 Binary files a/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Article about workshops_My first code.pdf and /dev/null differ diff --git a/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Pazin City Library_Final narrative report in English.pdf b/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Pazin City Library_Final narrative report in English.pdf deleted file mode 100644 index e0cfc6c47..000000000 Binary files a/public/images/grants/Croatia & Slovenia/MY FIRST CODE First steps into the world of coding with LEGO/Pazin City Library_Final narrative report in English.pdf and /dev/null differ diff --git a/public/images/grants/Croatia & Slovenia/Preparatory workshops for WRO 2025 Ljubljana/HROBOS_Final narrative report with evidence.pdf b/public/images/grants/Croatia & Slovenia/Preparatory workshops for WRO 2025 Ljubljana/HROBOS_Final narrative report with evidence.pdf deleted file mode 100644 index 60396b2e6..000000000 Binary files a/public/images/grants/Croatia & Slovenia/Preparatory workshops for WRO 2025 Ljubljana/HROBOS_Final narrative report with evidence.pdf and /dev/null differ diff --git a/tests/Feature/GrassrootsGrantsInternalReportsTest.php b/tests/Feature/GrassrootsGrantsInternalReportsTest.php new file mode 100644 index 000000000..ad38994ff --- /dev/null +++ b/tests/Feature/GrassrootsGrantsInternalReportsTest.php @@ -0,0 +1,45 @@ +seed(GrassrootsGrantsSeeder::class); + + $published = GrassrootsGrantsProjectImage::query()->pluck('url'); + + foreach (GrassrootsGrantsSeeder::EXCLUDED_EVIDENCE_FILES as $filename) { + $this->assertFileDoesNotExist($this->grantEvidencePath($filename)); + + $this->assertFalse( + $published->contains(fn (string $url): bool => rawurldecode(basename(parse_url($url, PHP_URL_PATH) ?: $url)) === $filename), + $filename.' is still linked on the grassroots grants page.' + ); + } + } + + private function grantEvidencePath(string $filename): string + { + $folders = [ + 'Pazin City Library_Final narrative report in English.pdf' => 'MY FIRST CODE First steps into the world of coding with LEGO', + 'Article about workshops_My first code.pdf' => 'MY FIRST CODE First steps into the world of coding with LEGO', + 'BETA_Evidence of conducted workshops.pdf' => 'Holiday creative workshops at the Garage for Children 13+', + 'BETA_Final narrative report in English.pdf' => 'Holiday creative workshops at the Garage for Children 13+', + 'BETA_Narrative report with evidence.pdf' => 'Holiday creative workshops at the Garage for Children 13+', + 'HROBOS_Final narrative report with evidence.pdf' => 'Preparatory workshops for WRO 2025 Ljubljana', + ]; + + return public_path('images/grants/Croatia & Slovenia/'.$folders[$filename].'/'.$filename); + } +}