[vhffs-dev] [2147] Fixed an API fail when the domain associated with the Newsletter does not exist

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2147
Author:   gradator
Date:     2012-04-13 23:52:07 +0200 (Fri, 13 Apr 2012)
Log Message:
-----------
Fixed an API fail when the domain associated with the Newsletter does not exist

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm

Modified: trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-04-11 22:10:17 UTC (rev 2146)
+++ trunk/vhffs-api/src/Vhffs/Services/Newsletter.pm	2012-04-13 21:52:07 UTC (rev 2147)
@@ -58,15 +58,13 @@
 
 	return undef unless defined $vhffs and defined $user and $vhffs->get_config->get_service_availability('newsletter');
 	my $config = $vhffs->get_config->get_service('newsletter');
+	return unless defined $config->{'mailinglist'};
 
 	# Fetches the mail domain defined in config
-	my $mailinglist_service;
-	if( defined $config->{'mailinglist'} )  {
-		my ( $localpart, $domain ) = ( $config->{'mailinglist'} =~ /(.+)\@(.+)/ );
-		$mailinglist_service = Vhffs::Services::MailingList::get_by_mladdress( $vhffs, $localpart, $domain );
-		$mailinglist_service->fetch_sub( $user->get_mail );
-	}
-	return undef unless defined $mailinglist_service;
+	my ( $localpart, $domain ) = ( $config->{'mailinglist'} =~ /(.+)\@(.+)/ );
+	my $mailinglist_service = Vhffs::Services::MailingList::get_by_mladdress( $vhffs, $localpart, $domain );
+	return unless defined $mailinglist_service;
+	$mailinglist_service->fetch_sub( $user->get_mail );
 
 	my $this = {};
 	$this->{vhffs} = $vhffs;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/