Merge remote-tracking branch 'origin/unknown_data'

This commit is contained in:
Frisk 2020-07-28 15:58:42 +02:00
commit bcad172bbb
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 8 additions and 8 deletions

View file

@ -2,6 +2,7 @@ import ipaddress
import math import math
import re import re
import time import time
import json
import logging import logging
from src.config import settings from src.config import settings
from src.misc import link_formatter, create_article_path, parse_link, profile_field_name, ContentParser from src.misc import link_formatter, create_article_path, parse_link, profile_field_name, ContentParser
@ -675,8 +676,13 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha
logger.warning("No entry for {event} with params: {params}".format(event=action, params=change)) logger.warning("No entry for {event} with params: {params}".format(event=action, params=change))
link = create_article_path("Special:RecentChanges", WIKI_ARTICLE_PATH) link = create_article_path("Special:RecentChanges", WIKI_ARTICLE_PATH)
embed["title"] = _("Unknown event `{event}`").format(event=action) embed["title"] = _("Unknown event `{event}`").format(event=action)
embed["color"] = 0
if settings["support"]: if settings["support"]:
embed.add_field(_("Report this on the support server"), settings["support"]) change_params = "[```json\n{params}\n```]({support})".format(params=json.dumps(change, indent=2), support=settings["support"])
if len(change_params) > 1000:
embed.add_field(_("Report this on the support server"), settings["support"])
else:
embed.add_field(_("Report this on the support server"), change_params)
embed["author"]["icon_url"] = settings["appearance"]["embed"].get(action, {"icon": None})["icon"] embed["author"]["icon_url"] = settings["appearance"]["embed"].get(action, {"icon": None})["icon"]
embed["url"] = link embed["url"] = link
if parsed_comment is not None: if parsed_comment is not None:

View file

@ -199,16 +199,10 @@ async def essential_info(change: dict, changed_categories, local_wiki: Wiki, db_
identification_string = change["type"] identification_string = change["type"]
elif change["type"] == "log": elif change["type"] == "log":
identification_string = "{logtype}/{logaction}".format(logtype=change["logtype"], logaction=change["logaction"]) identification_string = "{logtype}/{logaction}".format(logtype=change["logtype"], logaction=change["logaction"])
if identification_string not in supported_logs:
logger.warning(
"This event is not implemented in the script. Please make an issue on the tracker attaching the following info: wiki url, time, and this information: {}".format(
change))
return
elif change["type"] == "categorize": elif change["type"] == "categorize":
return return
else: else:
logger.warning("This event is not implemented in the script. Please make an issue on the tracker attaching the following info: wiki url, time, and this information: {}".format(change)) identification_string = change["type"]
return
additional_data = {"namespaces": request["query"]["namespaces"], "tags": {}} additional_data = {"namespaces": request["query"]["namespaces"], "tags": {}}
for tag in request["query"]["tags"]: for tag in request["query"]["tags"]:
try: try: