mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Merge branch 'global-af-log' into 'testing'
Show wiki for global abuse filter logs See merge request chicken-riders/RcGcDw!127
This commit is contained in:
commit
9785331f00
|
@ -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")),
|
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)
|
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)
|
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.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)
|
embed_helper(ctx, embed, change, is_anon=abuse_filter_is_ip(change), set_desc=False)
|
||||||
return embed
|
return embed
|
||||||
|
@ -73,8 +75,12 @@ def compact_abuselog(ctx: Context, change: dict):
|
||||||
results = change["result"].split(",")
|
results = change["result"].split(",")
|
||||||
action = abuselog_action(results)
|
action = abuselog_action(results)
|
||||||
author, author_url = compact_author(ctx, change, is_anon=abuse_filter_is_ip(change))
|
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(
|
if change.get("wiki", None):
|
||||||
author=author, author_url=author_url, abuse_filter=sanitize_to_markdown(change["filter"]),
|
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"]))),
|
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")),
|
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"))))),
|
target_url=clean_link(ctx.client.create_article_path(sanitize_to_url(change.get("title", ctx._("Unknown"))))),
|
||||||
|
|
|
@ -79,6 +79,9 @@ from src.configloader import settings
|
||||||
# ],
|
# ],
|
||||||
# "result": [
|
# "result": [
|
||||||
# "disallow"
|
# "disallow"
|
||||||
|
# ],
|
||||||
|
# "wiki": [
|
||||||
|
# "en_wiki"
|
||||||
# ]
|
# ]
|
||||||
# }
|
# }
|
||||||
# ]
|
# ]
|
||||||
|
@ -190,6 +193,9 @@ def edit_alerts_hook(message, metadata, context, change):
|
||||||
req_result = requirement.get("result", [])
|
req_result = requirement.get("result", [])
|
||||||
if req_result and not list(set(change["result"].split(",")) & set(req_result)):
|
if req_result and not list(set(change["result"].split(",")) & set(req_result)):
|
||||||
raise RequirementNotMet
|
raise RequirementNotMet
|
||||||
|
req_wiki = requirement.get("wiki", [])
|
||||||
|
if req_wiki and change.get("wiki", None) not in req_wiki:
|
||||||
|
raise RequirementNotMet
|
||||||
except RequirementNotMet:
|
except RequirementNotMet:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
"show_added_categories": true,
|
"show_added_categories": true,
|
||||||
"show_bots": false,
|
"show_bots": false,
|
||||||
"show_abuselog": false,
|
"show_abuselog": false,
|
||||||
|
"show_global_abuselog": false,
|
||||||
"show_patrolled": true,
|
"show_patrolled": true,
|
||||||
"hide_ips": false,
|
"hide_ips": false,
|
||||||
"hide_ip_editcount": false,
|
"hide_ip_editcount": false,
|
||||||
|
|
|
@ -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"
|
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):
|
if settings.get("show_abuselog", False):
|
||||||
params["afllimit"] = amount
|
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
|
return params
|
||||||
|
|
||||||
def prepare_rc(self, changes: list, amount: int):
|
def prepare_rc(self, changes: list, amount: int):
|
||||||
|
|
Loading…
Reference in a new issue