Browse Source

Merge branch 'gopher-fix' into 'develop'

Gopher: using atom keys in search params

See merge request pleroma/pleroma!2775
chores/our-libs-hex-releases
lain 4 years ago
parent
commit
fa2421dd7e
3 changed files with 15 additions and 8 deletions
  1. +11
    -8
      lib/pleroma/gopher/server.ex
  2. +2
    -0
      test/upload/filter/anonymize_filename_test.exs
  3. +2
    -0
      test/uploaders/local_test.exs

+ 11
- 8
lib/pleroma/gopher/server.ex View File

@@ -96,16 +96,18 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do

def response("/main/public") do
posts =
ActivityPub.fetch_public_activities(%{"type" => ["Create"], "local_only" => true})
|> render_activities
%{type: ["Create"], local_only: true}
|> ActivityPub.fetch_public_activities()
|> render_activities()

info("Welcome to the Public Timeline!") <> posts <> ".\r\n"
end

def response("/main/all") do
posts =
ActivityPub.fetch_public_activities(%{"type" => ["Create"]})
|> render_activities
%{type: ["Create"]}
|> ActivityPub.fetch_public_activities()
|> render_activities()

info("Welcome to the Federated Timeline!") <> posts <> ".\r\n"
end
@@ -130,13 +132,14 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
def response("/users/" <> nickname) do
with %User{} = user <- User.get_cached_by_nickname(nickname) do
params = %{
"type" => ["Create"],
"actor_id" => user.ap_id
type: ["Create"],
actor_id: user.ap_id
}

activities =
ActivityPub.fetch_public_activities(params)
|> render_activities
params
|> ActivityPub.fetch_public_activities()
|> render_activities()

info("Posts by #{user.nickname}") <> activities <> ".\r\n"
else


+ 2
- 0
test/upload/filter/anonymize_filename_test.exs View File

@@ -9,6 +9,8 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
alias Pleroma.Upload

setup do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")

upload_file = %Upload{
name: "an… image.jpg",
content_type: "image/jpg",


+ 2
- 0
test/uploaders/local_test.exs View File

@@ -14,6 +14,7 @@ defmodule Pleroma.Uploaders.LocalTest do

describe "put_file/1" 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 = %Pleroma.Upload{
@@ -32,6 +33,7 @@ defmodule Pleroma.Uploaders.LocalTest do

describe "delete_file/1" 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 = %Pleroma.Upload{


Loading…
Cancel
Save