forked from AkkomaGang/akkoma
user: remove blank?
This commit is contained in:
parent
c077ad0b33
commit
77ee64b993
1 changed files with 7 additions and 4 deletions
|
@ -343,9 +343,15 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do
|
||||||
bio_limit = Pleroma.Config.get([:instance, :user_bio_length], 5000)
|
bio_limit = Pleroma.Config.get([:instance, :user_bio_length], 5000)
|
||||||
name_limit = Pleroma.Config.get([:instance, :user_name_length], 100)
|
name_limit = Pleroma.Config.get([:instance, :user_name_length], 100)
|
||||||
|
|
||||||
|
name =
|
||||||
|
case params[:name] do
|
||||||
|
name when is_binary(name) and byte_size(name) > 0 -> name
|
||||||
|
_ -> params[:nickname]
|
||||||
|
end
|
||||||
|
|
||||||
params =
|
params =
|
||||||
params
|
params
|
||||||
|> Map.put(:name, blank?(params[:name]) || params[:nickname])
|
|> Map.put(:name, name)
|
||||||
|> Map.put_new(:last_refreshed_at, NaiveDateTime.utc_now())
|
|> Map.put_new(:last_refreshed_at, NaiveDateTime.utc_now())
|
||||||
|> truncate_if_exists(:name, name_limit)
|
|> truncate_if_exists(:name, name_limit)
|
||||||
|> truncate_if_exists(:bio, bio_limit)
|
|> truncate_if_exists(:bio, bio_limit)
|
||||||
|
@ -1599,9 +1605,6 @@ def get_public_key_for_ap_id(ap_id) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp blank?(""), do: nil
|
|
||||||
defp blank?(n), do: n
|
|
||||||
|
|
||||||
def ap_enabled?(%User{local: true}), do: true
|
def ap_enabled?(%User{local: true}), do: true
|
||||||
def ap_enabled?(%User{ap_enabled: ap_enabled}), do: ap_enabled
|
def ap_enabled?(%User{ap_enabled: ap_enabled}), do: ap_enabled
|
||||||
def ap_enabled?(_), do: false
|
def ap_enabled?(_), do: false
|
||||||
|
|
Loading…
Reference in a new issue