Show wiki for global abuse filter logs

This commit is contained in:
MarkusRost 2024-09-12 16:30:03 +00:00
parent ecfc859392
commit 413852041e
3 changed files with 10 additions and 3 deletions

View file

@ -63,6 +63,8 @@ def embed_abuselog(ctx: Context, change: dict):
embed.add_field(ctx._("Title"), "[{target}]({target_url})".format(target=change.get("title", ctx._("Unknown")),
target_url=clean_link(ctx.client.create_article_path(sanitize_to_url(change.get("title", ctx._("Unknown")))))), inline=True)
embed.add_field(ctx._("Performed"), abusefilter_actions(change["action"], ctx._, change["action"]), inline=True)
if change.get("wiki", None):
embed.add_field(ctx._("Wiki"), change["wiki"], inline=True)
embed.add_field(ctx._("Action taken"), "\n".join([abusefilter_results(result, ctx._, result) for result in results]))
embed_helper(ctx, embed, change, is_anon=abuse_filter_is_ip(change), set_desc=False)
return embed
@ -73,8 +75,12 @@ def compact_abuselog(ctx: Context, change: dict):
results = change["result"].split(",")
action = abuselog_action(results)
author, author_url = compact_author(ctx, change, is_anon=abuse_filter_is_ip(change))
message = ctx._("[{author}]({author_url}) triggered *[{abuse_filter}]({details_url})*, performing the action \"{action}\" on *[{target}]({target_url})* - action taken: {result}.").format(
author=author, author_url=author_url, abuse_filter=sanitize_to_markdown(change["filter"]),
if change.get("wiki", None):
message = ctx._("[{author}]({author_url}) triggered *[{abuse_filter}]({details_url})*, performing the action \"{action}\" on wiki \"{wiki}\" on *[{target}]({target_url})* - action taken: {result}.")
else:
message = ctx._("[{author}]({author_url}) triggered *[{abuse_filter}]({details_url})*, performing the action \"{action}\" on *[{target}]({target_url})* - action taken: {result}.")
message = message.format(
author=author, author_url=author_url, abuse_filter=sanitize_to_markdown(change["filter"]), wiki=change.get("wiki", None),
details_url=clean_link(ctx.client.create_article_path("Special:AbuseLog/{entry}".format(entry=change["id"]))),
action=abusefilter_actions(change["action"], ctx._, change["action"]), target=change.get("title", ctx._("Unknown")),
target_url=clean_link(ctx.client.create_article_path(sanitize_to_url(change.get("title", ctx._("Unknown"))))),

View file

@ -35,6 +35,7 @@
"show_added_categories": true,
"show_bots": false,
"show_abuselog": false,
"show_global_abuselog": false,
"show_patrolled": true,
"hide_ips": false,
"hide_ip_editcount": false,

View file

@ -145,7 +145,7 @@ class Wiki(object):
params["rctype"] = "edit|new|log|external|categorize" if settings.get("show_added_categories", True) else "edit|new|log|external"
if settings.get("show_abuselog", False):
params["afllimit"] = amount
params["aflprop"] = "ids|user|title|action|result|timestamp|hidden|revid|filter"
params["aflprop"] = "ids|user|title|action|result|timestamp|hidden|revid|filter" + ( "|wiki" if settings.get("show_global_abuselog", False) else "" )
return params
def prepare_rc(self, changes: list, amount: int):