Merge branch 'gopher-fix' into 'develop'

Gopher: using atom keys in search params

See merge request pleroma/pleroma!2775
This commit is contained in:
lain 2020-07-21 19:31:03 +00:00
commit fa2421dd7e
3 changed files with 15 additions and 8 deletions

View file

@ -96,16 +96,18 @@ def response("") do
def response("/main/public") do def response("/main/public") do
posts = posts =
ActivityPub.fetch_public_activities(%{"type" => ["Create"], "local_only" => true}) %{type: ["Create"], local_only: true}
|> render_activities |> ActivityPub.fetch_public_activities()
|> render_activities()
info("Welcome to the Public Timeline!") <> posts <> ".\r\n" info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
end end
def response("/main/all") do def response("/main/all") do
posts = posts =
ActivityPub.fetch_public_activities(%{"type" => ["Create"]}) %{type: ["Create"]}
|> render_activities |> ActivityPub.fetch_public_activities()
|> render_activities()
info("Welcome to the Federated Timeline!") <> posts <> ".\r\n" info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
end end
@ -130,13 +132,14 @@ def response("/notices/" <> id) do
def response("/users/" <> nickname) do def response("/users/" <> nickname) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do with %User{} = user <- User.get_cached_by_nickname(nickname) do
params = %{ params = %{
"type" => ["Create"], type: ["Create"],
"actor_id" => user.ap_id actor_id: user.ap_id
} }
activities = activities =
ActivityPub.fetch_public_activities(params) params
|> render_activities |> ActivityPub.fetch_public_activities()
|> render_activities()
info("Posts by #{user.nickname}") <> activities <> ".\r\n" info("Posts by #{user.nickname}") <> activities <> ".\r\n"
else else

View file

@ -9,6 +9,8 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
alias Pleroma.Upload alias Pleroma.Upload
setup do setup do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
upload_file = %Upload{ upload_file = %Upload{
name: "an… image.jpg", name: "an… image.jpg",
content_type: "image/jpg", content_type: "image/jpg",

View file

@ -14,6 +14,7 @@ test "it returns path to local folder for files" do
describe "put_file/1" do describe "put_file/1" do
test "put file to local folder" do test "put file to local folder" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file_path = "local_upload/files/image.jpg" file_path = "local_upload/files/image.jpg"
file = %Pleroma.Upload{ file = %Pleroma.Upload{
@ -32,6 +33,7 @@ test "put file to local folder" do
describe "delete_file/1" do describe "delete_file/1" do
test "deletes local file" do test "deletes local file" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file_path = "local_upload/files/image.jpg" file_path = "local_upload/files/image.jpg"
file = %Pleroma.Upload{ file = %Pleroma.Upload{