Model/Users: Remove superfluous "check_if_" prefix from check functions

This commit is contained in:
Daniel Friesel 2021-06-13 06:20:21 +02:00
parent 6cee1e20ef
commit 581aae081d
2 changed files with 5 additions and 5 deletions

View file

@ -100,12 +100,12 @@ sub register {
return; 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' ); $self->render( 'register', invalid => 'user_collision' );
return; 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' ); $self->render( 'register', invalid => 'mail_blacklisted' );
return; return;
} }
@ -505,7 +505,7 @@ sub change_name {
# is not possible. However, to minimize the number of failed SQL # is not possible. However, to minimize the number of failed SQL
# queries, we first do a select check here and only attempt an update # queries, we first do a select check here and only attempt an update
# if it succeeded. # 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' ); $self->render( 'change_name', invalid => 'user_collision' );
return; return;
} }

View file

@ -366,7 +366,7 @@ sub set_password_hash {
$db->update( 'users', { password => $password }, { id => $uid } ); $db->update( 'users', { password => $password }, { id => $uid } );
} }
sub check_if_user_name_exists { sub user_name_exists {
my ( $self, %opt ) = @_; my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db; my $db = $opt{db} // $self->{pg}->db;
my $user_name = $opt{name}; my $user_name = $opt{name};
@ -381,7 +381,7 @@ sub check_if_user_name_exists {
return 0; return 0;
} }
sub check_if_mail_is_blacklisted { sub mail_is_blacklisted {
my ( $self, %opt ) = @_; my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db; my $db = $opt{db} // $self->{pg}->db;
my $mail = $opt{email}; my $mail = $opt{email};