From 42b632eff33d79b9df548837f27254119efc465f Mon Sep 17 00:00:00 2001 From: MineRobber___T Date: Thu, 16 Jan 2020 11:13:23 -0500 Subject: [PATCH 1/2] Fix empty names Specifically, botsin.space (for sure) returns a display name of `""`. Since that's not meaningful, I just added a check to replace the display name with the username if the display name is empty. --- modules/fediverse/ap_actor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/fediverse/ap_actor.py b/modules/fediverse/ap_actor.py index 9296453c..fc0d357d 100644 --- a/modules/fediverse/ap_actor.py +++ b/modules/fediverse/ap_actor.py @@ -18,6 +18,8 @@ class Actor(object): response = response.json() self.username = response["preferredUsername"] self.display_name = response.get("name", self.username) + if not self.display_name: + self.display_name = self.username self.inbox = Inbox(response["inbox"]) self.outbox = Outbox(response["outbox"]) self.followers = response["followers"] From 88e82f8f9651e8a5775380673bfd916a1de1f50a Mon Sep 17 00:00:00 2001 From: MineRobber___T Date: Thu, 16 Jan 2020 11:17:48 -0500 Subject: [PATCH 2/2] Fix empty display names --- modules/fediverse/ap_actor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/fediverse/ap_actor.py b/modules/fediverse/ap_actor.py index fc0d357d..071e4ffa 100644 --- a/modules/fediverse/ap_actor.py +++ b/modules/fediverse/ap_actor.py @@ -17,9 +17,7 @@ class Actor(object): if response.code == 200: response = response.json() self.username = response["preferredUsername"] - self.display_name = response.get("name", self.username) - if not self.display_name: - self.display_name = self.username + self.display_name = response.get("name") or self.username self.inbox = Inbox(response["inbox"]) self.outbox = Outbox(response["outbox"]) self.followers = response["followers"]