Gopher: Add like / repeat count.
authorlain <lain@soykaf.club>
Sat, 31 Mar 2018 16:22:33 +0000 (18:22 +0200)
committerlain <lain@soykaf.club>
Sat, 31 Mar 2018 18:01:55 +0000 (20:01 +0200)
lib/pleroma/gopher/server.ex

index cccde155abe366981509436b31099b7c3a550f38..17741a7a797abb37b63a5300be5ed126af4f0301 100644 (file)
@@ -71,8 +71,13 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
     |> Enum.map(fn activity ->
       user = User.get_cached_by_ap_id(activity.data["actor"])
 
+      object = activity.data["object"]
+      like_count = object["like_count"] || 0
+      announcement_count = object["announcement_count"] || 0
+
       link("Post ##{activity.id} by #{user.nickname}", "/notices/#{activity.id}") <>
-        info(HtmlSanitizeEx.strip_tags(activity.data["object"]["content"]))
+        info("#{like_count} likes, #{announcement_count} repeats") <>
+        "\r\n" <> info(HtmlSanitizeEx.strip_tags(activity.data["object"]["content"]))
     end)
     |> Enum.join("\r\n")
   end