From 581aae081dcc75c0fd0520c0b9ae096e4b138681 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 13 Jun 2021 06:20:21 +0200 Subject: [PATCH] Model/Users: Remove superfluous "check_if_" prefix from check functions --- lib/Travelynx/Controller/Account.pm | 6 +++--- lib/Travelynx/Model/Users.pm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index a821b62..31ba434 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -100,12 +100,12 @@ sub register { return; } - if ( $self->users->check_if_user_name_exists( name => $user ) ) { + if ( $self->users->user_name_exists( name => $user ) ) { $self->render( 'register', invalid => 'user_collision' ); return; } - if ( $self->users->check_if_mail_is_blacklisted( email => $email ) ) { + if ( $self->users->mail_is_blacklisted( email => $email ) ) { $self->render( 'register', invalid => 'mail_blacklisted' ); return; } @@ -505,7 +505,7 @@ sub change_name { # is not possible. However, to minimize the number of failed SQL # queries, we first do a select check here and only attempt an update # if it succeeded. - if ( $self->users->check_if_user_name_exists( name => $new_name ) ) { + if ( $self->users->user_name_exists( name => $new_name ) ) { $self->render( 'change_name', invalid => 'user_collision' ); return; } diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm index 3c64e9d..8bd60f0 100644 --- a/lib/Travelynx/Model/Users.pm +++ b/lib/Travelynx/Model/Users.pm @@ -366,7 +366,7 @@ sub set_password_hash { $db->update( 'users', { password => $password }, { id => $uid } ); } -sub check_if_user_name_exists { +sub user_name_exists { my ( $self, %opt ) = @_; my $db = $opt{db} // $self->{pg}->db; my $user_name = $opt{name}; @@ -381,7 +381,7 @@ sub check_if_user_name_exists { return 0; } -sub check_if_mail_is_blacklisted { +sub mail_is_blacklisted { my ( $self, %opt ) = @_; my $db = $opt{db} // $self->{pg}->db; my $mail = $opt{email};