summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2020-01-12 18:37:52 +0000
committerfeld <feld@feld.me>2020-01-12 18:37:52 +0000
commit8b4d81609d5627d62b826bcd3e87290cb513495f (patch)
tree009ced1c40a279b1decddd06c8af7bcfe53c1e8d /lib
parent6cc5341d26426f98a53a6e46787f1457f974f321 (diff)
parent180f257ced4ace9467d1946a582a5f6f962d0163 (diff)
downloadpleroma-8b4d81609d5627d62b826bcd3e87290cb513495f.tar.gz
pleroma-8b4d81609d5627d62b826bcd3e87290cb513495f.zip
Merge branch 'updated-at-on-conversation-read' into 'develop'
MastodonAPI: Fix mark-as-read bringing the conversation to the top (`POST /api/v1/conversations/:id/read`) See merge request pleroma/pleroma!2080
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/conversation/participation.ex10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/conversation/participation.ex b/lib/pleroma/conversation/participation.ex
index aafe57280..e5d28ebff 100644
--- a/lib/pleroma/conversation/participation.ex
+++ b/lib/pleroma/conversation/participation.ex
@@ -64,11 +64,13 @@ defmodule Pleroma.Conversation.Participation do
end
def mark_as_read(participation) do
- participation
- |> read_cng(%{read: true})
- |> Repo.update()
+ __MODULE__
+ |> where(id: ^participation.id)
+ |> update(set: [read: true])
+ |> select([p], p)
+ |> Repo.update_all([])
|> case do
- {:ok, participation} ->
+ {1, [participation]} ->
participation = Repo.preload(participation, :user)
User.set_unread_conversation_count(participation.user)
{:ok, participation}