mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Partially add ManageWiki
This commit is contained in:
parent
20d4e7ab86
commit
ab67bc64cd
|
@ -326,6 +326,35 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
|
||||||
content = "⚙️ "+_(
|
content = "⚙️ "+_(
|
||||||
"[{author}]({author_url}) changed wiki settings ({reason})".format(author=author, author_url=author_url,
|
"[{author}]({author_url}) changed wiki settings ({reason})".format(author=author, author_url=author_url,
|
||||||
reason=parsed_comment))
|
reason=parsed_comment))
|
||||||
|
elif action == "managewiki/delete":
|
||||||
|
content = "🗑️ "+_("[{author}]({author_url}) deleted a wiki *{wiki_name}* ({comment})").format(author=author, author_url=author_url,
|
||||||
|
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
|
||||||
|
elif action == "managewiki/lock":
|
||||||
|
content = "🔒 "+_("[{author}]({author_url}) locked a wiki *{wiki_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
|
||||||
|
elif action == "managewiki/namespaces":
|
||||||
|
content = "📦 "+_("[{author}]({author_url}) modified a namespace *{namespace_name}* on *{wiki_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url, namespace_name=change["logparams"].get("namespace", _("Unknown")),
|
||||||
|
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
|
||||||
|
elif action == "managewiki/namespaces-delete":
|
||||||
|
content = "🗑️ " + _(
|
||||||
|
"[{author}]({author_url}) deleted a namespace *{namespace_name}* on *{wiki_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url,
|
||||||
|
namespace_name=change["logparams"].get("namespace", _("Unknown")),
|
||||||
|
wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment)
|
||||||
|
elif action == "managewiki/rights":
|
||||||
|
content = "🏅 " + _("[{author}]({author_url}) modified user group *{group_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url, group_name=change["title"][32:], comment=parsed_comment
|
||||||
|
)
|
||||||
|
elif action == "managewiki/undelete":
|
||||||
|
content = "🏅 " + _("[{author}]({author_url}) restored a wiki *{wiki_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment
|
||||||
|
)
|
||||||
|
elif action == "managewiki/unlock":
|
||||||
|
content = "🏅 " + _("[{author}]({author_url}) unlocked a wiki *{wiki_name}* ({comment})").format(
|
||||||
|
author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")),
|
||||||
|
comment=parsed_comment
|
||||||
|
)
|
||||||
elif action == "suppressed":
|
elif action == "suppressed":
|
||||||
content = "👁️ "+_("An action has been hidden by administration.")
|
content = "👁️ "+_("An action has been hidden by administration.")
|
||||||
else:
|
else:
|
||||||
|
@ -711,10 +740,34 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha
|
||||||
link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH)
|
link = create_article_path("Special:Tags", WIKI_ARTICLE_PATH)
|
||||||
embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=change["logparams"]["tag"])
|
embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=change["logparams"]["tag"])
|
||||||
elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki
|
elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki
|
||||||
link = create_article_path("")
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
embed["title"] = _("Changed wiki settings")
|
embed["title"] = _("Changed wiki settings")
|
||||||
if change["logparams"].get("changes", ""):
|
if change["logparams"].get("changes", ""):
|
||||||
embed.add_field("Setting", 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("", WIKI_ARTICLE_PATH)
|
||||||
|
elif action == "managewiki/lock":
|
||||||
|
embed["title"] = _("Locked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
|
||||||
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
|
elif action == "managewiki/namespaces":
|
||||||
|
embed["title"] = _("Modified a \"{namespace_name}\" namespace").format(namespace_name=change["logparams"].get("namespace", _("Unknown")))
|
||||||
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
|
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("", WIKI_ARTICLE_PATH)
|
||||||
|
embed.add_field(_('Wiki'), change["logparams"].get("wiki", _("Unknown")))
|
||||||
|
elif action == "managewiki/rights":
|
||||||
|
embed["title"] = _("Modified \"{usergroup_name}\" usergroup").format(usergroup_name=change["title"][32:])
|
||||||
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
|
elif action == "managewiki/undelete":
|
||||||
|
embed["title"] = _("Restored a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
|
||||||
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
|
elif action == "managewiki/unlock":
|
||||||
|
embed["title"] = _("Unlocked a \"{wiki}\" wiki").format(wiki=change["logparams"].get("wiki", _("Unknown")))
|
||||||
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
elif action == "suppressed":
|
elif action == "suppressed":
|
||||||
link = create_article_path("", WIKI_ARTICLE_PATH)
|
link = create_article_path("", WIKI_ARTICLE_PATH)
|
||||||
embed["title"] = _("Action has been hidden by administration.")
|
embed["title"] = _("Action has been hidden by administration.")
|
||||||
|
|
15
src/wiki.py
15
src/wiki.py
|
@ -17,7 +17,20 @@ from bs4 import BeautifulSoup
|
||||||
|
|
||||||
logger = logging.getLogger("rcgcdb.wiki")
|
logger = logging.getLogger("rcgcdb.wiki")
|
||||||
|
|
||||||
supported_logs = ["protect/protect", "protect/modify", "protect/unprotect", "upload/overwrite", "upload/upload", "delete/delete", "delete/delete_redir", "delete/restore", "delete/revision", "delete/event", "import/upload", "import/interwiki", "merge/merge", "move/move", "move/move_redir", "protect/move_prot", "block/block", "block/unblock", "block/reblock", "rights/rights", "rights/autopromote", "abusefilter/modify", "abusefilter/create", "interwiki/iw_add", "interwiki/iw_edit", "interwiki/iw_delete", "curseprofile/comment-created", "curseprofile/comment-edited", "curseprofile/comment-deleted", "curseprofile/comment-purged", "curseprofile/profile-edited", "curseprofile/comment-replied", "contentmodel/change", "sprite/sprite", "sprite/sheet", "sprite/slice", "managetags/create", "managetags/delete", "managetags/activate", "managetags/deactivate", "tag/update", "cargo/createtable", "cargo/deletetable", "cargo/recreatetable", "cargo/replacetable", "upload/revert", "managewiki/settings"]
|
supported_logs = {"protect/protect", "protect/modify", "protect/unprotect", "upload/overwrite", "upload/upload",
|
||||||
|
"delete/delete", "delete/delete_redir", "delete/restore", "delete/revision", "delete/event",
|
||||||
|
"import/upload", "import/interwiki", "merge/merge", "move/move", "move/move_redir",
|
||||||
|
"protect/move_prot", "block/block", "block/unblock", "block/reblock", "rights/rights",
|
||||||
|
"rights/autopromote", "abusefilter/modify", "abusefilter/create", "interwiki/iw_add",
|
||||||
|
"interwiki/iw_edit", "interwiki/iw_delete", "curseprofile/comment-created",
|
||||||
|
"curseprofile/comment-edited", "curseprofile/comment-deleted", "curseprofile/comment-purged",
|
||||||
|
"curseprofile/profile-edited", "curseprofile/comment-replied", "contentmodel/change", "sprite/sprite",
|
||||||
|
"sprite/sheet", "sprite/slice", "managetags/create", "managetags/delete", "managetags/activate",
|
||||||
|
"managetags/deactivate", "tag/update", "cargo/createtable", "cargo/deletetable",
|
||||||
|
"cargo/recreatetable", "cargo/replacetable", "upload/revert", "newusers/create",
|
||||||
|
"newusers/autocreate", "newusers/create2", "newusers/byemail", "newusers/newusers",
|
||||||
|
"managewiki/settings", "managewiki/delete", "managewiki/lock", "managewiki/unlock",
|
||||||
|
"managewiki/namespaces", "managewiki/namespaces-delete", "managewiki/rights", "managewiki/undelete"}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
Loading…
Reference in a new issue