Skip to content

Commit

Permalink
Change: Change the way sessions are named to put the account first, t…
Browse files Browse the repository at this point in the history
…hen the social network.
  • Loading branch information
manuelcortez committed May 22, 2024
1 parent 68651ff commit 14a956d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ TWBlue Changelog

## changes in this version

* Core:
* The way sessions are named has been changed. Now the account is indicated first, followed by the social network it belongs to.
* Mastodon:
* fixed an error that caused TWBlue to not display some posts correctly.
* Fixed name for community timelines when created during startup. Now it should be clear if it's a federated or local timeline.
Expand Down
2 changes: 2 additions & 0 deletions src/sessions/gotosocial/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
class Session(session.Session):
# disable version check so Mastodon.py won't throw exceptions.
version_check_mode = "none"
name = "GoToSocial"

def get_lists(self):
""" Gets the lists that the user is subscribed to and stores them in the database. Returns None."""
self.db["lists"] = []

def get_muted_users(self):
self.db["muted_users"] = []
5 changes: 3 additions & 2 deletions src/sessions/mastodon/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

class Session(base.baseSession):
version_check_mode = "created"
name = "Mastodon"

def __init__(self, *args, **kwargs):
super(Session, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -52,7 +53,7 @@ def login(self, verify_credentials=True):
log.debug("Logged.")
self.counter = 0
except MastodonError:
log.exception("The login attempt failed.")
log.exception(f"The login attempt failed on instance {self.settings['mastodon']['instance']}.")
self.logged = False
else:
self.logged = False
Expand Down Expand Up @@ -241,7 +242,7 @@ def get_name(self):
instance = self.settings["mastodon"]["instance"]
instance = instance.replace("https://", "")
user = self.settings["mastodon"]["user_name"]
return "Mastodon: {}@{}".format(user, instance)
return "{}@{} ({})".format(user, instance, self.name)

def start_streaming(self):
if self.settings["general"]["disable_streaming"]:
Expand Down

0 comments on commit 14a956d

Please sign in to comment.