Skip to content

Commit

Permalink
Persistent notes are now properly deleted,resolve #3013
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Aug 7, 2021
1 parent 20b31f8 commit ddbee35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ v3.10 adds group conversations while resolving othre bugs and QOL changes. It is
- Invalid arguments are now properly catched and a proper error message is sent.
- Update database after resetting/purging all plugins. ([GH #3011](https://github.com/kyb3r/modmail/pull/3011))
- `thread_auto_close` timer now only resets on non-note and replies from mods. ([GH #3030](https://github.com/kyb3r/modmail/issues/3030))
- Deleted messages are now deleted on both ends. ([GH #3041](https://github.com/kyb3r/modmail/issues/3041), [@JerrieAries](https://github.com/kyb3r/modmail/commit/20b31f8e8b5497943513997fef788d72ae668438))
- Persistent notes are now properly deleted from the database. ([GH #3013](https://github.com/kyb3r/modmail/issues/3013))

## Internal

Expand Down
10 changes: 7 additions & 3 deletions core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,17 @@ async def delete_message(
else:
message1, *message2 = await self.find_linked_messages(message, note=note)
tasks = []

if not isinstance(message, discord.Message):
tasks += [message1.delete()]
elif message2 is not [None]:
for m2 in message2:

for m2 in message2:
if m2 is not None:
tasks += [m2.delete()]
elif message1.embeds[0].author.name.startswith("Persistent Note"):

if message1.embeds[0].author.name.startswith("Persistent Note"):
tasks += [self.bot.api.delete_note(message1.id)]

if tasks:
await asyncio.gather(*tasks)

Expand Down

0 comments on commit ddbee35

Please sign in to comment.