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 # the number of reports displayed on each page
_REPORTS_PER_PAGE = 10 _REPORTS_PER_PAGE = 10
# the fallback standard tags
_REPORT_STATUS_TAGS = ("in progress", "rejected") _REPORT_STATUS_TAGS = ("in progress", "rejected")
# the tag, used to mark a report as 'closed' # the tag, used to mark a report as 'closed'
_REPORT_STATUS_CLOSED_TAG = _("closed") _REPORT_STATUS_CLOSED_TAG = _("closed")
@ -23,8 +24,9 @@ if hasattr(settings, "INGAME_REPORT_STATUS_TAGS"):
logger.log_warn( logger.log_warn(
"The 'INGAME_REPORT_STATUS_TAGS' setting must be an iterable of strings; falling back to defaults." "The 'INGAME_REPORT_STATUS_TAGS' setting must be an iterable of strings; falling back to defaults."
) )
# add the tag to the tag tupel # add the 'closed' tag to the tupel of tags
_REPORT_STATUS_TAGS = _REPORT_STATUS_TAGS + (_REPORT_STATUS_CLOSED_TAG,) 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): def menunode_list_reports(caller, raw_string, **kwargs):
@ -164,15 +166,14 @@ def menunode_manage_report(caller, raw_string, report, **kwargs):
options = [] options = []
for tag in _REPORT_STATUS_TAGS: for tag in _REPORT_STATUS_TAGS:
if tag in report.tags.all(): if tag in report.tags.all():
if tag in report.tags.all(): desc = _("Unmark as {tag}").format(tag=tag)
desc = _("Unmark as {tag}").format(tag=tag) else:
else: desc = _("Mark as {tag}").format(tag=tag)
desc = _("Mark as {tag}").format(tag=tag) options.append(
options.append( {
{ "desc": desc,
"desc": desc, "goto": (_report_toggle_tag, {"report": report, "tag": tag}),
"goto": (_report_toggle_tag, {"report": report, "tag": tag}), }
} )
)
options.append({"desc": _("Manage another report"), "goto": "menunode_list_reports"}) options.append({"desc": _("Manage another report"), "goto": "menunode_list_reports"})
return text, options return text, options

View file

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