twitterapi: fix bad rebase
This commit is contained in:
parent
f0439617ef
commit
02288b5f1c
|
@ -207,15 +207,17 @@ def render("activity.json", %{activity: %{data: %{"type" => "Like"}} = activity}
|
||||||
|
|
||||||
def render(
|
def render(
|
||||||
"activity.json",
|
"activity.json",
|
||||||
%{activity: %{data: %{"type" => "Create", "object" => object}} = activity} = opts
|
%{activity: %{data: %{"type" => "Create", "object" => object_id}} = activity} = opts
|
||||||
) do
|
) do
|
||||||
user = get_user(activity.data["actor"], opts)
|
user = get_user(activity.data["actor"], opts)
|
||||||
|
|
||||||
created_at = object["published"] |> Utils.date_to_asctime()
|
object = Object.normalize(object_id)
|
||||||
like_count = object["like_count"] || 0
|
|
||||||
announcement_count = object["announcement_count"] || 0
|
created_at = object.data["published"] |> Utils.date_to_asctime()
|
||||||
favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || [])
|
like_count = object.data["like_count"] || 0
|
||||||
repeated = opts[:for] && opts[:for].ap_id in (object["announcements"] || [])
|
announcement_count = object.data["announcement_count"] || 0
|
||||||
|
favorited = opts[:for] && opts[:for].ap_id in (object.data["likes"] || [])
|
||||||
|
repeated = opts[:for] && opts[:for].ap_id in (object.data["announcements"] || [])
|
||||||
|
|
||||||
attentions =
|
attentions =
|
||||||
activity.recipients
|
activity.recipients
|
||||||
|
@ -230,11 +232,11 @@ def render(
|
||||||
|
|
||||||
tags = if possibly_sensitive, do: Enum.uniq(["nsfw" | tags]), else: tags
|
tags = if possibly_sensitive, do: Enum.uniq(["nsfw" | tags]), else: tags
|
||||||
|
|
||||||
{summary, content} = render_content(object)
|
{summary, content} = render_content(object.data)
|
||||||
|
|
||||||
html =
|
html =
|
||||||
HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
|
HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
|
||||||
|> Formatter.emojify(object["emoji"])
|
|> Formatter.emojify(object.data["emoji"])
|
||||||
|
|
||||||
reply_parent = Activity.get_in_reply_to_activity(activity)
|
reply_parent = Activity.get_in_reply_to_activity(activity)
|
||||||
|
|
||||||
|
@ -249,19 +251,19 @@ def render(
|
||||||
"is_local" => activity.local,
|
"is_local" => activity.local,
|
||||||
"is_post_verb" => true,
|
"is_post_verb" => true,
|
||||||
"created_at" => created_at,
|
"created_at" => created_at,
|
||||||
"in_reply_to_status_id" => object["inReplyToStatusId"],
|
"in_reply_to_status_id" => object.data["inReplyToStatusId"],
|
||||||
"in_reply_to_screen_name" => reply_user && reply_user.nickname,
|
"in_reply_to_screen_name" => reply_user && reply_user.nickname,
|
||||||
"in_reply_to_profileurl" => User.profile_url(reply_user),
|
"in_reply_to_profileurl" => User.profile_url(reply_user),
|
||||||
"in_reply_to_ostatus_uri" => reply_user && reply_user.ap_id,
|
"in_reply_to_ostatus_uri" => reply_user && reply_user.ap_id,
|
||||||
"in_reply_to_user_id" => reply_user && reply_user.id,
|
"in_reply_to_user_id" => reply_user && reply_user.id,
|
||||||
"statusnet_conversation_id" => conversation_id,
|
"statusnet_conversation_id" => conversation_id,
|
||||||
"attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
|
"attachments" => (object.data["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
|
||||||
"attentions" => attentions,
|
"attentions" => attentions,
|
||||||
"fave_num" => like_count,
|
"fave_num" => like_count,
|
||||||
"repeat_num" => announcement_count,
|
"repeat_num" => announcement_count,
|
||||||
"favorited" => !!favorited,
|
"favorited" => !!favorited,
|
||||||
"repeated" => !!repeated,
|
"repeated" => !!repeated,
|
||||||
"external_url" => object["external_url"] || object["id"],
|
"external_url" => object.data["external_url"] || object.data["id"],
|
||||||
"tags" => tags,
|
"tags" => tags,
|
||||||
"activity_type" => "post",
|
"activity_type" => "post",
|
||||||
"possibly_sensitive" => possibly_sensitive,
|
"possibly_sensitive" => possibly_sensitive,
|
||||||
|
|
Loading…
Reference in a new issue