mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-03-06 09:27:33 +01:00
Los hilos funcionan ahora como en Mastodon. Refactorización de código
This commit is contained in:
@@ -27,6 +27,8 @@ indicate_img = boolean(default=True)
|
|||||||
|
|
||||||
[other_buffers]
|
[other_buffers]
|
||||||
timelines = list(default=list())
|
timelines = list(default=list())
|
||||||
|
followers_timelines = list(default=list())
|
||||||
|
following_timelines = list(default=list())
|
||||||
searches = list(default=list())
|
searches = list(default=list())
|
||||||
muted_buffers = list(default=list())
|
muted_buffers = list(default=list())
|
||||||
autoread_buffers = list(default=list(notifications))
|
autoread_buffers = list(default=list(notifications))
|
||||||
|
|||||||
@@ -137,6 +137,18 @@ class Handler:
|
|||||||
kwargs=dict(parent=controller.view.nb, name="direct_messages", session=session)
|
kwargs=dict(parent=controller.view.nb, name="direct_messages", session=session)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Timelines container
|
||||||
|
pub.sendMessage(
|
||||||
|
"createBuffer",
|
||||||
|
buffer_type="EmptyBuffer",
|
||||||
|
session_type="base",
|
||||||
|
buffer_title=_("Timelines"),
|
||||||
|
parent_tab=root_position,
|
||||||
|
start=False,
|
||||||
|
kwargs=dict(parent=controller.view.nb, name="timelines", account=name)
|
||||||
|
)
|
||||||
|
timelines_position = controller.view.search("timelines", name)
|
||||||
|
|
||||||
# Saved user timelines
|
# Saved user timelines
|
||||||
try:
|
try:
|
||||||
timelines = session.settings["other_buffers"].get("timelines")
|
timelines = session.settings["other_buffers"].get("timelines")
|
||||||
@@ -152,7 +164,7 @@ class Handler:
|
|||||||
buffer_type="UserTimeline",
|
buffer_type="UserTimeline",
|
||||||
session_type="blueski",
|
session_type="blueski",
|
||||||
buffer_title=title,
|
buffer_title=title,
|
||||||
parent_tab=root_position,
|
parent_tab=timelines_position,
|
||||||
start=False,
|
start=False,
|
||||||
kwargs=dict(parent=controller.view.nb, name=f"{handle}-timeline", session=session, actor=actor, handle=handle)
|
kwargs=dict(parent=controller.view.nb, name=f"{handle}-timeline", session=session, actor=actor, handle=handle)
|
||||||
)
|
)
|
||||||
@@ -454,7 +466,7 @@ class Handler:
|
|||||||
buffer_type="UserTimeline",
|
buffer_type="UserTimeline",
|
||||||
session_type="blueski",
|
session_type="blueski",
|
||||||
buffer_title=title,
|
buffer_title=title,
|
||||||
parent_tab=main_controller.view.search(account_name, account_name),
|
parent_tab=main_controller.view.search("timelines", account_name),
|
||||||
start=True,
|
start=True,
|
||||||
kwargs=dict(parent=main_controller.view.nb, name=list_name, session=session, actor=actor, handle=handle)
|
kwargs=dict(parent=main_controller.view.nb, name=list_name, session=session, actor=actor, handle=handle)
|
||||||
)
|
)
|
||||||
@@ -465,7 +477,11 @@ class Handler:
|
|||||||
if isinstance(timelines, str):
|
if isinstance(timelines, str):
|
||||||
timelines = [t for t in timelines.split(",") if t]
|
timelines = [t for t in timelines.split(",") if t]
|
||||||
key = handle or actor
|
key = handle or actor
|
||||||
if key and key not in timelines:
|
if key in timelines:
|
||||||
|
from wxUI import commonMessageDialogs
|
||||||
|
commonMessageDialogs.timeline_exist()
|
||||||
|
return
|
||||||
|
if key:
|
||||||
timelines.append(key)
|
timelines.append(key)
|
||||||
session.settings["other_buffers"]["timelines"] = timelines
|
session.settings["other_buffers"]["timelines"] = timelines
|
||||||
session.settings.write()
|
session.settings.write()
|
||||||
|
|||||||
@@ -359,6 +359,19 @@ class UserTimeline(BaseBuffer):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if isinstance(actor, str) and not actor.startswith("did:"):
|
||||||
|
try:
|
||||||
|
profile = self.session.get_profile(actor)
|
||||||
|
if profile:
|
||||||
|
def g(obj, key, default=None):
|
||||||
|
if isinstance(obj, dict):
|
||||||
|
return obj.get(key, default)
|
||||||
|
return getattr(obj, key, default)
|
||||||
|
did = g(profile, "did")
|
||||||
|
if did:
|
||||||
|
actor = did
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
res = api.app.bsky.feed.get_author_feed({
|
res = api.app.bsky.feed.get_author_feed({
|
||||||
"actor": actor,
|
"actor": actor,
|
||||||
"limit": count,
|
"limit": count,
|
||||||
|
|||||||
Reference in New Issue
Block a user