Check for empty string in_reply_to ids.
This commit is contained in:
parent
f114f84324
commit
45ebc8dd9a
|
@ -19,6 +19,8 @@ def get_by_id_or_ap_id(id) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_replied_to_activity(""), do: nil
|
||||||
|
|
||||||
def get_replied_to_activity(id) when not is_nil(id) do
|
def get_replied_to_activity(id) when not is_nil(id) do
|
||||||
Repo.get(Activity, id)
|
Repo.get(Activity, id)
|
||||||
end
|
end
|
||||||
|
|
|
@ -198,6 +198,21 @@ test "replying to a status", %{conn: conn} do
|
||||||
assert activity.data["object"]["inReplyToStatusId"] == replied_to.id
|
assert activity.data["object"]["inReplyToStatusId"] == replied_to.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "posting a status with an invalid in_reply_to_id", %{conn: conn} do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
conn =
|
||||||
|
conn
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> post("/api/v1/statuses", %{"status" => "xD", "in_reply_to_id" => ""})
|
||||||
|
|
||||||
|
assert %{"content" => "xD", "id" => id} = json_response(conn, 200)
|
||||||
|
|
||||||
|
activity = Repo.get(Activity, id)
|
||||||
|
|
||||||
|
assert activity
|
||||||
|
end
|
||||||
|
|
||||||
test "verify_credentials", %{conn: conn} do
|
test "verify_credentials", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue