"created_at" => created_at,
"retweeted_status" => retweeted_status,
"statusnet_conversation_id" => conversation_id(announced_activity),
- "external_url" => activity.data["id"]
+ "external_url" => activity.data["id"],
+ "activity_type" => "repeat"
}
end
"uri" => "tag:#{activity.data["id"]}:objectType=Favourite",
"created_at" => created_at,
"in_reply_to_status_id" => liked_activity.id,
- "external_url" => activity.data["id"]
+ "external_url" => activity.data["id"],
+ "activity_type" => "like"
}
end
"is_post_verb" => false,
"created_at" => created_at,
"in_reply_to_status_id" => nil,
- "external_url" => activity.data["id"]
+ "external_url" => activity.data["id"],
+ "activity_type" => "follow"
+ }
+ end
+
+ # TODO:
+ # Make this more proper. Just a placeholder to not break the frontend.
+ def to_map(%Activity{data: %{"type" => "Undo", "published" => created_at, "object" => undid_activity }} = activity, %{user: user} = opts) do
+ created_at = created_at |> Utils.date_to_asctime
+
+ text = "#{user.nickname} undid the action at #{undid_activity}"
+ %{
+ "id" => activity.id,
+ "user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
+ "attentions" => [],
+ "statusnet_html" => text,
+ "text" => text,
+ "is_local" => activity.local,
+ "is_post_verb" => false,
+ "created_at" => created_at,
+ "in_reply_to_status_id" => nil,
+ "external_url" => activity.data["id"],
+ "activity_type" => "undo"
}
end
conversation_id = conversation_id(activity)
+ tags = activity.data["object"]["tag"] || []
+ possibly_sensitive = Enum.member?(tags, "nsfw")
+
%{
"id" => activity.id,
"user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
"favorited" => to_boolean(favorited),
"repeated" => to_boolean(repeated),
"external_url" => object["external_url"],
- "tags" => activity.data["object"]["tag"] || []
+ "tags" => tags,
+ "activity_type" => "post",
+ "possibly_sensitive" => possibly_sensitive
}
end