Add validation for modpack names with one mod

This commit is contained in:
rubenwardy 2022-02-12 18:25:46 +00:00
parent 09eea443cf
commit 5c5608680b
2 changed files with 9 additions and 1 deletions

@ -721,7 +721,11 @@ class Package(db.Model):
if not (self.checkPerm(user, Permission.APPROVE_NEW) or self.checkPerm(user, Permission.EDIT_PACKAGE)):
return False
if state == PackageState.APPROVED and ("Other" in self.license.name or "Other" in self.media_license.name):
if state == PackageState.APPROVED and ("Other" in self.license.name or "Other" in self.media_license.name):
return False
provides = self.provides
if state == PackageState.APPROVED and len(provides) == 1 and provides[0].name != self.name:
return False
if self.getMissingHardDependenciesQuery().count() > 0:

@ -48,6 +48,10 @@
{% elif package.state == package.state.READY_FOR_REVIEW and ("Other" in package.license.name or "Other" in package.media_license.name) %}
{% set message = _("Please wait for the license to be added to CDB.") %}
{% elif package.state == package.state.READY_FOR_REVIEW and (package.provides | length) == 1 and package.provides[0].name != package.name %}
{% set level = "danger" %}
{% set message = _("Mod name does not match package name.") %}
{% else %}
{% set level = "info" %}
{% set message %}