Fix compatibility with Special:ProtectSite #188

This commit is contained in:
Frisk 2020-12-29 23:26:59 +01:00
parent 517493f31a
commit 83a4dbd332
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -308,7 +308,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes
link = link_formatter(create_article_path(change["title"])) link = link_formatter(create_article_path(change["title"]))
content = _("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url, content = _("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url,
article=change["title"], article_url=link, article=change["title"], article_url=link,
settings=change["logparams"]["description"]+(_(" [cascading]") if "cascade" in change["logparams"] else ""), settings=change["logparams"].get("description", "")+(_(" [cascading]") if "cascade" in change["logparams"] else ""),
comment=parsed_comment) comment=parsed_comment)
elif action == "protect/modify": elif action == "protect/modify":
link = link_formatter(create_article_path(change["title"])) link = link_formatter(create_article_path(change["title"]))
@ -316,7 +316,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes
"[{author}]({author_url}) modified protection settings of [{article}]({article_url}) to: {settings}{comment}").format( "[{author}]({author_url}) modified protection settings of [{article}]({article_url}) to: {settings}{comment}").format(
author=author, author_url=author_url, author=author, author_url=author_url,
article=change["title"], article_url=link, article=change["title"], article_url=link,
settings=change["logparams"]["description"] + (_(" [cascading]") if "cascade" in change["logparams"] else ""), settings=change["logparams"].get("description", "") + (_(" [cascading]") if "cascade" in change["logparams"] else ""),
comment=parsed_comment) comment=parsed_comment)
elif action == "protect/unprotect": elif action == "protect/unprotect":
link = link_formatter(create_article_path(change["title"])) link = link_formatter(create_article_path(change["title"]))
@ -978,13 +978,13 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes):
elif action == "protect/protect": elif action == "protect/protect":
link = create_article_path(change["title"]) link = create_article_path(change["title"])
embed["title"] = _("Protected {target}").format(target=change["title"]) embed["title"] = _("Protected {target}").format(target=change["title"])
parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"]["description"], parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"].get("description", ""),
cascade=_(" [cascading]") if "cascade" in change["logparams"] else "", cascade=_(" [cascading]") if "cascade" in change["logparams"] else "",
reason=parsed_comment) reason=parsed_comment)
elif action == "protect/modify": elif action == "protect/modify":
link = create_article_path(change["title"]) link = create_article_path(change["title"])
embed["title"] = _("Changed protection level for {article}").format(article=change["title"]) embed["title"] = _("Changed protection level for {article}").format(article=change["title"])
parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"]["description"], parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"].get("description", ""),
cascade=_(" [cascading]") if "cascade" in change["logparams"] else "", cascade=_(" [cascading]") if "cascade" in change["logparams"] else "",
reason=parsed_comment) reason=parsed_comment)
elif action == "protect/unprotect": elif action == "protect/unprotect":