Fix potential duplicate unauthenticated user join/leave message in Matrix
This commit is contained in:
@@ -584,10 +584,11 @@ class Portal:
|
|||||||
|
|
||||||
async def leave_matrix(self, user, source, event_id):
|
async def leave_matrix(self, user, source, event_id):
|
||||||
if not user.logged_in:
|
if not user.logged_in:
|
||||||
response = await self.bot.client.send_message(
|
async with self.require_send_lock(self.bot.tgid):
|
||||||
self.peer, f"__{user.displayname} left the room.__", markdown=True)
|
response = await self.bot.client.send_message(
|
||||||
space = self.tgid if self.peer_type == "channel" else self.bot.tgid
|
self.peer, f"__{user.displayname} left the room.__", markdown=True)
|
||||||
self.is_duplicate(response, (event_id, space))
|
space = self.tgid if self.peer_type == "channel" else self.bot.tgid
|
||||||
|
self.is_duplicate(response, (event_id, space))
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.peer_type == "user":
|
if self.peer_type == "user":
|
||||||
@@ -615,10 +616,11 @@ class Portal:
|
|||||||
|
|
||||||
async def join_matrix(self, user, event_id):
|
async def join_matrix(self, user, event_id):
|
||||||
if not user.logged_in:
|
if not user.logged_in:
|
||||||
response = await self.bot.client.send_message(
|
async with self.require_send_lock(self.bot.tgid):
|
||||||
self.peer, f"__{user.displayname} joined the room.__", markdown=True)
|
response = await self.bot.client.send_message(
|
||||||
space = self.tgid if self.peer_type == "channel" else self.bot.tgid
|
self.peer, f"__{user.displayname} joined the room.__", markdown=True)
|
||||||
self.is_duplicate(response, (event_id, space))
|
space = self.tgid if self.peer_type == "channel" else self.bot.tgid
|
||||||
|
self.is_duplicate(response, (event_id, space))
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.peer_type == "channel":
|
if self.peer_type == "channel":
|
||||||
|
|||||||
Reference in New Issue
Block a user