FAForever/faf-java-api

Username check for reserved username is broken

Closed this issue · 2 comments

As it turns out the check wether a username is reserved after renaming is broken.

@Query(value = "SELECT user_id FROM name_history WHERE previous_name = :name AND now() > date_add(change_time, INTERVAL :months MONTH) ORDER BY change_time DESC LIMIT 1", nativeQuery = true)

now() should be smaller than change date + x month if a username is still reserved

from potential index perspective wouldn't it be better to compare now() - x month < change_date ?

If we had an index, that might make sense :D
Will change it, maybe we add the index later.