瀏覽代碼

Enable timestamp massaging for reactions

Tulir Asokan 3 年之前
父節點
當前提交
5e2291db4f
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 4 2
      mautrix_signal/portal.py
  2. 1 1
      mautrix_signal/signal.py

+ 4 - 2
mautrix_signal/portal.py

@@ -683,7 +683,8 @@ class Portal(DBPortal, BasePortal):
             elif content.url:
                 content.info.thumbnail_url = content.url
 
-    async def handle_signal_reaction(self, sender: 'p.Puppet', reaction: Reaction) -> None:
+    async def handle_signal_reaction(self, sender: 'p.Puppet', reaction: Reaction,
+                                     timestamp: int) -> None:
         author_address = await self._resolve_address(reaction.target_author)
         target_id = reaction.target_sent_timestamp
         async with self._reaction_lock:
@@ -715,7 +716,8 @@ class Portal(DBPortal, BasePortal):
 
         intent = sender.intent_for(self)
         # TODO add variation selectors to emoji before sending to Matrix
-        mxid = await intent.react(message.mx_room, message.mxid, reaction.emoji)
+        mxid = await intent.react(message.mx_room, message.mxid, reaction.emoji,
+                                  timestamp=timestamp)
         self.log.debug(f"{sender.address} reacted to {message.mxid} -> {mxid}")
         await self._upsert_reaction(existing, intent, mxid, sender, message, reaction.emoji)
 

+ 1 - 1
mautrix_signal/signal.py

@@ -101,7 +101,7 @@ class SignalHandler(SignaldClient):
             self.log.debug(f"Got new revision of {msg.group_v2.id}, updating info")
             await portal.update_info(user, msg.group_v2, sender)
         if msg.reaction:
-            await portal.handle_signal_reaction(sender, msg.reaction)
+            await portal.handle_signal_reaction(sender, msg.reaction, msg.timestamp)
         if msg.body or msg.attachments or msg.sticker:
             await portal.handle_signal_message(user, sender, msg)
         if msg.group and msg.group.type == "UPDATE":