projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't delete config settings on admin update
[akkoma]
/
lib
/
pleroma
/
conversation.ex
diff --git
a/lib/pleroma/conversation.ex
b/lib/pleroma/conversation.ex
index aa73edd75574876190b0a183bc0cbc5ed48b5f1b..bc97b39ca6e6229d888f6fd721747e48f3579115 100644
(file)
--- a/
lib/pleroma/conversation.ex
+++ b/
lib/pleroma/conversation.ex
@@
-45,11
+45,11
@@
defmodule Pleroma.Conversation do
2. Create a participation for all the people involved who don't have one already
3. Bump all relevant participations to 'unread'
"""
2. Create a participation for all the people involved who don't have one already
3. Bump all relevant participations to 'unread'
"""
- def create_or_bump_for(activity) do
+ def create_or_bump_for(activity
, opts \\ []
) do
with true <- Pleroma.Web.ActivityPub.Visibility.is_direct?(activity),
with true <- Pleroma.Web.ActivityPub.Visibility.is_direct?(activity),
- object <- Pleroma.Object.normalize(activity),
"Create" <- activity.data["type"],
"Create" <- activity.data["type"],
- "Note" <- object.data["type"],
+ object <- Pleroma.Object.normalize(activity),
+ true <- object.data["type"] in ["Note", "Question"],
ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"] do
{:ok, conversation} = create_for_ap_id(ap_id)
ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"] do
{:ok, conversation} = create_for_ap_id(ap_id)
@@
-58,7
+58,7
@@
defmodule Pleroma.Conversation do
participations =
Enum.map(users, fn user ->
{:ok, participation} =
participations =
Enum.map(users, fn user ->
{:ok, participation} =
- Participation.create_for_user_and_conversation(user, conversation)
+ Participation.create_for_user_and_conversation(user, conversation
, opts
)
participation
end)
participation
end)
@@
-76,14
+76,17
@@
defmodule Pleroma.Conversation do
@doc """
This is only meant to be run by a mix task. It creates conversations/participations for all direct messages in the database.
"""
@doc """
This is only meant to be run by a mix task. It creates conversations/participations for all direct messages in the database.
"""
- def bump_for_all_activities
()
do
+ def bump_for_all_activities do
stream =
Pleroma.Web.ActivityPub.ActivityPub.fetch_direct_messages_query()
|> Repo.stream()
stream =
Pleroma.Web.ActivityPub.ActivityPub.fetch_direct_messages_query()
|> Repo.stream()
- Repo.transaction(fn ->
- stream
- |> Enum.each(&create_or_bump_for/1)
- end)
+ Repo.transaction(
+ fn ->
+ stream
+ |> Enum.each(fn a -> create_or_bump_for(a, read: true) end)
+ end,
+ timeout: :infinity
+ )
end
end
end
end