Show counts for replies, likes, and announces for selected notice.
Using text instead of an icon, for now.
This commit is contained in:
parent
93e9c0cedf
commit
e4b9784c39
|
@ -24,6 +24,16 @@ defp get_title(%Object{data: %{"summary" => summary}}) when is_binary(summary),
|
|||
|
||||
defp get_title(_), do: nil
|
||||
|
||||
def get_counts(%Activity{} = activity) do
|
||||
%Object{data: data} = Object.normalize(activity)
|
||||
|
||||
%{
|
||||
likes: data["like_count"] || 0,
|
||||
replies: data["repliesCount"] || 0,
|
||||
announces: data["announcement_count"] || 0
|
||||
}
|
||||
end
|
||||
|
||||
def represent(%Activity{} = activity, %User{} = user, selected) do
|
||||
%{
|
||||
user: user,
|
||||
|
@ -33,7 +43,8 @@ def represent(%Activity{} = activity, %User{} = user, selected) do
|
|||
link: Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, activity.id),
|
||||
published: activity.object.data["published"],
|
||||
sensitive: activity.object.data["sensitive"],
|
||||
selected: selected
|
||||
selected: selected,
|
||||
counts: get_counts(activity)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -50,7 +61,7 @@ def show_notice(%{assigns: %{notice_id: notice_id}} = conn, _params) do
|
|||
|
||||
represented =
|
||||
for a <- Enum.reverse(activities) do
|
||||
represent(activity, a.object.id == activity.object.id)
|
||||
represent(a, a.object.id == activity.object.id)
|
||||
end
|
||||
|
||||
render(conn, "conversation.html", %{activities: represented, instance_name: instance_name})
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
.activity {
|
||||
padding: 1em;
|
||||
padding-bottom: 2em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
|
@ -46,6 +47,11 @@
|
|||
background-color: #1b2735;
|
||||
}
|
||||
|
||||
.counts dt, .counts dd {
|
||||
float: left;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
|
|
|
@ -27,4 +27,11 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= if @selected do %>
|
||||
<dl class="counts">
|
||||
<dt><%= Gettext.gettext("replies") %></dt><dd><%= @counts.replies %></dd>
|
||||
<dt><%= Gettext.gettext("announces") %></dt><dd><%= @counts.announces %></dd>
|
||||
<dt><%= Gettext.gettext("likes") %></dt><dd><%= @counts.likes %></dd>
|
||||
</dl>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue