Revert "Made changes to redaction function based on most recent RcGcDw commits"

This reverts commit db7665b5f6.
This commit is contained in:
Frisk 2024-10-09 18:56:00 +02:00
parent db7665b5f6
commit 029fd86826

View file

@ -236,15 +236,15 @@ class Wiki:
# ids can refer to multiple events, and search does not support additive mode, so we have to loop it for all ids
async for stacked_message, webhook in self.message_history.fetch_stacked_from_db({mode: ids, "message_display": [1, 2, 3]}):
for message in [message for message in stacked_message.message_list if message.metadata.matches({mode: ids})]:
if censored_properties.get("user", False) and "url" in message["author"]:
if "user" in censored_properties and "url" in message["author"]:
message["author"]["name"] = context._("hidden")
message["author"].pop("url")
if (censored_properties.get("action", False) or (censored_properties.get("content", False) and mode == "log_id")) and "url" in message.embed:
if "action" in censored_properties and "url" in message.embed:
message["title"] = context._("~~hidden~~")
message.embed.pop("url")
if censored_properties.get("content", False) and "fields" in message.embed:
if "content" in censored_properties and "fields" in message.embed:
message.embed.pop("fields")
if censored_properties.get("comment", False):
if "comment" in censored_properties:
message["description"] = context._("~~hidden~~")
logger.debug(f"Rev-deleting contents of message {stacked_message.discord_callback_message_id} due to being in list of ids {ids}.")
messagequeue.add_message(QueueEntry(stacked_message, [stacked_message.webhook], self, method="PATCH"))