mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Fully address #283 by adding dwhitelist modify events and fixing module importing for globalblocking formatter
This commit is contained in:
parent
6c255dc6ae
commit
36f2ba1729
|
@ -27,3 +27,4 @@ import extensions.base.renameuser
|
||||||
import extensions.base.migrators
|
import extensions.base.migrators
|
||||||
import extensions.base.approvedrevs
|
import extensions.base.approvedrevs
|
||||||
import extensions.base.comments
|
import extensions.base.comments
|
||||||
|
import extensions.base.globalblocking
|
||||||
|
|
|
@ -27,7 +27,8 @@ def embed_gblblock_gblock2(ctx: Context, change: dict):
|
||||||
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
||||||
user = change["title"].split(':', 1)[1]
|
user = change["title"].split(':', 1)[1]
|
||||||
embed["url"] = ctx.client.create_article_path("Special:Contributions/{user}".format(user=user))
|
embed["url"] = ctx.client.create_article_path("Special:Contributions/{user}".format(user=user))
|
||||||
embed["title"] = ctx._("Globally blocked {blocked_user} ({options})").format(blocked_user=user, options=change["logparams"].get("0", ctx._("no further information about the block")))
|
embed["title"] = ctx._("Globally blocked {blocked_user}").format(blocked_user=user)
|
||||||
|
embed["description"] = change["logparams"].get("0", ctx._("no further information about the block"))
|
||||||
embed_helper(ctx, embed, change)
|
embed_helper(ctx, embed, change)
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
@ -47,8 +48,8 @@ def compact_gblblock_gblock2(ctx: Context, change: dict):
|
||||||
comment=parsed_comment)
|
comment=parsed_comment)
|
||||||
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
||||||
|
|
||||||
# gblblock/whitelist - Disable locally a global ban on an IP address
|
|
||||||
|
|
||||||
|
# gblblock/whitelist - Disable locally a global ban on an IP address
|
||||||
@formatter.embed(event="gblblock/whitelist", mode="embed")
|
@formatter.embed(event="gblblock/whitelist", mode="embed")
|
||||||
def embed_gblblock_whitelist(ctx: Context, change: dict):
|
def embed_gblblock_whitelist(ctx: Context, change: dict):
|
||||||
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
||||||
|
@ -99,3 +100,57 @@ def compact_gblblock_gunblock(ctx: Context, change: dict):
|
||||||
user_url=link,
|
user_url=link,
|
||||||
comment=parsed_comment)
|
comment=parsed_comment)
|
||||||
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
||||||
|
|
||||||
|
|
||||||
|
# gblblock/modify - Remove a global block on an IP address
|
||||||
|
@formatter.embed(event="gblblock/modify", mode="embed")
|
||||||
|
def embed_gblblock_modify(ctx: Context, change: dict):
|
||||||
|
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
||||||
|
user = change["title"].split(':', 1)[1]
|
||||||
|
embed["url"] = ctx.client.create_article_path("Special:Contributions/{user}".format(user=user))
|
||||||
|
embed["title"] = ctx._("Modified the global block on {blocked_user}").format(blocked_user=user)
|
||||||
|
embed["description"] = change["logparams"].get("0", ctx._("no further information about the block"))
|
||||||
|
embed_helper(ctx, embed, change)
|
||||||
|
return embed
|
||||||
|
|
||||||
|
|
||||||
|
@formatter.compact(event="gblblock/modify", mode="compact")
|
||||||
|
def compact_gblblock_modify(ctx: Context, change: dict):
|
||||||
|
user = change["title"].split(':', 1)[1]
|
||||||
|
author, author_url = compact_author(ctx, change)
|
||||||
|
parsed_comment = compact_summary(ctx)
|
||||||
|
link = clean_link(ctx.client.create_article_path("Special:Contributions/{user}".format(user=user)))
|
||||||
|
content = ctx._(
|
||||||
|
"[{author}]({author_url}) modified the global block on [{user}]({user_url}) {options} {comment}").format(author=author,
|
||||||
|
author_url=author_url,
|
||||||
|
user=sanitize_to_markdown(user),
|
||||||
|
options=change["logparams"].get("0",ctx._("no further information about the block")),
|
||||||
|
user_url=link,
|
||||||
|
comment=parsed_comment)
|
||||||
|
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
||||||
|
|
||||||
|
|
||||||
|
# gblblock/whitelist - Disable locally a global ban
|
||||||
|
@formatter.embed(event="gblblock/dwhitelist", mode="embed")
|
||||||
|
def embed_gblblock_dwhitelist(ctx: Context, change: dict):
|
||||||
|
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
||||||
|
user = change["title"].split(':', 1)[1]
|
||||||
|
embed["url"] = ctx.client.create_article_path("Special:Contributions/{user}".format(user=user))
|
||||||
|
embed["title"] = ctx._("Re-enabled the global block locally on {blocked_user}").format(blocked_user=user)
|
||||||
|
embed_helper(ctx, embed, change)
|
||||||
|
return embed
|
||||||
|
|
||||||
|
|
||||||
|
@formatter.compact(event="gblblock/dwhitelist", mode="compact")
|
||||||
|
def compact_gblblock_dwhitelist(ctx: Context, change: dict):
|
||||||
|
user = change["title"].split(':', 1)[1]
|
||||||
|
author, author_url = compact_author(ctx, change)
|
||||||
|
parsed_comment = compact_summary(ctx)
|
||||||
|
link = clean_link(ctx.client.create_article_path("Special:Contributions/{user}".format(user=user)))
|
||||||
|
content = ctx._(
|
||||||
|
"[{author}]({author_url}) re-enabled the global block locally on [{user}]({user_url}) {comment}").format(author=author,
|
||||||
|
author_url=author_url,
|
||||||
|
user=sanitize_to_markdown(user),
|
||||||
|
user_url=link,
|
||||||
|
comment=parsed_comment)
|
||||||
|
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
||||||
|
|
Loading…
Reference in a new issue