Merge pull request 'Remove "default" image description' (#493) from ilja/akkoma:remov...
authorfloatingghost <hannah@coffee-and-dreams.uk>
Fri, 14 Apr 2023 16:27:41 +0000 (16:27 +0000)
committerfloatingghost <hannah@coffee-and-dreams.uk>
Fri, 14 Apr 2023 16:27:41 +0000 (16:27 +0000)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/493

1  2 
CHANGELOG.md
config/config.exs
test/pleroma/web/activity_pub/activity_pub_test.exs

diff --combined CHANGELOG.md
index 1bf6253af55e7b5e21baa971c620120a9fd41401,b451f297f90f340206db28eb3087dc7713f37d7f..74182aa62398d3f71e01d953edbc4cd5730094b2
@@@ -6,26 -6,18 +6,27 @@@ The format is based on [Keep a Changelo
  
  ## Unreleased
  
 +## Added
 +- Nodeinfo keys for unauthenticated timeline visibility
 +- Option to disable federated timeline
 +- Option to make the bubble timeline publicly accessible
 +
 +## 2023.03
 +
  ## Fixed
  - Allowed contentMap to be updated on edit
 +- Filter creation now accepts expires\_at
  
  ### Changed
  - Restoring the database from a dump now goes much faster without need for work-arounds
 +- Misskey reaction matching uses `content` parameter now
  
  ### Added
  - Extend the mix task `prune_objects` with option `--prune-orphaned-activities` to also prune orphaned activities, allowing to reclaim even more database space
  
  ### Removed
  - Possibility of using the `style` parameter on `span` elements. This will break certain MFM parameters.
+ - Option for "default" image description.
  
  ## 2023.02
  
diff --combined config/config.exs
index e216caf9d2c9913aa2c20be6785d594117971c01,4d8fd52c495eb32f9613c4af9db70c9495ff8de2..3fefe88468f077efd55113601be66794a3548345
@@@ -65,7 -65,6 +65,6 @@@ config :pleroma, Pleroma.Upload
    link_name: false,
    proxy_remote: false,
    filename_display_max_length: 30,
-   default_description: nil,
    base_url: nil
  
  config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
@@@ -261,8 -260,7 +260,8 @@@ config :pleroma, :instance
    privileged_staff: false,
    local_bubble: [],
    max_frontend_settings_json_chars: 100_000,
 -  export_prometheus_metrics: true
 +  export_prometheus_metrics: true,
 +  federated_timeline_available: true
  
  config :pleroma, :welcome,
    direct_message: [
@@@ -811,7 -809,7 +810,7 @@@ config :pleroma, :majic_pool, size: 
  private_instance? = :if_instance_is_private
  
  config :pleroma, :restrict_unauthenticated,
 -  timelines: %{local: private_instance?, federated: private_instance?},
 +  timelines: %{local: private_instance?, federated: private_instance?, bubble: true},
    profiles: %{local: private_instance?, remote: private_instance?},
    activities: %{local: private_instance?, remote: private_instance?}
  
index e95e4490aa57da984517bcf744a1f8d2ef3d5e1e,20435d149b98d0371feed57b584d7ab3745026dc..b65575f01421eb684c707c2c9ce562b5df6d1bd0
@@@ -1303,41 -1303,11 +1303,19 @@@ defmodule Pleroma.Web.ActivityPub.Activ
        %{test_file: test_file}
      end
  
 +    test "strips / from filename", %{test_file: file} do
 +      file = %Plug.Upload{file | filename: "../../../../../nested/bad.jpg"}
 +      {:ok, %Object{} = object} = ActivityPub.upload(file)
 +      [%{"href" => href}] = object.data["url"]
 +      assert Regex.match?(~r"/bad.jpg$", href)
 +      refute Regex.match?(~r"/nested/", href)
 +    end
 +
      test "sets a description if given", %{test_file: file} do
        {:ok, %Object{} = object} = ActivityPub.upload(file, description: "a cool file")
        assert object.data["name"] == "a cool file"
      end
  
-     test "it sets the default description depending on the configuration", %{test_file: file} do
-       clear_config([Pleroma.Upload, :default_description])
-       clear_config([Pleroma.Upload, :default_description], nil)
-       {:ok, %Object{} = object} = ActivityPub.upload(file)
-       assert object.data["name"] == ""
-       clear_config([Pleroma.Upload, :default_description], :filename)
-       {:ok, %Object{} = object} = ActivityPub.upload(file)
-       assert object.data["name"] == "an_image.jpg"
-       clear_config([Pleroma.Upload, :default_description], "unnamed attachment")
-       {:ok, %Object{} = object} = ActivityPub.upload(file)
-       assert object.data["name"] == "unnamed attachment"
-     end
-     test "copies the file to the configured folder", %{test_file: file} do
-       clear_config([Pleroma.Upload, :default_description], :filename)
-       {:ok, %Object{} = object} = ActivityPub.upload(file)
-       assert object.data["name"] == "an_image.jpg"
-     end
      test "works with base64 encoded images" do
        file = %{
          img: data_uri()