name exception for kammiu

This commit is contained in:
Dylan Knutson
2023-05-04 08:51:15 -07:00
parent c3d8c7afa7
commit 99ee3aaa91
2 changed files with 13 additions and 3 deletions

View File

@@ -155,13 +155,16 @@ class Domain::Fa::User < ReduxApplicationRecord
end
end
URL_NAME_EXCEPTIONS = {
"Kammiu" => "rammiu",
}
def self.name_to_url_name(name)
name.
name = name.strip
URL_NAME_EXCEPTIONS[name] || name.
delete("_").
delete("!").
delete("").
downcase.
strip
downcase
end
# TODO - write method for getting suggested users to follow

View File

@@ -57,6 +57,13 @@ describe Domain::Fa::User do
}).errors.full_messages).to be_empty
end
it "allows the rammiu exception" do
expect(described_class.create({
name: "Kammiu",
url_name: "rammiu",
}).errors.full_messages).to be_empty
end
it "cannot be created with uppercase url name" do
expect(described_class.create({
name: "Foo",