Commit 5102a512 authored by Diego Salazar's avatar Diego Salazar

Merge branch 'hide-deleted-proposals' into 'master'

proposals: hide fr/wip/cp proposals if .md file doesn't exist

See merge request !10
parents f7edbff4 05b78da9
...@@ -63,6 +63,11 @@ class UpdateSiteProposals extends Command ...@@ -63,6 +63,11 @@ class UpdateSiteProposals extends Command
return $responseProposals; return $responseProposals;
} }
private function proposalFileExists($filename)
{
return \Storage::exists('proposals/'. basename($filename));
}
private function ideaProposals() private function ideaProposals()
{ {
$group = new stdClass(); $group = new stdClass();
...@@ -92,7 +97,7 @@ class UpdateSiteProposals extends Command ...@@ -92,7 +97,7 @@ class UpdateSiteProposals extends Command
continue; continue;
} }
$project = Project::where('filename', $filename)->first(); $project = Project::where('filename', $filename)->first();
if ($project) { if ($project && $this->proposalFileExists($filename)) {
$this->error("Skipping MR #$mergeRequest->id '$mergeRequest->title': already have a project $filename"); $this->error("Skipping MR #$mergeRequest->id '$mergeRequest->title': already have a project $filename");
continue; continue;
} }
...@@ -137,7 +142,9 @@ class UpdateSiteProposals extends Command ...@@ -137,7 +142,9 @@ class UpdateSiteProposals extends Command
$responseProposals = []; $responseProposals = [];
$proposals = Project::where('state', $state)->get(); $proposals = Project::where('state', $state)->get();
foreach ($proposals as $proposal) { foreach ($proposals as $proposal) {
$responseProposals[] = $this->formatProposal($proposal); if ($this->proposalFileExists($proposal->filename)) {
$responseProposals[] = $this->formatProposal($proposal);
}
} }
$group->proposals = $this->sortProposalsByDateDesc($responseProposals); $group->proposals = $this->sortProposalsByDateDesc($responseProposals);
return $group; return $group;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment