aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-11-03 13:11:36 +0000
committerlain <lain@soykaf.club>2020-11-03 13:11:36 +0000
commitf7a3dcd3200bd6072d61ca51e91d5a2a75a9ffe7 (patch)
tree5e2e3767cce93218ae162bd564673d830f2d3e1b /lib
parent0d8cc0905aeebb965df0cf755a171d21b01ed978 (diff)
parentc37118e6f26f0305d540047e4ccb8d594d2c0e6b (diff)
downloadpleroma-f7a3dcd3200bd6072d61ca51e91d5a2a75a9ffe7.tar.gz
Merge branch 'patch-4' into 'develop'
ConversationView: add current user to conversations, according to Mastodon behaviour, fix last_status.account being not filled Closes #2217 See merge request pleroma/pleroma!3089
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/conversation_view.ex14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/conversation_view.ex b/lib/pleroma/web/mastodon_api/views/conversation_view.ex
index a91994915..82fcff062 100644
--- a/lib/pleroma/web/mastodon_api/views/conversation_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/conversation_view.ex
@@ -33,8 +33,15 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
end
activity = Activity.get_by_id_with_object(last_activity_id)
- # Conversations return all users except the current user.
- users = Enum.reject(participation.recipients, &(&1.id == user.id))
+
+ # Conversations return all users except the current user,
+ # except when the current user is the 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(),
@@ -43,7 +50,8 @@ defmodule Pleroma.Web.MastodonAPI.ConversationView do
last_status:
render(StatusView, "show.json",
activity: activity,
- direct_conversation_id: participation.id
+ direct_conversation_id: participation.id,
+ for: user
)
}
end