Birthdays: birth_date --> birthday
This commit is contained in:
parent
74cf0f0355
commit
66e8c6f90f
19 changed files with 92 additions and 92 deletions
|
|
@ -1501,8 +1501,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
nil
|
||||
end
|
||||
|
||||
birth_date =
|
||||
if data["vcard:bday"] do
|
||||
birthday =
|
||||
if is_binary(data["vcard:bday"]) do
|
||||
case Date.from_iso8601(data["vcard:bday"]) do
|
||||
{:ok, date} -> date
|
||||
{:error, _} -> nil
|
||||
|
|
@ -1534,7 +1534,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
shared_inbox: shared_inbox,
|
||||
accepts_chat_messages: accepts_chat_messages,
|
||||
pinned_objects: pinned_objects,
|
||||
birth_date: birth_date
|
||||
birthday: birthday
|
||||
}
|
||||
|
||||
# nickname can be nil because of virtual actors
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
%{}
|
||||
end
|
||||
|
||||
birth_date =
|
||||
if !user.hide_birth_date,
|
||||
do: user.birth_date,
|
||||
birthday =
|
||||
if !user.hide_birthday,
|
||||
do: user.birthday,
|
||||
else: nil
|
||||
|
||||
%{
|
||||
|
|
@ -122,7 +122,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do
|
|||
"discoverable" => user.is_discoverable,
|
||||
"capabilities" => capabilities,
|
||||
"alsoKnownAs" => user.also_known_as,
|
||||
"vcard:bday" => birth_date
|
||||
"vcard:bday" => birthday
|
||||
}
|
||||
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
||||
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
||||
|
|
|
|||
|
|
@ -544,10 +544,10 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||
nullable: true,
|
||||
description: "Invite token required when the registrations aren't public"
|
||||
},
|
||||
birth_date: %Schema{
|
||||
birthday: %Schema{
|
||||
type: :string,
|
||||
nullable: true,
|
||||
description: "User's birth date",
|
||||
description: "User's birthday",
|
||||
format: :date
|
||||
}
|
||||
},
|
||||
|
|
@ -727,16 +727,16 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||
"Discovery (listing, indexing) of this account by external services (search bots etc.) is allowed."
|
||||
},
|
||||
actor_type: ActorType,
|
||||
birth_date: %Schema{
|
||||
birthday: %Schema{
|
||||
type: :string,
|
||||
nullable: true,
|
||||
description: "User's birth date",
|
||||
description: "User's birthday",
|
||||
format: :date
|
||||
},
|
||||
hide_birth_date: %Schema{
|
||||
hide_birthday: %Schema{
|
||||
allOf: [BooleanLike],
|
||||
nullable: true,
|
||||
description: "User's birth date will be hidden"
|
||||
description: "User's birthday will be hidden"
|
||||
}
|
||||
},
|
||||
example: %{
|
||||
|
|
@ -758,8 +758,8 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do
|
|||
also_known_as: ["https://foo.bar/users/foo"],
|
||||
discoverable: false,
|
||||
actor_type: "Person",
|
||||
hide_birth_date: true,
|
||||
birth_date: "2001-02-12"
|
||||
hide_birthday: true,
|
||||
birthday: "2001-02-12"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
|||
description: "whether the user allows automatically follow moved following accounts"
|
||||
},
|
||||
background_image: %Schema{type: :string, nullable: true, format: :uri},
|
||||
birth_date: %Schema{type: :string, nullable: true, format: :date},
|
||||
birthday: %Schema{type: :string, nullable: true, format: :date},
|
||||
chat_token: %Schema{type: :string},
|
||||
is_confirmed: %Schema{
|
||||
type: :boolean,
|
||||
description:
|
||||
"whether the user account is waiting on email confirmation to be activated"
|
||||
},
|
||||
hide_birth_date: %Schema{type: :boolean, nullable: true},
|
||||
hide_birthday: %Schema{type: :boolean, nullable: true},
|
||||
hide_favorites: %Schema{type: :boolean},
|
||||
hide_followers_count: %Schema{
|
||||
type: :boolean,
|
||||
|
|
@ -205,7 +205,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do
|
|||
"settings_store" => %{
|
||||
"pleroma-fe" => %{}
|
||||
},
|
||||
"birth_date" => "2001-02-12"
|
||||
"birthday" => "2001-02-12"
|
||||
},
|
||||
"source" => %{
|
||||
"fields" => [],
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
:allow_following_move,
|
||||
:also_known_as,
|
||||
:accepts_chat_messages,
|
||||
:hide_birth_date
|
||||
:hide_birthday
|
||||
]
|
||||
|> Enum.reduce(%{}, fn key, acc ->
|
||||
Maps.put_if_present(acc, key, params[key], &{:ok, Params.truthy_param?(&1)})
|
||||
|
|
@ -220,7 +220,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
|> Maps.put_if_present(:is_locked, params[:locked])
|
||||
# Note: param name is indeed :discoverable (not an error)
|
||||
|> Maps.put_if_present(:is_discoverable, params[:discoverable])
|
||||
|> Maps.put_if_present(:birth_date, params[:birth_date])
|
||||
|> Maps.put_if_present(:birthday, params[:birthday])
|
||||
|
||||
# What happens here:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -298,8 +298,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
background_image: image_url(user.background) |> MediaProxy.url(),
|
||||
accepts_chat_messages: user.accepts_chat_messages,
|
||||
favicon: favicon,
|
||||
birth_date: user.birth_date,
|
||||
hide_birth_date: user.hide_birth_date
|
||||
birthday: user.birthday,
|
||||
hide_birthday: user.hide_birthday
|
||||
}
|
||||
}
|
||||
|> maybe_put_role(user, opts[:for])
|
||||
|
|
@ -313,7 +313,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
|> maybe_put_unread_conversation_count(user, opts[:for])
|
||||
|> maybe_put_unread_notification_count(user, opts[:for])
|
||||
|> maybe_put_email_address(user, opts[:for])
|
||||
|> maybe_hide_birth_date(user, opts[:for])
|
||||
|> maybe_hide_birthday(user, opts[:for])
|
||||
end
|
||||
|
||||
defp username_from_nickname(string) when is_binary(string) do
|
||||
|
|
@ -435,21 +435,21 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
|
||||
defp maybe_put_email_address(data, _, _), do: data
|
||||
|
||||
defp maybe_hide_birth_date(data, %User{id: user_id}, %User{id: user_id}) do
|
||||
defp maybe_hide_birthday(data, %User{id: user_id}, %User{id: user_id}) do
|
||||
data
|
||||
end
|
||||
|
||||
defp maybe_hide_birth_date(data, %User{hide_birth_date: true}, _) do
|
||||
defp maybe_hide_birthday(data, %User{hide_birthday: true}, _) do
|
||||
data
|
||||
|> Kernel.pop_in([:pleroma, :birth_date])
|
||||
|> Kernel.pop_in([:pleroma, :birthday])
|
||||
|> elem(1)
|
||||
|> Kernel.pop_in([:pleroma, :hide_birth_date])
|
||||
|> Kernel.pop_in([:pleroma, :hide_birthday])
|
||||
|> elem(1)
|
||||
end
|
||||
|
||||
defp maybe_hide_birth_date(data, _, _) do
|
||||
defp maybe_hide_birthday(data, _, _) do
|
||||
data
|
||||
|> Kernel.pop_in([:pleroma, :hide_birth_date])
|
||||
|> Kernel.pop_in([:pleroma, :hide_birthday])
|
||||
|> elem(1)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
|||
fields_limits: fields_limits(),
|
||||
post_formats: Config.get([:instance, :allowed_post_formats]),
|
||||
privileged_staff: Config.get([:instance, :privileged_staff]),
|
||||
birth_date_required: Config.get([:instance, :birth_date_required]),
|
||||
birth_date_min_age: Config.get([:instance, :birth_date_min_age])
|
||||
birthday_required: Config.get([:instance, :birthday_required]),
|
||||
birthday_min_age: Config.get([:instance, :birthday_min_age])
|
||||
},
|
||||
stats: %{mau: Pleroma.User.active_user_count()},
|
||||
vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||
|> Map.put(:name, Map.get(params, :fullname, params[:username]))
|
||||
|> Map.put(:password_confirmation, params[:password])
|
||||
|> Map.put(:registration_reason, params[:reason])
|
||||
|> Map.put(:birth_date, params[:birth_date])
|
||||
|> Map.put(:birthday, params[:birthday])
|
||||
|
||||
if Pleroma.Config.get([:instance, :registrations_open]) do
|
||||
create_user(params, opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue