From 6db23b5ed61ae567b8263dc17cc1f390d0599df2 Mon Sep 17 00:00:00 2001 From: Markus-Rost Date: Mon, 4 Jan 2021 17:31:09 +0100 Subject: [PATCH 1/2] Fix tags for the third time --- src/formatters/rc.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/formatters/rc.py b/src/formatters/rc.py index f85734c..3b70e64 100644 --- a/src/formatters/rc.py +++ b/src/formatters/rc.py @@ -971,11 +971,9 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha elif action == "managetags/create": link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) embed["title"] = _("Created a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) - recent_changes.init_info() elif action == "managetags/delete": link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) embed["title"] = _("Deleted a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) - recent_changes.init_info() elif action == "managetags/activate": link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) embed["title"] = _("Activated a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) From e344316491e96d8329e4a028e64a767efcc9d289 Mon Sep 17 00:00:00 2001 From: Markus-Rost Date: Mon, 4 Jan 2021 18:20:03 +0100 Subject: [PATCH 2/2] Improve tag management log --- src/formatters/rc.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/formatters/rc.py b/src/formatters/rc.py index 3b70e64..d4c5b75 100644 --- a/src/formatters/rc.py +++ b/src/formatters/rc.py @@ -345,17 +345,22 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c table = parse_link(paths[3], change["logparams"]["0"]) content = _("[{author}]({author_url}) replaced the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=table) elif action == "managetags/create": - link = link_formatter(create_article_path("Special:Tags", WIKI_ARTICLE_PATH)) - content = _("[{author}]({author_url}) created a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH)) + content = _("[{author}]({author_url}) created the [tag]({tag_url}) \"{tag}\"{comment}").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link, comment=parsed_comment) elif action == "managetags/delete": - link = link_formatter(create_article_path("Special:Tags", WIKI_ARTICLE_PATH)) - content = _("[{author}]({author_url}) deleted a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH)) + if change["logparams"]["count"] == 0: + content = _("[{author}]({author_url}) deleted the [tag]({tag_url}) \"{tag}\"{comment}").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link, comment=parsed_comment) + else: + content = ngettext("[{author}]({author_url}) deleted the [tag]({tag_url}) \"{tag}\" and removed it from {count} revision or log entry{comment}", + "[{author}]({author_url}) deleted the [tag]({tag_url}) \"{tag}\" and removed it from {count} revisions and/or log entries{comment}", + change["logparams"]["count"]).format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link, count=change["logparams"]["count"], comment=parsed_comment) elif action == "managetags/activate": - link = link_formatter(create_article_path("Special:Tags", WIKI_ARTICLE_PATH)) - content = _("[{author}]({author_url}) activated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH)) + content = _("[{author}]({author_url}) activated the [tag]({tag_url}) \"{tag}\"{comment}").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link, comment=parsed_comment) elif action == "managetags/deactivate": - link = link_formatter(create_article_path("Special:Tags", WIKI_ARTICLE_PATH)) - content = _("[{author}]({author_url}) deactivated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH)) + content = _("[{author}]({author_url}) deactivated the [tag]({tag_url}) \"{tag}\"{comment}").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link, comment=parsed_comment) elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki content = _( "[{author}]({author_url}) changed wiki settings{reason}".format(author=author, author_url=author_url, @@ -969,17 +974,19 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha embed["title"] = _("Replaced the Cargo table \"{table}\"").format(table=table.group(1)) parsed_comment = None elif action == "managetags/create": - link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) - embed["title"] = _("Created a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) + link = create_article_path(change["title"], WIKI_ARTICLE_PATH) + embed["title"] = _("Created the tag \"{tag}\"").format(tag=change["logparams"]["tag"]) elif action == "managetags/delete": - link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) - embed["title"] = _("Deleted a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) + link = create_article_path(change["title"], WIKI_ARTICLE_PATH) + embed["title"] = _("Deleted the tag \"{tag}\"").format(tag=change["logparams"]["tag"]) + if change["logparams"]["count"] > 0: + embed.add_field(_('Removed from'), ngettext("{} revision or log entry", "{} revisions and/or log entries", change["logparams"]["count"]).format(change["logparams"]["count"])) elif action == "managetags/activate": - link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) - embed["title"] = _("Activated a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) + link = create_article_path(change["title"], WIKI_ARTICLE_PATH) + embed["title"] = _("Activated the tag \"{tag}\"").format(tag=change["logparams"]["tag"]) elif action == "managetags/deactivate": - link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH) - embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) + link = create_article_path(change["title"], WIKI_ARTICLE_PATH) + embed["title"] = _("Deactivated the tag \"{tag}\"").format(tag=change["logparams"]["tag"]) elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki link = create_article_path(change["title"], WIKI_ARTICLE_PATH) embed["title"] = _("Changed wiki settings")