X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fhtml.ex;h=4b42d8c9b93a178de7d8f120a8a3a8f044672230;hb=e7c3c367667e96ef7fe31ef9dd8337b563a3ccaa;hp=f19b42b42c470250f9be48b3b13358b7d74a4f33;hpb=45ba10bf47baf350fd4d538cbe32cec447d496e6;p=akkoma diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index f19b42b42..4b42d8c9b 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -28,28 +28,28 @@ defmodule Pleroma.HTML do def filter_tags(html), do: filter_tags(html, nil) def strip_tags(html), do: Scrubber.scrub(html, Scrubber.StripTags) - # TODO: rename object to activity because that's what it is really working with - def get_cached_scrubbed_html_for_object(content, scrubbers, object, module) do - key = "#{module}#{generate_scrubber_signature(scrubbers)}|#{object.id}" + def get_cached_scrubbed_html_for_activity(content, scrubbers, activity, key \\ "") do + key = "#{key}#{generate_scrubber_signature(scrubbers)}|#{activity.id}" Cachex.fetch!(:scrubber_cache, key, fn _key -> - ensure_scrubbed_html(content, scrubbers, object.data["object"]["fake"] || false) + object = Pleroma.Object.normalize(activity) + ensure_scrubbed_html(content, scrubbers, object.data["fake"] || false) end) end - def get_cached_stripped_html_for_object(content, object, module) do - get_cached_scrubbed_html_for_object( + def get_cached_stripped_html_for_activity(content, activity, key) do + get_cached_scrubbed_html_for_activity( content, HtmlSanitizeEx.Scrubber.StripTags, - object, - module + activity, + key ) end def ensure_scrubbed_html( content, scrubbers, - _fake = false + false = _fake ) do {:commit, filter_tags(content, scrubbers)} end @@ -57,7 +57,7 @@ defmodule Pleroma.HTML do def ensure_scrubbed_html( content, scrubbers, - _fake = true + true = _fake ) do {:ignore, filter_tags(content, scrubbers)} end