return content warning from ap_utils.format_note and show it
closes #118
This commit is contained in:
parent
050bf0a848
commit
cefbbe7c5f
2 changed files with 11 additions and 6 deletions
|
@ -74,8 +74,12 @@ class Module(ModuleManager.BaseModule):
|
||||||
if not items:
|
if not items:
|
||||||
raise utils.EventError("No toots found")
|
raise utils.EventError("No toots found")
|
||||||
|
|
||||||
out, url = ap_utils.format_note(actor, items[0])
|
cw, out, url = ap_utils.format_note(actor, items[0])
|
||||||
shorturl = self.exports.get_one("shorturl")(event["server"], url,
|
shorturl = self.exports.get_one("shorturl")(event["server"], url,
|
||||||
context=event["target"])
|
context=event["target"])
|
||||||
out = "%s - %s" % (out, shorturl)
|
|
||||||
|
if not cw == None:
|
||||||
|
out = "CW: %s - %s" % (cw, shorturl)
|
||||||
|
else:
|
||||||
|
out = "%s - %s" % (out, shorturl)
|
||||||
event["stdout"].write(out)
|
event["stdout"].write(out)
|
||||||
|
|
|
@ -67,13 +67,14 @@ def format_note(actor, note):
|
||||||
retooted_user = "@%s@%s" % (original_tooter.username, retoot_instance)
|
retooted_user = "@%s@%s" % (original_tooter.username, retoot_instance)
|
||||||
retoot_content = utils.http.strip_html(retoot.data["content"])
|
retoot_content = utils.http.strip_html(retoot.data["content"])
|
||||||
|
|
||||||
return "%s (boost %s): %s - %s" % (
|
return (retoot.data.get("summary", None), "%s (boost %s): %s - %s" % (
|
||||||
actor.username, retooted_user, retoot_content), retoot_url
|
actor.username, retooted_user, retoot_content), retoot_url)
|
||||||
|
|
||||||
elif note["type"] == "Create":
|
elif note["type"] == "Create":
|
||||||
content = utils.http.strip_html(note["object"]["content"])
|
content = utils.http.strip_html(note["object"]["content"])
|
||||||
url = note["object"]["id"]
|
url = note["object"]["id"]
|
||||||
|
|
||||||
return "%s: %s" % (actor.username, content), url
|
return (note["object"].get("summary", None),
|
||||||
|
"%s: %s" % (actor.username, content), url)
|
||||||
|
|
||||||
return None, None
|
return None, None, None
|
||||||
|
|
Loading…
Reference in a new issue