Fediverse: black

This commit is contained in:
Valentin Lorentz 2020-05-16 23:14:46 +02:00
parent b78973265b
commit 83c49ec43a
2 changed files with 38 additions and 36 deletions

View File

@ -216,20 +216,26 @@ class Fediverse(callbacks.PluginRegexp):
irc.network,
):
# show CW and content
res = [_("%s: \x02[CW %s]\x02 %s") % (
author_fullname,
cw,
utils.web.htmlToText(status["content"]),
)]
res = [
_("%s: \x02[CW %s]\x02 %s")
% (
author_fullname,
cw,
utils.web.htmlToText(status["content"]),
)
]
else:
# show CW but not content
res = [_("%s: CW %s") % (author_fullname, cw)]
else:
# no CW, show content
res = [_("%s: %s") % (
author_fullname,
utils.web.htmlToText(status["content"]),
)]
res = [
_("%s: %s")
% (
author_fullname,
utils.web.htmlToText(status["content"]),
)
]
for attachment in status.get("attachment", []):
res.append(utils.str.url(attachment.get("url")))

View File

@ -216,33 +216,29 @@ STATUS_DATA = json.dumps(STATUS_VALUE).encode()
STATUS_WITH_PHOTO_URL = "https://example.org/users/someuser/statuses/123"
STATUS_WITH_PHOTO_VALUE = {
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://example.org/schemas/litepub-0.1.jsonld",
],
"actor": "https://example.org/users/someuser",
"attachment": [
{
"mediaType": "image/jpeg",
"name": "IMG_foo.jpg",
"type": "Document",
"url": "https://example.org/foo.jpg"
}
],
"attributedTo": "https://example.org/users/someuser",
"cc": [
"https://www.w3.org/ns/activitystreams#Public"
],
"content": "Here is a picture",
"id": "https://example.org/users/someuser/statuses/123",
"published": "2020-05-08T01:23:45Z",
"sensitive": False,
"summary": "",
"tag": [],
"to": [
"https://example.org/users/someuser/followers"
],
"type": "Note"
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://example.org/schemas/litepub-0.1.jsonld",
],
"actor": "https://example.org/users/someuser",
"attachment": [
{
"mediaType": "image/jpeg",
"name": "IMG_foo.jpg",
"type": "Document",
"url": "https://example.org/foo.jpg",
}
],
"attributedTo": "https://example.org/users/someuser",
"cc": ["https://www.w3.org/ns/activitystreams#Public"],
"content": "Here is a picture",
"id": "https://example.org/users/someuser/statuses/123",
"published": "2020-05-08T01:23:45Z",
"sensitive": False,
"summary": "",
"tag": [],
"to": ["https://example.org/users/someuser/followers"],
"type": "Note",
}
STATUS_WITH_PHOTO_DATA = json.dumps(STATUS_WITH_PHOTO_VALUE).encode()