diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-12-28 00:08:09 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2020-12-28 00:08:09 +0300 |
commit | 14fae94c0e4b04123c7af148260d0a4a51042570 (patch) | |
tree | 84e4a58577a2887f127778084e9eb2b351193fdb /lib/pleroma/object.ex | |
parent | 4134abef63e1165f5701741c1012e64cb908654c (diff) | |
download | pleroma-14fae94c0e4b04123c7af148260d0a4a51042570.tar.gz |
[#3213] Made Object.hashtags/1 work with :hashtags assoc. Adjusted tests.
Diffstat (limited to 'lib/pleroma/object.ex')
-rw-r--r-- | lib/pleroma/object.ex | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 1d756bcd1..08114d4f2 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -384,7 +384,19 @@ defmodule Pleroma.Object do def tags(_), do: [] - def hashtags(object), do: embedded_hashtags(object) + def hashtags(%Object{} = object) do + cond do + Config.object_embedded_hashtags?() -> + embedded_hashtags(object) + + object.id == "pleroma:fake_object_id" -> + [] + + true -> + hashtag_records = Repo.preload(object, :hashtags).hashtags + Enum.map(hashtag_records, & &1.name) + end + end defp embedded_hashtags(%Object{data: data}) do object_data_hashtags(data) |