Título de converrsaciones

This commit is contained in:
Jesús Pavón Abián
2026-02-01 12:39:50 +01:00
parent 4a9214ab71
commit d87d7ffcb5
3 changed files with 31 additions and 8 deletions

View File

@@ -290,9 +290,23 @@ class Handler:
if not uri: return
# Buffer Title
author = getattr(item, "author", None) or (item.get("post", {}).get("author") if isinstance(item, dict) else None)
handle = getattr(author, "handle", "unknown") if author else "unknown"
title = _("Conversation with {0}").format(handle)
handle = None
display_name = None
if hasattr(buffer, "get_selected_item_author_details"):
details = buffer.get_selected_item_author_details()
if details:
handle = details.get("handle")
if not handle:
def g(obj, key, default=None):
if isinstance(obj, dict):
return obj.get(key, default)
return getattr(obj, key, default)
author = g(item, "author") or g(g(item, "post"), "author")
if author:
handle = g(author, "handle")
display_name = g(author, "displayName") or g(author, "display_name")
label = handle or display_name or _("Unknown")
title = _("Conversation with {0}").format(label)
from pubsub import pub
pub.sendMessage(

View File

@@ -10,6 +10,7 @@ from controller.buffers.base import base
from controller.blueski import messages as blueski_messages
from sessions.blueski import compose
from wxUI.buffers.blueski import panels as BlueskiPanels
from wxUI import commonMessageDialogs
log = logging.getLogger("controller.buffers.blueski.base")
@@ -504,12 +505,10 @@ class BaseBuffer(base.Buffer):
import application
controller = application.app.controller
details = self.get_selected_item_author_details()
handle = "Unknown"
if isinstance(item, dict):
handle = item.get("author", {}).get("handle", "Unknown")
else:
handle = getattr(getattr(item, "author", None), "handle", "Unknown")
if details:
handle = details.get("handle") or "Unknown"
title = _("Conversation: {0}").format(handle)
controller.create_buffer(
@@ -690,6 +689,10 @@ class BaseBuffer(base.Buffer):
def remove_buffer(self, force=False):
if self.type in ("conversation", "chat_messages") or self.name.lower().startswith("conversation"):
if not force:
dlg = commonMessageDialogs.remove_buffer()
if dlg != widgetUtils.YES:
return False
try:
self.session.db.pop(self.name, None)
except Exception:

View File

@@ -368,6 +368,12 @@ class SearchBuffer(BaseBuffer):
def remove_buffer(self, force=False):
"""Search buffers can always be removed."""
if not force:
from wxUI import commonMessageDialogs
import widgetUtils
dlg = commonMessageDialogs.remove_buffer()
if dlg != widgetUtils.YES:
return False
try:
self.session.db.pop(self.name, None)
except Exception: