2022-11-07 17:13:03 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import arrow
|
|
|
|
from . import utils
|
|
|
|
|
|
|
|
def compose_toot(toot, db, relative_times, show_screen_names):
|
|
|
|
if show_screen_names == False:
|
|
|
|
user = toot.account.get("display_name")
|
|
|
|
else:
|
|
|
|
user = toot.account.get("acct")
|
|
|
|
original_date = arrow.get(toot.created_at)
|
|
|
|
if relative_times:
|
|
|
|
ts = original_date.humanize(locale="es")
|
|
|
|
else:
|
|
|
|
ts = original_date.shift(hours=db["utc_offset"]).format(_("dddd, MMMM D, YYYY H:m:s"), locale="es")
|
|
|
|
if toot.reblog != None:
|
2022-11-08 08:59:09 -06:00
|
|
|
text = _("Boosted from @{}: {}").format(toot.reblog.account.acct, utils.html_filter(toot.reblog.content))
|
2022-11-07 17:13:03 -06:00
|
|
|
else:
|
|
|
|
text = utils.html_filter(toot.content)
|
|
|
|
source = toot.get("application", "")
|
2022-11-08 08:59:09 -06:00
|
|
|
# "" means remote user, None for legacy apps so we should cover both sides.
|
|
|
|
if source != None and source != "":
|
2022-11-07 17:13:03 -06:00
|
|
|
source = source.get("name", "")
|
2022-11-08 08:59:09 -06:00
|
|
|
else:
|
|
|
|
source = ""
|
2022-11-07 17:13:03 -06:00
|
|
|
return [user+", ", text, ts+", ", source]
|