mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Removes old SPT versions from search results
The global search results are now limited to mods tagged with the last three minor SPT versions, like the mod listing filters. I'm not 100% sure about this change. Open to suggestions and revisiting this in the future. Resolves #26
This commit is contained in:
parent
ffd5117028
commit
164a649cd4
@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laravel\Scout\Searchable;
|
use Laravel\Scout\Searchable;
|
||||||
@ -144,6 +145,14 @@ class Mod extends Model
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure the latest SPT version is within the last three minor versions.
|
||||||
|
$activeSptVersions = Cache::remember('active-spt-versions', 60 * 60, function () {
|
||||||
|
return SptVersion::getVersionsForLastThreeMinors();
|
||||||
|
});
|
||||||
|
if (! in_array($latestVersion->latestSptVersion()->first()->version, $activeSptVersions->pluck('version')->toArray())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// All conditions are met; the mod should be searchable.
|
// All conditions are met; the mod should be searchable.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user