mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Fediverse: Hide channel actor on PeerTube
This commit is contained in:
parent
34f8842273
commit
461c091b94
@ -237,11 +237,15 @@ class Fediverse(callbacks.PluginRegexp):
|
|||||||
else:
|
else:
|
||||||
return self._format_actor_fullname(author)
|
return self._format_actor_fullname(author)
|
||||||
elif isinstance(author, dict):
|
elif isinstance(author, dict):
|
||||||
|
if author.get("type") == "Group":
|
||||||
|
# Typically, there is an actor named "Default <username> channel"
|
||||||
|
# on PeerTube, which we do not want to show.
|
||||||
|
return None
|
||||||
if author.get("id"):
|
if author.get("id"):
|
||||||
return self._format_author(irc, author["id"])
|
return self._format_author(irc, author["id"])
|
||||||
elif isinstance(author, list):
|
elif isinstance(author, list):
|
||||||
return format(
|
return format(
|
||||||
"%L", [self._format_author(irc, item) for item in author]
|
"%L", filter(bool, [self._format_author(irc, item) for item in author])
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
|
@ -438,15 +438,13 @@ class NetworklessFediverseTestCase(BaseFediverseTestCase):
|
|||||||
expected_requests = [
|
expected_requests = [
|
||||||
(PEERTUBE_VIDEO_URL, PEERTUBE_VIDEO_DATA),
|
(PEERTUBE_VIDEO_URL, PEERTUBE_VIDEO_DATA),
|
||||||
(PEERTUBE_ACTOR_URL, PEERTUBE_ACTOR_DATA),
|
(PEERTUBE_ACTOR_URL, PEERTUBE_ACTOR_DATA),
|
||||||
(ACTOR_URL, ACTOR_DATA),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
with self.mockRequests(expected_requests):
|
with self.mockRequests(expected_requests):
|
||||||
self.assertResponse(
|
self.assertResponse(
|
||||||
"status https://example.org/w/gABde9e210FGHre",
|
"status https://example.org/w/gABde9e210FGHre",
|
||||||
"\x02name of video\x02 (1 hour, 26 minutes, and 0 seconds) "
|
"\x02name of video\x02 (1 hour, 26 minutes, and 0 seconds) "
|
||||||
"by \x02chocobozzz\x02 (@chocobozzz@peertube.cpy.re) "
|
"by \x02chocobozzz\x02 (@chocobozzz@peertube.cpy.re): "
|
||||||
"and \x02someuser\x02 (@someuser@example.org): "
|
|
||||||
"description of the video with a second line",
|
"description of the video with a second line",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user