Chats: Add cascading delete on both referenced users.

Also remove the now-superfluous join in the chat controller,
which was only used to filter out these cases.
This commit is contained in:
lain 2020-08-31 16:48:17 +02:00
commit 0b621a834a
3 changed files with 45 additions and 3 deletions

View file

@ -149,9 +149,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do
from(c in Chat,
where: c.user_id == ^user_id,
where: c.recipient not in ^blocked_ap_ids,
order_by: [desc: c.updated_at],
inner_join: u in User,
on: u.ap_id == c.recipient
order_by: [desc: c.updated_at]
)
|> Repo.all()