Fixed revdel issue for edit coming after revdeleted one which caused invalid SQL syntax

This commit is contained in:
Frisk 2024-08-31 21:56:40 +02:00
parent 38e73052e6
commit 2a06074df5

View file

@ -251,13 +251,14 @@ class Wiki:
messagequeue.add_message(QueueEntry(stacked_message, [stacked_message.webhook], self, method="PATCH"))
if mode == "rev_id" and "content" in censored_properties: # Erase content field from messages coming AFTER revdel'd edit
middle_ids = (await self.find_middle_next(ids, page_id)).difference(ids)
async for stacked_message, webhook in self.message_history.fetch_stacked_from_db({"rev_id": middle_ids, "message_display": 3}):
for message in [message for message in stacked_message.message_list if
message.metadata.matches({"rev_id": middle_ids})]:
if "content" in censored_properties and "fields" in message.embed:
message.embed.pop("fields")
logger.debug(f"Rev-deleting content of message {stacked_message.discord_callback_message_id} due to being in list of middle ids {middle_ids}.")
messagequeue.add_message(QueueEntry(stacked_message, [stacked_message.webhook], self, method="PATCH"))
if middle_ids: # Ignore if not found any IDs to censor
async for stacked_message, webhook in self.message_history.fetch_stacked_from_db({"rev_id": middle_ids, "message_display": 3}):
for message in [message for message in stacked_message.message_list if
message.metadata.matches({"rev_id": middle_ids})]:
if "content" in censored_properties and "fields" in message.embed:
message.embed.pop("fields")
logger.debug(f"Rev-deleting content of message {stacked_message.discord_callback_message_id} due to being in list of middle ids {middle_ids}.")
messagequeue.add_message(QueueEntry(stacked_message, [stacked_message.webhook], self, method="PATCH"))
# async def downtime_controller(self, down, reason=None):
# if down: