mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Merge branch 'fix_empty_bio_crash' into 'develop'
Fixes #415. Do not crash during registration when hasn't filled bio field Closes #415 See merge request pleroma/pleroma!529
This commit is contained in:
commit
0863ec2737
2 changed files with 23 additions and 2 deletions
|
@ -806,7 +806,11 @@ defmodule Pleroma.User do
|
|||
end
|
||||
end
|
||||
|
||||
def parse_bio(bio, user \\ %User{info: %{source_data: %{}}}) do
|
||||
def parse_bio(bio, user \\ %User{info: %{source_data: %{}}})
|
||||
def parse_bio(nil, user), do: ""
|
||||
def parse_bio(bio, user) when bio == "", do: bio
|
||||
|
||||
def parse_bio(bio, user) do
|
||||
mentions = Formatter.parse_mentions(bio)
|
||||
tags = Formatter.parse_tags(bio)
|
||||
|
||||
|
|
|
@ -246,7 +246,24 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||
"nickname" => "lain",
|
||||
"email" => "lain@wired.jp",
|
||||
"fullname" => "lain iwakura",
|
||||
"bio" => "close the world.",
|
||||
"password" => "bear",
|
||||
"confirm" => "bear"
|
||||
}
|
||||
|
||||
{:ok, user} = TwitterAPI.register_user(data)
|
||||
|
||||
fetched_user = Repo.get_by(User, nickname: "lain")
|
||||
|
||||
assert UserView.render("show.json", %{user: user}) ==
|
||||
UserView.render("show.json", %{user: fetched_user})
|
||||
end
|
||||
|
||||
test "it registers a new user with empty string in bio and returns the user." do
|
||||
data = %{
|
||||
"nickname" => "lain",
|
||||
"email" => "lain@wired.jp",
|
||||
"fullname" => "lain iwakura",
|
||||
"bio" => "",
|
||||
"password" => "bear",
|
||||
"confirm" => "bear"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue