activity_draft: Add source field

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-06-26 05:39:35 +02:00
parent d6c958b4c2
commit 27c33f216a
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
2 changed files with 3 additions and 0 deletions

View File

@ -186,6 +186,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do
draft.poll draft.poll
) )
|> Map.put("emoji", emoji) |> Map.put("emoji", emoji)
|> Map.put("source", draft.status)
%__MODULE__{draft | object: object} %__MODULE__{draft | object: object}
end end

View File

@ -445,6 +445,7 @@ defmodule Pleroma.Web.CommonAPITest do
object = Object.normalize(activity) object = Object.normalize(activity)
assert object.data["content"] == "<p><b>2hu</b></p>alert(&#39;xss&#39;)" assert object.data["content"] == "<p><b>2hu</b></p>alert(&#39;xss&#39;)"
assert object.data["source"] == post
end end
test "it filters out obviously bad tags when accepting a post as Markdown" do test "it filters out obviously bad tags when accepting a post as Markdown" do
@ -461,6 +462,7 @@ defmodule Pleroma.Web.CommonAPITest do
object = Object.normalize(activity) object = Object.normalize(activity)
assert object.data["content"] == "<p><b>2hu</b></p>alert(&#39;xss&#39;)" assert object.data["content"] == "<p><b>2hu</b></p>alert(&#39;xss&#39;)"
assert object.data["source"] == post
end end
test "it does not allow replies to direct messages that are not direct messages themselves" do test "it does not allow replies to direct messages that are not direct messages themselves" do