fix ManageWiki to not break stuff

This commit is contained in:
Markus-Rost 2020-10-23 01:23:28 +02:00
parent 8a296488d3
commit 801c8be2a4

View file

@ -366,31 +366,31 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes
content = "⚙️ "+_("[{author}]({author_url}) changed wiki settings ({reason})".format(author=author, author_url=author_url, reason=parsed_comment))
elif action == "managewiki/delete":
content = "🗑️ "+_("[{author}]({author_url}) deleted a wiki *{wiki_name}* ({comment})").format(author=author, author_url=author_url,
wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}), comment=parsed_comment)
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
elif action == "managewiki/lock":
content = "🔒 "+_("[{author}]({author_url}) locked a wiki *{wiki_name}* ({comment})").format(
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}), comment=parsed_comment)
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
elif action == "managewiki/namespaces":
content = "📦 "+_("[{author}]({author_url}) modified a namespace *{namespace_name}* on *{wiki_name}* ({comment})").format(
author=author, author_url=author_url, namespace_name=change["logparams"].get("namespace", {"namespace": _("Unknown")}),
wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}), comment=parsed_comment)
author=author, author_url=author_url, namespace_name=change["logparams"].get("namespace", _("Unknown")),
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
elif action == "managewiki/namespaces-delete":
content = "🗑️ " + _(
"[{author}]({author_url}) deleted a namespace *{namespace_name}* on *{wiki_name}* ({comment})").format(
author=author, author_url=author_url,
namespace_name=change["logparams"].get("namespace", {"namespace": _("Unknown")}),
wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}), comment=parsed_comment)
namespace_name=change["logparams"].get("namespace", _("Unknown")),
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
elif action == "managewiki/rights":
content = "🏅 " + _("[{author}]({author_url}) modified user group *{group_name}* ({comment})").format(
author=author, author_url=author_url, group_name=change["title"][32:], comment=parsed_comment
)
elif action == "managewiki/undelete":
content = "🏅 " + _("[{author}]({author_url}) restored a wiki *{wiki_name}* ({comment})").format(
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}), comment=parsed_comment
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment
)
elif action == "managewiki/unlock":
content = "🏅 " + _("[{author}]({author_url}) unlocked a wiki *{wiki_name}* ({comment})").format(
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", {"wiki": _("Unknown")}),
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")),
comment=parsed_comment
)
elif action == "suppressed":
@ -821,34 +821,28 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes):
if change["logparams"].get("changes", ""):
embed.add_field("Setting", change["logparams"].get("changes"))
elif action == "managewiki/delete":
embed["title"] = _("Deleted a \"{wiki}\" wiki".format(wiki=change["logparams"].get("wiki", {"wiki": _("Unknown")})))
embed["title"] = _("Deleted a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
link = create_article_path("")
elif action == "managewiki/lock":
embed["title"] = _(
"Locked a \"{wiki}\" wiki".format(wiki=change["logparams"].get("wiki", {"wiki": _("Unknown")})))
embed["title"] = _("Locked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
link = create_article_path("")
elif action == "managewiki/namespaces":
embed["title"] = _(
"Modified a \"{namespace_name}\" namespace".format(namespace_name=change["logparams"].get("namespace", {"namespace": _("Unknown")})))
embed["title"] = _("Modified a \"{namespace_name}\" namespace").format(namespace_name=change["logparams"].get("namespace", _("Unknown")))
link = create_article_path("")
embed.add_field(_('Wiki'), change["logparams"].get("wiki", {"wiki": _("Unknown")}))
embed.add_field(_('Wiki'), change["logparams"].get("wiki", _("Unknown")))
elif action == "managewiki/namespaces-delete":
embed["title"] = _(
"Deleted a \"{namespace_name}\" namespace".format(
namespace_name=change["logparams"].get("namespace", {"namespace": _("Unknown")})))
embed["title"] = _("Deleted a \"{namespace_name}\" namespace").format(
namespace_name=change["logparams"].get("namespace", _("Unknown")))
link = create_article_path("")
embed.add_field(_('Wiki'), change["logparams"].get("wiki", {"wiki": _("Unknown")}))
embed.add_field(_('Wiki'), change["logparams"].get("wiki", _("Unknown")))
elif action == "managewiki/rights":
embed["title"] = _(
"Modified \"{usergroup_name}\" usergroup".format(usergroup_name=change["title"][32:]))
embed["title"] = _("Modified \"{usergroup_name}\" usergroup").format(usergroup_name=change["title"][32:])
link = create_article_path("")
elif action == "managewiki/undelete":
embed["title"] = _(
"Restored a \"{wiki}\" wiki".format(wiki=change["logparams"].get("wiki", {"wiki": _("Unknown")})))
embed["title"] = _("Restored a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
link = create_article_path("")
elif action == "managewiki/unlock":
embed["title"] = _(
"Unlocked a \"{wiki}\" wiki".format(wiki=change["logparams"].get("wiki", {"wiki": _("Unknown")})))
embed["title"] = _("Unlocked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
link = create_article_path("")
elif action == "suppressed":
link = create_article_path("")