From 4061e1ce59c76d35ee589185cf07438da54f3d21 Mon Sep 17 00:00:00 2001 From: Markus-Rost Date: Mon, 30 Nov 2020 19:14:27 +0100 Subject: [PATCH 1/2] fix oldid --- src/rc_formatters.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rc_formatters.py b/src/rc_formatters.py index 600b177..ba55c05 100644 --- a/src/rc_formatters.py +++ b/src/rc_formatters.py @@ -477,9 +477,9 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "pagetranslation/mark": link = create_article_path(change["title"]) if "?" in link: - link = link + "&oldid=" + change["logparams"]["revision"] + link = link + "&oldid={}".format(change["logparams"]["revision"]) else: - link = link + "?oldid=" + change["logparams"]["revision"] + link = link + "?oldid={}".format(change["logparams"]["revision"]) link = link_formatter(link) content = "🌐 " + _("[{author}]({author_url}) marked [{article}]({article_url}) for translation{comment}").format( author=author, author_url=author_url, @@ -594,9 +594,9 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "translationreview/message": link = create_article_path(change["title"]) if "?" in link: - link = link + "&oldid=" + change["logparams"]["revision"] + link = link + "&oldid={}".format(change["logparams"]["revision"]) else: - link = link + "?oldid=" + change["logparams"]["revision"] + link = link + "?oldid={}".format(change["logparams"]["revision"]) link = link_formatter(link) content = "🌐 " + _("[{author}]({author_url}) reviewed translation [{article}]({article_url}){comment}").format( author=author, author_url=author_url, @@ -1127,9 +1127,9 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): elif action == "pagetranslation/mark": link = create_article_path(change["title"]) if "?" in link: - link = link + "&oldid=" + change["logparams"]["revision"] + link = link + "&oldid={}".format(change["logparams"]["revision"]) else: - link = link + "?oldid=" + change["logparams"]["revision"] + link = link + "?oldid={}".format(change["logparams"]["revision"]) embed["title"] = _("Marked \"{article}\" for translation").format(article=change["title"]) elif action == "pagetranslation/unmark": link = create_article_path(change["title"]) @@ -1177,9 +1177,9 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): elif action == "translationreview/message": link = create_article_path(change["title"]) if "?" in link: - link = link + "&oldid=" + change["logparams"]["revision"] + link = link + "&oldid={}".format(change["logparams"]["revision"]) else: - link = link + "?oldid=" + change["logparams"]["revision"] + link = link + "?oldid={}".format(change["logparams"]["revision"]) embed["title"] = _("Reviewed translation \"{article}\"").format(article=change["title"]) elif action == "translationreview/group": link = create_article_path(change["title"]) From 0f9124d7d66ec0fe88f73cd64737cda1c9f4d1c3 Mon Sep 17 00:00:00 2001 From: Markus-Rost Date: Mon, 30 Nov 2020 21:42:21 +0100 Subject: [PATCH 2/2] Extension:DataDump #183 and linked Special:ManageWiki because the settings are readable by default --- src/rc_formatters.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/rc_formatters.py b/src/rc_formatters.py index ba55c05..ec0d9f3 100644 --- a/src/rc_formatters.py +++ b/src/rc_formatters.py @@ -474,6 +474,16 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment ) + elif action == "datadump/generate": + content = "🏅 " + _("[{author}]({author_url}) generated *{file}* dump{comment}").format( + author=author, author_url=author_url, file=change["logparams"]["filename"], + comment=parsed_comment + ) + elif action == "datadump/delete": + content = "🏅 " + _("[{author}]({author_url}) deleted *{file}* dump{comment}").format( + author=author, author_url=author_url, file=change["logparams"]["filename"], + comment=parsed_comment + ) elif action == "pagetranslation/mark": link = create_article_path(change["title"]) if "?" in link: @@ -1095,35 +1105,41 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): link = create_article_path("Special:Tags") embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=change["logparams"]["tag"]) elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki - link = create_article_path("") + link = create_article_path(change["title"]) embed["title"] = _("Changed wiki settings") 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", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) elif action == "managewiki/lock": embed["title"] = _("Locked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) elif action == "managewiki/namespaces": embed["title"] = _("Modified a \"{namespace_name}\" namespace").format(namespace_name=change["logparams"].get("namespace", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) 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", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) embed.add_field(_('Wiki'), change["logparams"].get("wiki", _("Unknown"))) elif action == "managewiki/rights": group_name = change["title"].split("/permissions/", 1)[1] embed["title"] = _("Modified \"{usergroup_name}\" usergroup").format(usergroup_name=group_name) - link = create_article_path("") + link = create_article_path(change["title"]) elif action == "managewiki/undelete": embed["title"] = _("Restored a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) elif action == "managewiki/unlock": embed["title"] = _("Unlocked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown"))) - link = create_article_path("") + link = create_article_path(change["title"]) + elif action == "datadump/generate": + embed["title"] = _("Generated {file} dump").format(file=change["logparams"]["filename"]) + link = create_article_path(change["title"]) + elif action == "datadump/delete": + embed["title"] = _("Deleted {file} dump").format(file=change["logparams"]["filename"]) + link = create_article_path(change["title"]) elif action == "pagetranslation/mark": link = create_article_path(change["title"]) if "?" in link: