mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-07-29 02:31:19 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user