Telegram bot /link case sensitive user search fix.

This commit is contained in:
Alexey Skobkin 2017-01-06 00:00:37 +03:00
parent 4ebc547ab2
commit d9082a3a71
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ class UserRepository extends EntityRepository
* @return User|null
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function findUserByLogin($login)
public function findUserByLogin(string $login)
{
$qb = $this->createQueryBuilder('u');
@ -36,7 +36,7 @@ class UserRepository extends EntityRepository
*
* @return User[]
*/
public function findUsersLikeLogin($login, $limit = 10)
public function findUsersLikeLogin(string $login, int $limit = 10)
{
if (empty($login)) {
return [];
@ -68,7 +68,7 @@ class UserRepository extends EntityRepository
* @param integer $id
* @return User[]
*/
public function findUserSubscribersById($id)
public function findUserSubscribersById(int $id)
{
if (!is_int($id)) {
throw new \InvalidArgumentException('$id must be an integer');
@ -93,7 +93,7 @@ class UserRepository extends EntityRepository
*
* @return TopUserDTO[]
*/
public function getTopUsers($limit = 30)
public function getTopUsers(int $limit = 30)
{
if (!is_int($limit)) {
throw new \InvalidArgumentException('$limit must be an integer');

View file

@ -209,7 +209,7 @@ class PrivateMessageProcessor
{
if ($this->userApi->isAuthDataValid($login, $password)) {
/** @var User $user */
if (null === $user = $this->userRepo->findOneBy(['login' => $login])) {
if (null === $user = $this->userRepo->findUserByLogin($login)) {
throw new CommandProcessingException('User not found in Point Tools database. Please try again later.');
}