This commit is contained in:
Jesús Pavón Abián
2026-01-11 20:16:39 +01:00
parent 932e44a9c9
commit 56d05b60a1
3 changed files with 37 additions and 7 deletions

View File

@@ -79,6 +79,7 @@ class BaseBuffer(base.Buffer):
uri = self.get_selected_item_id()
if not uri:
uri = item.get("uri") if isinstance(item, dict) else getattr(item, "uri", None)
reply_cid = self.get_selected_item_cid()
# Attempt to get CID if present for consistency, though send_message handles it
def g(obj, key, default=None):
@@ -97,8 +98,13 @@ class BaseBuffer(base.Buffer):
dlg = postDialogs.Post(caption=_("Reply"), text=initial_text)
if dlg.ShowModal() == wx.ID_OK:
text, files, cw, langs = dlg.get_payload()
self.session.send_message(message=text, files=files, reply_to=uri, cw_text=cw, langs=langs)
self.session.send_message(message=text, files=files, reply_to=uri, reply_to_cid=reply_cid, cw_text=cw, langs=langs)
output.speak(_("Sending reply..."))
if getattr(self, "type", "") == "conversation":
try:
self.start_stream(mandatory=True, play_sound=False)
except Exception:
pass
dlg.Destroy()
def on_repost(self, evt):
@@ -438,6 +444,22 @@ class BaseBuffer(base.Buffer):
return getattr(item, "uri", None) or getattr(getattr(item, "post", None), "uri", None)
def get_selected_item_cid(self):
item = self.get_item()
if not item:
return None
if isinstance(item, dict):
cid = item.get("cid")
if cid:
return cid
post = item.get("post") or item.get("record")
if isinstance(post, dict):
return post.get("cid")
return getattr(post, "cid", None)
return getattr(item, "cid", None) or getattr(getattr(item, "post", None), "cid", None)
def get_selected_item_author_details(self):
item = self.get_item()
if not item:

View File

@@ -735,6 +735,9 @@ class Controller(object):
selected_item_uri = None
if hasattr(buffer, "get_selected_item_id"):
selected_item_uri = buffer.get_selected_item_id()
selected_item_cid = None
if hasattr(buffer, "get_selected_item_cid"):
selected_item_cid = buffer.get_selected_item_cid()
if not selected_item_uri:
output.speak(_("No item selected to reply to."), True)
return
@@ -754,10 +757,10 @@ class Controller(object):
dlg.Destroy()
if not text:
return
try:
uri = session.send_message(text, reply_to=selected_item_uri)
if uri:
output.speak(_("Reply sent."), True)
try:
uri = session.send_message(text, reply_to=selected_item_uri, reply_to_cid=selected_item_cid)
if uri:
output.speak(_("Reply sent."), True)
else:
output.speak(_("Failed to send reply."), True)
except Exception:
@@ -774,7 +777,7 @@ class Controller(object):
if not text and not files:
return
try:
uri = session.send_message(text, files=files, cw_text=cw_text, is_sensitive=bool(cw_text), languages=langs, reply_to=selected_item_uri)
uri = session.send_message(text, files=files, cw_text=cw_text, is_sensitive=bool(cw_text), languages=langs, reply_to=selected_item_uri, reply_to_cid=selected_item_cid)
if uri:
output.speak(_("Reply sent."), True)
try:

View File

@@ -328,7 +328,12 @@ class Session(base.baseSession):
if reply_to:
# Resolve to proper at:// uri when possible
reply_uri = _normalize_to_uri(reply_to) or reply_to
parent_ref = _get_strong_ref(reply_uri)
reply_cid = kwargs.get("reply_to_cid")
parent_ref = None
if reply_uri and reply_cid:
parent_ref = {"uri": reply_uri, "cid": reply_cid}
if not parent_ref:
parent_ref = _get_strong_ref(reply_uri)
root_ref = parent_ref
# Try to fetch thread to find actual root for deep replies
try: