Fix broken application.app.controller references in Bluesky buffers

application.app was never set anywhere - application.py is just a
constants module. Every call to view_chat(), on_new_chat(),
view_conversation(), on_reposts(), and on_likes() crashed with
AttributeError, silently swallowed by get_event's except clause.

Fix: store controller reference on each buffer during create_buffer()
in mainController, then use self.controller instead of the broken
application.app.controller pattern throughout all Bluesky buffer and
dialog code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jesús Pavón Abián
2026-02-18 08:16:23 +01:00
parent 876d02d00e
commit 83781e521e
4 changed files with 13 additions and 17 deletions
+6 -7
View File
@@ -317,8 +317,9 @@ def _extract_post_view_data(session: Any, item: Any) -> dict[str, Any] | None:
class viewPost(base_messages.basicMessage):
def __init__(self, session: Any, item: Any):
def __init__(self, session: Any, item: Any, controller: Any = None):
self.session = session
self.controller = controller
data = _extract_post_view_data(session, item)
if not data:
output.speak(_("No post available to view."), True)
@@ -362,11 +363,10 @@ class viewPost(base_messages.basicMessage):
output.speak(_("Link copied to clipboard."))
def on_reposts(self, *args, **kwargs):
if not self.post_uri:
if not self.post_uri or not self.controller:
return
try:
import application
controller = application.app.controller
controller = self.controller
account_name = self.session.get_name()
list_name = f"{self.post_uri}-reposts"
existing = controller.search_buffer(list_name, account_name)
@@ -391,11 +391,10 @@ class viewPost(base_messages.basicMessage):
pass
def on_likes(self, *args, **kwargs):
if not self.post_uri:
if not self.post_uri or not self.controller:
return
try:
import application
controller = application.app.controller
controller = self.controller
account_name = self.session.get_name()
list_name = f"{self.post_uri}-likes"
existing = controller.search_buffer(list_name, account_name)