users: waive one name change per week rule if user has invalid name.

This commit is contained in:
evazion
2022-03-08 03:20:57 -06:00
parent f0a5936091
commit 99479dfcf2

View File

@@ -31,6 +31,8 @@ class UserNameChangeRequest < ApplicationRecord
end
def not_limited
return if user.name_invalid?
if UserNameChangeRequest.unscoped.where(user: user).exists?(["created_at >= ?", 1.week.ago])
errors.add(:base, "You can only submit one name change request per week")
end