mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-26 04:32:51 +01:00
Fediverse: Show content warnings.
This commit is contained in:
parent
7511984a60
commit
a52e7fa91b
@ -172,11 +172,20 @@ class Fediverse(callbacks.PluginRegexp):
|
||||
elif status["type"] == "Note":
|
||||
author_url = status["attributedTo"]
|
||||
author = self._get_actor(irc, author_url)
|
||||
return _("\x02%s (%s)\x02: %s") % (
|
||||
author["name"],
|
||||
self._format_actor_username(author),
|
||||
utils.web.htmlToText(status["content"]),
|
||||
)
|
||||
cw = status.get("summary")
|
||||
if cw:
|
||||
return _("\x02%s (%s)\x02: [CW %s] %s") % (
|
||||
author["name"],
|
||||
self._format_actor_username(author),
|
||||
cw,
|
||||
utils.web.htmlToText(status["content"]),
|
||||
)
|
||||
else:
|
||||
return _("\x02%s (%s)\x02: %s") % (
|
||||
author["name"],
|
||||
self._format_actor_username(author),
|
||||
utils.web.htmlToText(status["content"]),
|
||||
)
|
||||
elif status["type"] == "Announce":
|
||||
# aka boost; let's go fetch the original status
|
||||
try:
|
||||
|
@ -189,7 +189,7 @@ OUTBOX_FIRSTPAGE_VALUE = {
|
||||
"partOf": "https://example.org/users/someuser/outbox",
|
||||
"orderedItems": [
|
||||
{
|
||||
"id": "https://example.org/users/someuser/statuses/104135036335976677/activity",
|
||||
"id": "https://example.org/users/someuser/statuses/1234/activity",
|
||||
"type": "Create",
|
||||
"actor": "https://example.org/users/someuser",
|
||||
"published": "2020-05-08T01:23:45Z",
|
||||
@ -239,6 +239,25 @@ OUTBOX_FIRSTPAGE_VALUE = {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"id": "https://example.org/users/someuser/statuses/1234/activity",
|
||||
"type": "Create",
|
||||
"actor": "https://example.org/users/someuser",
|
||||
"published": "2020-05-08T01:23:45Z",
|
||||
"to": ["https://example.org/users/someuser/followers"],
|
||||
"cc": [
|
||||
"https://www.w3.org/ns/activitystreams#Public",
|
||||
"https://example.com/users/FirstAuthor",
|
||||
],
|
||||
"object": {
|
||||
"id": "https://example.org/users/someuser/statuses/1234",
|
||||
"type": "Note",
|
||||
"summary": "This is a content warning",
|
||||
"attributedTo": "https://example.org/users/someuser",
|
||||
"inReplyTo": None,
|
||||
"content": "<p>This is a status with a content warning</p>",
|
||||
},
|
||||
},
|
||||
{
|
||||
"id": "https://example.org/users/someuser/statuses/12345/activity",
|
||||
"type": "Announce",
|
||||
@ -551,7 +570,10 @@ class FediverseTestCase(ChannelPluginTestCase):
|
||||
self.assertResponse(
|
||||
"statuses @someuser@example.org",
|
||||
"\x02someuser (@someuser@example.org)\x02: "
|
||||
+ "@ FirstAuthor I am replying to you and "
|
||||
+ "@ FirstAuthor I am replying to you, "
|
||||
+ "\x02someuser (@someuser@example.org)\x02: "
|
||||
+ "[CW This is a content warning] "
|
||||
+ "This is a status with a content warning, and "
|
||||
+ "\x02Boosted User (@BoostedUser@example.net)\x02: "
|
||||
+ "Status Content",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user