diff options
author | Alibek Omarov <a1ba.omarov@gmail.com> | 2020-10-30 13:01:58 +0100 |
---|---|---|
committer | Gitea <gitea@fake.local> | 2020-10-30 13:59:53 +0100 |
commit | 9b93eef71550eabf55b9728b6c8925a4dede222d (patch) | |
tree | 927ada4c4a939e97397b7d7f0b89aaf3f947f3d1 /lib | |
parent | 630eb0f939013db721c78e9b33e4e8bdc8232834 (diff) | |
download | pleroma-9b93eef71550eabf55b9728b6c8925a4dede222d.tar.gz pleroma-9b93eef71550eabf55b9728b6c8925a4dede222d.zip |
ConversationView: fix last_status.account being empty, fix current user being included in group conversations
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/conversation_view.ex | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/conversation_view.ex b/lib/pleroma/web/mastodon_api/views/conversation_view.ex index cf34933ab..4636c00e3 100644 --- a/lib/pleroma/web/mastodon_api/views/conversation_view.ex +++ b/lib/pleroma/web/mastodon_api/views/conversation_view.ex @@ -34,14 +34,22 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do activity = Activity.get_by_id_with_object(last_activity_id) + # Conversations return all users except current user when current user is not only participant + users = if length(participation.recipients) > 1 do + Enum.reject(participation.recipients, &(&1.id == user.id)) + else + participation.recipients + end + %{ id: participation.id |> to_string(), - accounts: render(AccountView, "index.json", users: participation.recipients, for: user), + accounts: render(AccountView, "index.json", users: users, for: user), unread: !participation.read, last_status: render(StatusView, "show.json", activity: activity, - direct_conversation_id: participation.id + direct_conversation_id: participation.id, + for: user ) } end |