mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-18 10:59:17 +00:00
fix remote hashtags
This commit is contained in:
parent
93e41df75d
commit
9d4727598d
|
@ -54,12 +54,6 @@ def put(%Activity{} = activity) do
|
|||
DocumentMappings.Activity.id(activity),
|
||||
DocumentMappings.Activity.encode(activity)
|
||||
)
|
||||
|
||||
{:ok, _} =
|
||||
bulk_post(
|
||||
activity.object.hashtags,
|
||||
:hashtags
|
||||
)
|
||||
end
|
||||
|
||||
def put(%User{} = user) do
|
||||
|
@ -101,6 +95,12 @@ def bulk_post(data, :activities) do
|
|||
)
|
||||
end
|
||||
|
||||
def maybe_bulk_post(data, type) do
|
||||
if enabled?() do
|
||||
bulk_post(data, type)
|
||||
end
|
||||
end
|
||||
|
||||
def bulk_post(data, :users) do
|
||||
d =
|
||||
data
|
||||
|
|
|
@ -61,6 +61,7 @@ def get_or_create_by_names(names) when is_list(names) do
|
|||
{:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))}
|
||||
end)
|
||||
|> Repo.transaction() do
|
||||
Pleroma.Elasticsearch.bulk_post(hashtags, :hashtags)
|
||||
{:ok, hashtags}
|
||||
else
|
||||
{:error, _name, value, _changes_so_far} -> {:error, value}
|
||||
|
|
Loading…
Reference in a new issue