mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-26 12:43:09 +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":
|
elif status["type"] == "Note":
|
||||||
author_url = status["attributedTo"]
|
author_url = status["attributedTo"]
|
||||||
author = self._get_actor(irc, author_url)
|
author = self._get_actor(irc, author_url)
|
||||||
return _("\x02%s (%s)\x02: %s") % (
|
cw = status.get("summary")
|
||||||
author["name"],
|
if cw:
|
||||||
self._format_actor_username(author),
|
return _("\x02%s (%s)\x02: [CW %s] %s") % (
|
||||||
utils.web.htmlToText(status["content"]),
|
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":
|
elif status["type"] == "Announce":
|
||||||
# aka boost; let's go fetch the original status
|
# aka boost; let's go fetch the original status
|
||||||
try:
|
try:
|
||||||
|
@ -189,7 +189,7 @@ OUTBOX_FIRSTPAGE_VALUE = {
|
|||||||
"partOf": "https://example.org/users/someuser/outbox",
|
"partOf": "https://example.org/users/someuser/outbox",
|
||||||
"orderedItems": [
|
"orderedItems": [
|
||||||
{
|
{
|
||||||
"id": "https://example.org/users/someuser/statuses/104135036335976677/activity",
|
"id": "https://example.org/users/someuser/statuses/1234/activity",
|
||||||
"type": "Create",
|
"type": "Create",
|
||||||
"actor": "https://example.org/users/someuser",
|
"actor": "https://example.org/users/someuser",
|
||||||
"published": "2020-05-08T01:23:45Z",
|
"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",
|
"id": "https://example.org/users/someuser/statuses/12345/activity",
|
||||||
"type": "Announce",
|
"type": "Announce",
|
||||||
@ -551,7 +570,10 @@ class FediverseTestCase(ChannelPluginTestCase):
|
|||||||
self.assertResponse(
|
self.assertResponse(
|
||||||
"statuses @someuser@example.org",
|
"statuses @someuser@example.org",
|
||||||
"\x02someuser (@someuser@example.org)\x02: "
|
"\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: "
|
+ "\x02Boosted User (@BoostedUser@example.net)\x02: "
|
||||||
+ "Status Content",
|
+ "Status Content",
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user