Add audit logging for game support pages

This commit is contained in:
rubenwardy 2023-06-18 21:34:53 +01:00
parent e6f36113ce
commit 324d7ec1e1
2 changed files with 12 additions and 4 deletions

@ -706,6 +706,8 @@ def game_support(package):
package.supports_all_games = form.supports_all_games.data
addAuditLog(AuditSeverity.NORMAL, current_user, "Edited game support", package.getURL("packages.game_support"), package)
db.session.commit()
if detect_update_needed:

@ -162,11 +162,17 @@ def confirm_supports_all_games(username=None):
if current_user != user and not current_user.rank.atLeast(UserRank.EDITOR):
abort(403)
db.session.query(Package).filter(
Package.maintainers.contains(user),
packages = user.maintained_packages.filter(
Package.state != PackageState.DELETED,
Package.type.in_([PackageType.MOD, PackageType.TXP]),
~Package.supported_games.any(supports=True)).update({ "supports_all_games": True })
Package.type.in_([PackageType.MOD, PackageType.TXP])) \
.order_by(db.asc(Package.title)).all()
for package in packages:
package.supports_all_games = True
db.session.merge(package)
addAuditLog(AuditSeverity.NORMAL, current_user, "Enabled 'Supports all games' (bulk)",
package.getURL("packages.game_support"), package)
db.session.commit()