allow spaces in account names

This commit is contained in:
Dylan Knutson
2023-05-17 10:04:45 -07:00
parent df712f65db
commit c7a2a3481a
4 changed files with 901 additions and 0 deletions

View File

@@ -169,6 +169,7 @@ class Domain::Fa::User < ReduxApplicationRecord
name = name.strip
URL_NAME_EXCEPTIONS[name] || name.
delete("_").
gsub(/\s/, "").
downcase
end

View File

@@ -66,6 +66,16 @@ describe Domain::Fa::Parser::Page do
assert_match /Not Available/, up.profile_html
end
it "parses special accounts with spaces in the name" do
parser = get_parser "user_page_fa_staff.html"
assert parser.logged_in?
assert_page_type parser, :probably_user_page?
up = parser.user_page
assert_equal "Fur Affinity Staff", up.name
assert_equal 15_962, up.num_pageviews
assert_match /placeholder for sending system notices/, up.profile_html
end
it "gallery_is_correct" do
parser = get_parser "gallery_page_miles_df.html"
assert parser.logged_in?

View File

@@ -78,6 +78,13 @@ describe Domain::Fa::User do
}).errors.full_messages).to_not be_empty
end
it "name can contain whitespace for special accounts" do
expect(described_class.create({
name: "Fur Affinity Staff",
url_name: "furaffinitystaff",
}).errors.full_messages).to be_empty
end
it "posts can be moved from one user to another" do
user1 = SpecUtil.create_domain_fa_user(name: "Foo", url_name: "foo")
user2 = SpecUtil.create_domain_fa_user(name: "Bar", url_name: "bar")

File diff suppressed because one or more lines are too long