From 1a8d28a2d898e8fa9247a012129a8315672f27b4 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 27 Jun 2023 21:40:31 +0100
Subject: [PATCH] Prevent users being able to enable support for all games when
they shouldn't
---
app/blueprints/packages/packages.py | 4 +++-
app/templates/packages/game_support.html | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/blueprints/packages/packages.py b/app/blueprints/packages/packages.py
index 4c614d9f..b04d58f3 100644
--- a/app/blueprints/packages/packages.py
+++ b/app/blueprints/packages/packages.py
@@ -671,7 +671,9 @@ def game_support(package):
force_game_detection = package.supported_games.filter(and_(
PackageGameSupport.confidence > 1, PackageGameSupport.supports == True)).count() == 0
- can_support_all_games = package.type != PackageType.TXP
+ can_support_all_games = package.type != PackageType.TXP and \
+ package.supported_games.filter(and_(
+ PackageGameSupport.confidence == 1, PackageGameSupport.supports == True)).count() == 0
can_override = can_edit
diff --git a/app/templates/packages/game_support.html b/app/templates/packages/game_support.html
index 7373f5fd..7110f063 100644
--- a/app/templates/packages/game_support.html
+++ b/app/templates/packages/game_support.html
@@ -98,7 +98,11 @@
{% elif package.type.name == "TXP" %}
- {{ _("It's not possible for texture packs to support all games") }}
+ {{ _("It's not possible for texture packs to support all games.") }}
+
+ {% elif package.type.name == "MOD" %}
+
+ {{ _("The package depends on a game-specific mod, and so cannot support all games.") }}
{% endif %}