From a38b021427e757b55ebbe163f50139ee8ca1f931 Mon Sep 17 00:00:00 2001 From: limepotato Date: Mon, 2 Sep 2024 17:40:41 -0600 Subject: [PATCH] revert a99eaf06b8171497fc9143e23c628a4b64f81e6e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert Allow to bite users Signed-off-by: marcin mikołajczak Signed-off-by: limepotato --- lib/pleroma/notification.ex | 9 +- lib/pleroma/web/activity_pub/builder.ex | 11 -- .../web/activity_pub/object_validator.ex | 4 +- .../accept_reject_validator.ex | 14 +- .../object_validators/bite_validator.ex | 49 ------- lib/pleroma/web/activity_pub/side_effects.ex | 124 ++++-------------- .../web/activity_pub/transmogrifier.ex | 4 +- lib/pleroma/web/activity_pub/utils.ex | 32 ----- lib/pleroma/web/api_spec.ex | 2 +- .../web/api_spec/operations/bite_operation.ex | 33 ----- .../operations/notification_operation.ex | 4 +- lib/pleroma/web/common_api.ex | 7 - .../controllers/bite_controller.ex | 39 ------ .../controllers/notification_controller.ex | 1 - .../web/mastodon_api/views/instance_view.ex | 3 +- .../mastodon_api/views/notification_view.ex | 2 +- lib/pleroma/web/nodeinfo/nodeinfo.ex | 4 - lib/pleroma/web/router.ex | 2 - ...7000000_add_bite_to_notifications_enum.exs | 52 -------- priv/static/schemas/litepub-0.1.jsonld | 3 +- 20 files changed, 36 insertions(+), 363 deletions(-) delete mode 100644 lib/pleroma/web/activity_pub/object_validators/bite_validator.ex delete mode 100644 lib/pleroma/web/api_spec/operations/bite_operation.ex delete mode 100644 lib/pleroma/web/mastodon_api/controllers/bite_controller.ex delete mode 100644 priv/repo/migrations/20240827000000_add_bite_to_notifications_enum.exs diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index aaa8cf3ac..885d61233 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -72,7 +72,6 @@ defmodule Pleroma.Notification do pleroma:report reblog poll - bite } def changeset(%Notification{} = notification, attrs) do @@ -403,7 +402,7 @@ defmodule Pleroma.Notification do end def create_notifications(%Activity{data: %{"type" => type}} = activity, options) - when type in ["Follow", "Like", "Announce", "Move", "EmojiReact", "Flag", "Update", "Bite"] do + when type in ["Follow", "Like", "Announce", "Move", "EmojiReact", "Flag", "Update"] do do_create_notifications(activity, options) end @@ -460,9 +459,6 @@ defmodule Pleroma.Notification do "Update" -> "update" - "Bite" -> - "bite" - t -> raise "No notification type for activity type #{t}" end @@ -536,8 +532,7 @@ defmodule Pleroma.Notification do "Move", "EmojiReact", "Flag", - "Update", - "Bite" + "Update" ] do potential_receiver_ap_ids = get_potential_receiver_ap_ids(activity) diff --git a/lib/pleroma/web/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex index dcbe1942d..e67a14b58 100644 --- a/lib/pleroma/web/activity_pub/builder.ex +++ b/lib/pleroma/web/activity_pub/builder.ex @@ -406,15 +406,4 @@ defmodule Pleroma.Web.ActivityPub.Builder do defp pinned_url(nickname) when is_binary(nickname) do url(~p[/users/#{nickname}/collections/featured]) end - - def bite(%User{} = biting, %User{} = bitten) do - {:ok, - %{ - "id" => Utils.generate_activity_id(), - "target" => bitten.ap_id, - "actor" => biting.ap_id, - "type" => "Bite", - "to" => [bitten.ap_id] - }, []} - end end diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index be2516589..cb0cc9ed7 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -22,7 +22,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.AnswerValidator alias Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator alias Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator - alias Pleroma.Web.ActivityPub.ObjectValidators.BiteValidator alias Pleroma.Web.ActivityPub.ObjectValidators.BlockValidator alias Pleroma.Web.ActivityPub.ObjectValidators.CreateGenericValidator alias Pleroma.Web.ActivityPub.ObjectValidators.DeleteValidator @@ -161,7 +160,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do def validate(%{"type" => type} = object, meta) when type in ~w[Accept Reject Follow Update Like EmojiReact Announce - Answer Bite] do + Answer] do validator = case type do "Accept" -> AcceptRejectValidator @@ -172,7 +171,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do "EmojiReact" -> EmojiReactValidator "Announce" -> AnnounceValidator "Answer" -> AnswerValidator - "Bite" -> BiteValidator end with {:ok, object} <- diff --git a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex index f53cd9f03..0561a9ddf 100644 --- a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex @@ -33,7 +33,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptRejectValidator do |> validate_required([:type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Accept", "Reject"]) |> validate_actor_presence() - |> validate_object_presence(allowed_types: ["Follow", "Bite"]) + |> validate_object_presence(allowed_types: ["Follow"]) |> validate_accept_reject_rights() end @@ -46,8 +46,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptRejectValidator do def validate_accept_reject_rights(cng) do with object_id when is_binary(object_id) <- get_field(cng, :object), - %Activity{} = activity <- Activity.get_by_ap_id(object_id), - true <- validate_actor(activity, get_field(cng, :actor)) do + %Activity{data: %{"object" => followed_actor}} <- Activity.get_by_ap_id(object_id), + true <- followed_actor == get_field(cng, :actor) do cng else _e -> @@ -56,14 +56,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptRejectValidator do end end - defp validate_actor(%Activity{data: %{"type" => "Follow", "object" => followed_actor}}, actor) do - followed_actor == actor - end - - defp validate_actor(%Activity{data: %{"type" => "Bite", "target" => biten_actor}}, actor) do - biten_actor == actor - end - defp maybe_fetch_object(%{"object" => %{} = object} = activity) do # If we don't have an ID, we may have to fetch the object if Map.has_key?(object, "id") do diff --git a/lib/pleroma/web/activity_pub/object_validators/bite_validator.ex b/lib/pleroma/web/activity_pub/object_validators/bite_validator.ex deleted file mode 100644 index a2e0bac85..000000000 --- a/lib/pleroma/web/activity_pub/object_validators/bite_validator.ex +++ /dev/null @@ -1,49 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2024 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ActivityPub.ObjectValidators.BiteValidator do - use Ecto.Schema - - alias Pleroma.EctoType.ActivityPub.ObjectValidators - - import Ecto.Changeset - import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations - - @primary_key false - - embedded_schema do - quote do - unquote do - import Elixir.Pleroma.Web.ActivityPub.ObjectValidators.CommonFields - message_fields() - activity_fields() - end - end - - field(:target, ObjectValidators.ObjectID) - end - - def cast_data(data) do - %__MODULE__{} - |> cast(data |> fix_object(), __schema__(:fields)) - end - - defp fix_object(data) do - Map.put(data, "object", data["target"]) - end - - defp validate_data(cng) do - cng - |> validate_required([:id, :type, :actor, :to, :target]) - |> validate_inclusion(:type, ["Bite"]) - |> validate_actor_presence() - |> validate_actor_presence(field_name: :target) - end - - def cast_and_validate(data) do - data - |> cast_data - |> validate_data - end -end diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 63369ca38..0e85e47be 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -40,16 +40,23 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do # - Sends a notification @impl true def handle( - %{data: %{"actor" => actor, "type" => "Accept", "object" => activity_id}} = object, + %{ + data: %{ + "actor" => actor, + "type" => "Accept", + "object" => follow_activity_id + } + } = object, meta ) do - with %Activity{} = activity <- - Activity.get_by_ap_id(activity_id) do - handle_accepted(activity, actor) - - if activity.data["type"] === "Join" do - Notification.create_notifications(object) - end + with %Activity{actor: follower_id} = follow_activity <- + Activity.get_by_ap_id(follow_activity_id), + %User{} = followed <- User.get_cached_by_ap_id(actor), + %User{} = follower <- User.get_cached_by_ap_id(follower_id), + {:ok, follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "accept"), + {:ok, _follower, followed} <- + FollowingRelationship.update(follower, followed, :follow_accept) do + Notification.update_notification_type(followed, follow_activity) end {:ok, object, meta} @@ -65,14 +72,18 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do data: %{ "actor" => actor, "type" => "Reject", - "object" => activity_id + "object" => follow_activity_id } } = object, meta ) do - with %Activity{} = activity <- - Activity.get_by_ap_id(activity_id) do - handle_rejected(activity, actor) + with %Activity{actor: follower_id} = follow_activity <- + Activity.get_by_ap_id(follow_activity_id), + %User{} = followed <- User.get_cached_by_ap_id(actor), + %User{} = follower <- User.get_cached_by_ap_id(follower_id), + {:ok, _follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "reject") do + FollowingRelationship.update(follower, followed, :follow_reject) + Notification.dismiss(follow_activity) end {:ok, object, meta} @@ -384,93 +395,12 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do end end - # Task this handles - # - Bites - # - Sends a notification - @impl true - def handle( - %{ - data: %{ - "id" => bite_id, - "type" => "Bite", - "target" => bitten_user, - "actor" => biting_user - } - } = object, - meta - ) do - with %User{} = biting <- User.get_cached_by_ap_id(biting_user), - %User{} = bitten <- User.get_cached_by_ap_id(bitten_user), - {:previous_bite, previous_bite} <- - {:previous_bite, Utils.fetch_latest_bite(biting, bitten, object)}, - {:reverse_bite, reverse_bite} <- - {:reverse_bite, Utils.fetch_latest_bite(bitten, biting)}, - {:can_bite, true, _} <- {:can_bite, can_bite?(previous_bite, reverse_bite), bitten} do - if bitten.local do - {:ok, accept_data, _} = Builder.accept(bitten, object) - {:ok, _activity, _} = Pipeline.common_pipeline(accept_data, local: true) - end - - if reverse_bite do - Notification.dismiss(reverse_bite) - end - - {:ok, notifications} = Notification.create_notifications(object) - - meta - |> add_notifications(notifications) - else - {:can_bite, false, bitten} -> - {:ok, reject_data, _} = Builder.reject(bitten, object) - {:ok, _activity, _} = Pipeline.common_pipeline(reject_data, local: true) - meta - - _ -> - meta - end - - updated_object = Activity.get_by_ap_id(bite_id) - - {:ok, updated_object, meta} - end - # Nothing to do @impl true def handle(object, meta) do {:ok, object, meta} end - defp handle_accepted( - %Activity{actor: follower_id, data: %{"type" => "Follow"}} = follow_activity, - actor - ) do - with %User{} = followed <- User.get_cached_by_ap_id(actor), - %User{} = follower <- User.get_cached_by_ap_id(follower_id), - {:ok, follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "accept"), - {:ok, _follower, followed} <- - FollowingRelationship.update(follower, followed, :follow_accept) do - Notification.update_notification_type(followed, follow_activity) - end - end - - defp handle_accepted(_, _), do: nil - - defp handle_rejected( - %Activity{actor: follower_id, data: %{"type" => "Follow"}} = follow_activity, - actor - ) do - with %User{} = followed <- User.get_cached_by_ap_id(actor), - %User{} = follower <- User.get_cached_by_ap_id(follower_id), - {:ok, _follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "reject") do - FollowingRelationship.update(follower, followed, :follow_reject) - Notification.dismiss(follow_activity) - end - end - - defp handle_rejected(%Activity{data: %{"type" => "Bite"}} = bite_activity, _actor) do - Notification.dismiss(bite_activity) - end - defp handle_update_user( %{data: %{"type" => "Update", "object" => updated_object}} = object, meta @@ -655,12 +585,4 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do |> send_notifications() |> send_streamables() end - - defp can_bite?(nil, _), do: true - - defp can_bite?(_, nil), do: false - - defp can_bite?(previous_bite, reverse_bite) do - NaiveDateTime.diff(previous_bite.inserted_at, reverse_bite.inserted_at) < 0 - end end diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index eb4d2fdb2..ca5e85f2e 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -519,7 +519,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end defp handle_incoming_normalised(%{"type" => type} = data, _options) - when type in ~w{Like EmojiReact Announce Add Remove Bite} do + when type in ~w{Like EmojiReact Announce Add Remove} do with :ok <- ObjectValidator.fetch_actor_and_object(data), {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do {:ok, activity} @@ -533,7 +533,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do %{"type" => type} = data, _options ) - when type in ~w{Update Block Follow Accept Reject Bite} do + when type in ~w{Update Block Follow Accept Reject} do with {:ok, %User{}} <- ObjectValidator.fetch_actor(data), {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 972f0ff32..f731b5286 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -888,36 +888,4 @@ defmodule Pleroma.Web.ActivityPub.Utils do |> where([a, object: o], fragment("(?)->>'type' = 'Answer'", o.data)) |> Repo.all() end - - def make_bite_data(biting, bitten, activity_id) do - %{ - "type" => "Bite", - "actor" => biting.ap_id, - "to" => [bitten.ap_id], - "target" => bitten.ap_id - } - |> Maps.put_if_present("id", activity_id) - end - - def fetch_latest_bite( - %User{ap_id: biting_ap_id}, - %{ap_id: bitten_ap_id}, - exclude_activity \\ nil - ) do - "Bite" - |> Activity.Queries.by_type() - |> where(actor: ^biting_ap_id) - |> maybe_exclude_activity_id(exclude_activity) - |> Activity.Queries.by_object_id(bitten_ap_id) - |> order_by([activity], fragment("? desc nulls last", activity.id)) - |> limit(1) - |> Repo.one() - end - - defp maybe_exclude_activity_id(query, nil), do: query - - defp maybe_exclude_activity_id(query, %Activity{id: activity_id}) do - query - |> where([a], a.id != ^activity_id) - end end diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index ff328f969..26fed1eef 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -79,7 +79,7 @@ defmodule Pleroma.Web.ApiSpec do "x-tagGroups": [ %{ "name" => "Accounts", - "tags" => ["Account actions", "Bites", "Retrieve account information"] + "tags" => ["Account actions", "Retrieve account information"] }, %{ "name" => "Administration", diff --git a/lib/pleroma/web/api_spec/operations/bite_operation.ex b/lib/pleroma/web/api_spec/operations/bite_operation.ex deleted file mode 100644 index 9fcbf643d..000000000 --- a/lib/pleroma/web/api_spec/operations/bite_operation.ex +++ /dev/null @@ -1,33 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2024 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ApiSpec.BiteOperation do - alias OpenApiSpex.Operation - alias OpenApiSpex.Schema - alias Pleroma.Web.ApiSpec.Schemas.ApiError - - @spec open_api_operation(atom) :: Operation.t() - def open_api_operation(action) do - operation = String.to_existing_atom("#{action}_operation") - apply(__MODULE__, operation, []) - end - - def bite_operation do - %Operation{ - tags: ["Bites"], - summary: "Bite", - operationId: "BiteController.bite", - security: [%{"oAuth" => ["write:bites"]}], - description: "Bite the given account", - parameters: [ - Operation.parameter(:id, :query, :string, "Bitten account ID") - ], - responses: %{ - 200 => Operation.response("Empty object", "application/json", %Schema{type: :object}), - 400 => Operation.response("Error", "application/json", ApiError), - 404 => Operation.response("Error", "application/json", ApiError) - } - } - end -end diff --git a/lib/pleroma/web/api_spec/operations/notification_operation.ex b/lib/pleroma/web/api_spec/operations/notification_operation.ex index 8a6c1353c..b4a20e5e5 100644 --- a/lib/pleroma/web/api_spec/operations/notification_operation.ex +++ b/lib/pleroma/web/api_spec/operations/notification_operation.ex @@ -177,8 +177,7 @@ defmodule Pleroma.Web.ApiSpec.NotificationOperation do "pleroma:report", "move", "follow_request", - "poll", - "bite" + "poll" ], description: """ The type of event that resulted in the notification. @@ -191,7 +190,6 @@ defmodule Pleroma.Web.ApiSpec.NotificationOperation do - `move` - Someone moved their account - `pleroma:emoji_reaction` - Someone reacted with emoji to your status - `pleroma:report` - Someone was reported - - `bite` - Someone bit you """ } end diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index ead1f29a8..6b62ef2d1 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -578,11 +578,4 @@ defmodule Pleroma.Web.CommonAPI do nil end end - - def bite(biting, bitten) do - with {:ok, bite_data, _} <- Builder.bite(biting, bitten), - {:ok, activity, _} <- Pipeline.common_pipeline(bite_data, local: true) do - {:ok, biting, bitten, activity} - end - end end diff --git a/lib/pleroma/web/mastodon_api/controllers/bite_controller.ex b/lib/pleroma/web/mastodon_api/controllers/bite_controller.ex deleted file mode 100644 index 69d865cb9..000000000 --- a/lib/pleroma/web/mastodon_api/controllers/bite_controller.ex +++ /dev/null @@ -1,39 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2024 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.MastodonAPI.BiteController do - use Pleroma.Web, :controller - - import Pleroma.Web.ControllerHelper, only: [assign_account_by_id: 2, json_response: 3] - - alias Pleroma.Web.CommonAPI - alias Pleroma.Web.Plugs.OAuthScopesPlug - # alias Pleroma.Web.Plugs.RateLimiter - - plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false) - - plug(OAuthScopesPlug, %{scopes: ["write:bite"]} when action == :bite) - - # plug(RateLimiter, [name: :relations_actions] when action in @relationship_actions) - # plug(RateLimiter, [name: :app_account_creation] when action == :create) - - plug(:assign_account_by_id) - - action_fallback(Pleroma.Web.MastodonAPI.FallbackController) - - defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.BiteOperation - - @doc "POST /api/v1/bite" - def bite(%{assigns: %{user: %{id: id}, account: %{id: id}}}, _params) do - {:error, "Can not bite yourself"} - end - - def bite(%{assigns: %{user: biting, account: bitten}} = conn, _) do - with {:ok, _, _, _} <- CommonAPI.bite(biting, bitten) do - json_response(conn, :ok, %{}) - else - {:error, message} -> json_response(conn, :forbidden, %{error: message}) - end - end -end diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex index 5da7a463b..8e6cf2a6a 100644 --- a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex @@ -52,7 +52,6 @@ defmodule Pleroma.Web.MastodonAPI.NotificationController do pleroma:emoji_reaction poll update - bite } def index(%{assigns: %{user: user}} = conn, params) do params = diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index 408ad2337..2b5354873 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -90,8 +90,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do "akkoma:machine_translation" end, "custom_emoji_reactions", - "pleroma:get:main/ostatus", - "pleroma:bites" + "pleroma:get:main/ostatus" ] |> Enum.filter(& &1) end diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex index 2ab725d6a..e527ff608 100644 --- a/lib/pleroma/web/mastodon_api/views/notification_view.ex +++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex @@ -128,7 +128,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do "pleroma:report" -> put_report(response, activity) - type when type in ["follow", "follow_request", "bite"] -> + type when type in ["follow", "follow_request"] -> response end end diff --git a/lib/pleroma/web/nodeinfo/nodeinfo.ex b/lib/pleroma/web/nodeinfo/nodeinfo.ex index f88d1d6b3..532ae53a7 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo.ex @@ -80,10 +80,6 @@ defmodule Pleroma.Web.Nodeinfo.Nodeinfo do bubble: !Config.restrict_unauthenticated_access?(:timelines, :bubble) }, federatedTimelineAvailable: Config.get([:instance, :federated_timeline_available], true) - }, - operations: %{ - "com.shinolabs.api.bite": ["1.0.0"], - "jetzt.mia.ns.activitypub.accept.bite": ["1.0.0"] } } end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 52f8b7438..49ab3540b 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -631,8 +631,6 @@ defmodule Pleroma.Web.Router do get("/followed_tags", TagController, :show_followed) get("/preferences", AccountController, :preferences) - - post("/bite", BiteController, :bite) end scope "/api/web", Pleroma.Web do diff --git a/priv/repo/migrations/20240827000000_add_bite_to_notifications_enum.exs b/priv/repo/migrations/20240827000000_add_bite_to_notifications_enum.exs deleted file mode 100644 index b8b9c76b1..000000000 --- a/priv/repo/migrations/20240827000000_add_bite_to_notifications_enum.exs +++ /dev/null @@ -1,52 +0,0 @@ -defmodule Pleroma.Repo.Migrations.AddBiteToNotificationsEnum do - use Ecto.Migration - - @disable_ddl_transaction true - - def up do - """ - alter type notification_type add value 'bite' - """ - |> execute() - end - - # 20220605185734_add_update_to_notifications_enum.exs - def down do - alter table(:notifications) do - modify(:type, :string) - end - - """ - delete from notifications where type = 'bite' - """ - |> execute() - - """ - drop type if exists notification_type - """ - |> execute() - - """ - create type notification_type as enum ( - 'follow', - 'follow_request', - 'mention', - 'move', - 'pleroma:emoji_reaction', - 'pleroma:chat_mention', - 'reblog', - 'favourite', - 'pleroma:report', - 'poll', - 'update' - ) - """ - |> execute() - - """ - alter table notifications - alter column type type notification_type using (type::notification_type) - """ - |> execute() - end -end diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld index 7964b7036..6287669b6 100644 --- a/priv/static/schemas/litepub-0.1.jsonld +++ b/priv/static/schemas/litepub-0.1.jsonld @@ -54,8 +54,7 @@ "backgroundUrl": { "@id": "sharkey:backgroundUrl", "@type": "@id" - }, - "Bite": "https://ns.mia.jetzt/as#Bite" + } } ] }