From fbf9eced11e57e9b95fec23791efb7666480a6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 29 Mar 2022 14:01:03 +0200 Subject: [PATCH 1/2] Add short_description field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- config/config.exs | 1 + config/description.exs | 9 +++++++++ docs/configuration/cheatsheet.md | 1 + lib/pleroma/web/mastodon_api/views/instance_view.ex | 1 + 4 files changed, 12 insertions(+) diff --git a/config/config.exs b/config/config.exs index 6a5acda09..0fc959807 100644 --- a/config/config.exs +++ b/config/config.exs @@ -187,6 +187,7 @@ config :pleroma, :instance, email: "example@example.com", notify_email: "noreply@example.com", description: "Pleroma: An efficient and flexible fediverse server", + short_description: "", background_image: "/images/city.jpg", instance_thumbnail: "/instance/thumbnail.jpeg", limit: 5_000, diff --git a/config/description.exs b/config/description.exs index 704af8f68..06b0182cd 100644 --- a/config/description.exs +++ b/config/description.exs @@ -536,6 +536,15 @@ config :pleroma, :config_description, [ "Very cool instance" ] }, + %{ + key: :short_description, + type: :string, + description: + "Shorter version of instance description. It can be seen on `/api/v1/instance`", + suggestions: [ + "Cool instance" + ] + }, %{ key: :limit, type: :integer, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 4dacdc68c..0ab600b21 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -18,6 +18,7 @@ To add configuration to your config file, you can copy it from the base config. * `email`: Email used to reach an Administrator/Moderator of the instance. * `notify_email`: Email used for notifications. * `description`: The instance’s description, can be seen in nodeinfo and ``/api/v1/instance``. +* `short_description`: Shorter version of instance description, can be seen on ``/api/v1/instance``. * `limit`: Posts character limit (CW/Subject included in the counter). * `description_limit`: The character limit for image descriptions. * `remote_limit`: Hard character limit beyond which remote posts will be dropped. diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index ee52475d5..62931bd41 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -17,6 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do uri: Pleroma.Web.Endpoint.url(), title: Keyword.get(instance, :name), description: Keyword.get(instance, :description), + short_description: Keyword.get(instance, :short_description), version: "#{@mastodon_api_level} (compatible; #{Pleroma.Application.named_version()})", email: Keyword.get(instance, :email), urls: %{ From eb2a1652bf3676de955a2912a42d50aa068131fa Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Wed, 13 Jul 2022 00:40:46 -0400 Subject: [PATCH 2/2] Add tests for short_description --- .../web/mastodon_api/controllers/instance_controller_test.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index 9845408d6..13e3ffc0a 100644 --- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs @@ -22,6 +22,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do "uri" => _, "title" => _, "description" => _, + "short_description" => _, "version" => _, "email" => from_config_email, "urls" => %{