The tag “closed” or its translated version is now automatically added to

the tag tuple if it has not already been specified in “settings.py”.

Current behavior: If the tag 'closed' is not set in
INGAME_REPORT_STATUS_TAGS, reports can no longer be closed, which seems
like a bug to me.

An alternative solution would be another setting in ‘settings.py’, such
as ‘INGAME_REPORT_STATUS_CLOSED_TAG’. This would also eliminate the need
for internationalization, as the tag could be set in the desired
language.
This commit is contained in:
Peddn 2025-08-31 13:51:12 +02:00
parent 919930ed10
commit 990ba95f5e
3 changed files with 19 additions and 19 deletions

View file

@ -12,6 +12,7 @@ from evennia.utils.utils import crop, datetime_format, is_iter, iter_to_str
# the number of reports displayed on each page
_REPORTS_PER_PAGE = 10
# the fallback standard tags
_REPORT_STATUS_TAGS = ("in progress", "rejected")
# the tag, used to mark a report as 'closed'
_REPORT_STATUS_CLOSED_TAG = _("closed")
@ -23,8 +24,9 @@ if hasattr(settings, "INGAME_REPORT_STATUS_TAGS"):
logger.log_warn(
"The 'INGAME_REPORT_STATUS_TAGS' setting must be an iterable of strings; falling back to defaults."
)
# add the tag to the tag tupel
_REPORT_STATUS_TAGS = _REPORT_STATUS_TAGS + (_REPORT_STATUS_CLOSED_TAG,)
# add the 'closed' tag to the tupel of tags
if _REPORT_STATUS_CLOSED_TAG not in _REPORT_STATUS_TAGS:
_REPORT_STATUS_TAGS = _REPORT_STATUS_TAGS + (_REPORT_STATUS_CLOSED_TAG,)
def menunode_list_reports(caller, raw_string, **kwargs):
@ -163,7 +165,6 @@ def menunode_manage_report(caller, raw_string, report, **kwargs):
options = []
for tag in _REPORT_STATUS_TAGS:
if tag in report.tags.all():
if tag in report.tags.all():
desc = _("Unmark as {tag}").format(tag=tag)
else:

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-31 09:56+0000\n"
"POT-Creation-Date: 2025-08-31 10:23+0000\n"
"PO-Revision-Date: 2025-03-28 10:21+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -353,8 +353,7 @@ msgstr "{hub_name} verwalten"
msgid ""
"(No {status} reports)\n"
"{text}"
msgstr "Keine {status} Berichte"
"{text}"
msgstr "Keine {status} Berichte{text}"
#: contrib/base_systems/ingame_reports/menu.py:52
#, python-brace-format
@ -411,7 +410,7 @@ msgstr "Alle offenen Berichte"
#: contrib/base_systems/ingame_reports/menu.py:148
#, python-brace-format
msgid " about {receivers}"
msgstr "über {receivers}"
msgstr " über {receivers}"
#: contrib/base_systems/ingame_reports/menu.py:153
#, python-brace-format
@ -424,17 +423,17 @@ msgstr ""
"{timestamp} von {senders}{about_clause}\n"
"{tags}"
#: contrib/base_systems/ingame_reports/menu.py:168
#: contrib/base_systems/ingame_reports/menu.py:167
#, python-brace-format
msgid "Unmark as {tag}"
msgstr "Markierung als {tag} entfernen"
#: contrib/base_systems/ingame_reports/menu.py:170
#: contrib/base_systems/ingame_reports/menu.py:169
#, python-brace-format
msgid "Mark as {tag}"
msgstr "Als {tag} markieren"
#: contrib/base_systems/ingame_reports/menu.py:177
#: contrib/base_systems/ingame_reports/menu.py:176
msgid "Manage another report"
msgstr "Einen anderen Bericht verwalten."