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, irc.network,
): ):
# show CW and content # show CW and content
res = [_("%s: \x02[CW %s]\x02 %s") % ( res = [
author_fullname, _("%s: \x02[CW %s]\x02 %s")
cw, % (
utils.web.htmlToText(status["content"]), author_fullname,
)] cw,
utils.web.htmlToText(status["content"]),
)
]
else: else:
# show CW but not content # show CW but not content
res = [_("%s: CW %s") % (author_fullname, cw)] res = [_("%s: CW %s") % (author_fullname, cw)]
else: else:
# no CW, show content # no CW, show content
res = [_("%s: %s") % ( res = [
author_fullname, _("%s: %s")
utils.web.htmlToText(status["content"]), % (
)] author_fullname,
utils.web.htmlToText(status["content"]),
)
]
for attachment in status.get("attachment", []): for attachment in status.get("attachment", []):
res.append(utils.str.url(attachment.get("url"))) 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_URL = "https://example.org/users/someuser/statuses/123"
STATUS_WITH_PHOTO_VALUE = { STATUS_WITH_PHOTO_VALUE = {
"@context": [ "@context": [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://example.org/schemas/litepub-0.1.jsonld", "https://example.org/schemas/litepub-0.1.jsonld",
], ],
"actor": "https://example.org/users/someuser", "actor": "https://example.org/users/someuser",
"attachment": [ "attachment": [
{ {
"mediaType": "image/jpeg", "mediaType": "image/jpeg",
"name": "IMG_foo.jpg", "name": "IMG_foo.jpg",
"type": "Document", "type": "Document",
"url": "https://example.org/foo.jpg" "url": "https://example.org/foo.jpg",
} }
], ],
"attributedTo": "https://example.org/users/someuser", "attributedTo": "https://example.org/users/someuser",
"cc": [ "cc": ["https://www.w3.org/ns/activitystreams#Public"],
"https://www.w3.org/ns/activitystreams#Public" "content": "Here is a picture",
], "id": "https://example.org/users/someuser/statuses/123",
"content": "Here is a picture", "published": "2020-05-08T01:23:45Z",
"id": "https://example.org/users/someuser/statuses/123", "sensitive": False,
"published": "2020-05-08T01:23:45Z", "summary": "",
"sensitive": False, "tag": [],
"summary": "", "to": ["https://example.org/users/someuser/followers"],
"tag": [], "type": "Note",
"to": [
"https://example.org/users/someuser/followers"
],
"type": "Note"
} }
STATUS_WITH_PHOTO_DATA = json.dumps(STATUS_WITH_PHOTO_VALUE).encode() STATUS_WITH_PHOTO_DATA = json.dumps(STATUS_WITH_PHOTO_VALUE).encode()