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