Use convenience method
Patch by kareila.
diffs (78 lines):
diff -r 99b2bf0741bd -r 6a424a8da2f2 cgi-bin/DW/Controller/Rename.pm
--- a/cgi-bin/DW/Controller/Rename.pm Fri Oct 29 14:28:50 2010 +0800
+++ b/cgi-bin/DW/Controller/Rename.pm Fri Oct 29 14:32:35 2010 +0800
@@ -159,7 +159,7 @@ sub handle_post {
$other_opts{email} = 0;
}
- unless ( $LJ::USER_EMAIL && $journal->can_have_email_alias ) {
+ unless ( $journal->can_have_email_alias ) {
push @$errref, LJ::Lang::ml( '/rename.tt.error.emailnoalias' );
$other_opts{email} = 0;
}
@@ -299,7 +299,7 @@ sub handle_admin_post {
$other_opts{email} = 0;
}
- unless ( $LJ::USER_EMAIL && $opts{journal}->can_have_email_alias )
{
+ unless ( $opts{journal}->can_have_email_alias ) {
push @$errref, LJ::Lang::ml( '/rename.tt.error.emailnoalias' );
$other_opts{email} = 0;
}
diff -r 99b2bf0741bd -r 6a424a8da2f2 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm Fri Oct 29 14:28:50 2010 +0800
+++ b/cgi-bin/LJ/User.pm Fri Oct 29 14:32:35 2010 +0800
@@ -1977,6 +1977,7 @@ sub can_get_self_email {
}
sub can_have_email_alias {
+ return 0 unless $LJ::USER_EMAIL;
return $_[0]->get_cap( 'useremail' ) ? 1 : 0;
}
@@ -2662,11 +2663,10 @@ sub opt_showonlinestatus {
sub opt_whatemailshow {
my $u = $_[0];
- my $user_email = $LJ::USER_EMAIL && $u->can_have_email_alias;
# return prop value if it exists and is valid
my $prop_val = $u->prop( 'opt_whatemailshow' );
- $prop_val =~ tr/BVL/ADN/ unless $user_email;
+ $prop_val =~ tr/BVL/ADN/ unless $u->can_have_email_alias;
return $prop_val if $prop_val =~ /^[ALBNDV]$/;
# otherwise, return the default: no email shown
@@ -4433,7 +4433,7 @@ sub update_email_alias {
sub update_email_alias {
my $u = shift;
- return unless $u && $u->get_cap("useremail");
+ return unless $u && $u->can_have_email_alias;
return if exists $LJ::FIXED_ALIAS{$u->user};
return if $u->prop("no_mail_alias");
return unless $u->is_validated;
diff -r 99b2bf0741bd -r 6a424a8da2f2 htdocs/manage/profile/index.bml
--- a/htdocs/manage/profile/index.bml Fri Oct 29 14:28:50 2010 +0800
+++ b/htdocs/manage/profile/index.bml Fri Oct 29 14:32:35 2010 +0800
@@ -327,7 +327,7 @@ body<=
$ret .= "</td></tr>\n";
- if ( $LJ::USER_EMAIL && $u->can_have_email_alias && ! $u->prop(
"no_mail_alias" ) ) {
+ if ( $u->can_have_email_alias && ! $u->prop( "no_mail_alias" ) ) {
$ret .= "<tr class='field_block'><td class='field_name'>";
$ret .= BML::ml( '.fn.email.site', { siteabbrev =>
$LJ::SITENAMEABBREV } );
$ret .= "</td><td class='" . $zebra_row1->() . "'
style='vertical-align: middle'>\n";
diff -r 99b2bf0741bd -r 6a424a8da2f2 htdocs/tools/tellafriend.bml
--- a/htdocs/tools/tellafriend.bml Fri Oct 29 14:28:50 2010 +0800
+++ b/htdocs/tools/tellafriend.bml Fri Oct 29 14:32:35 2010 +0800
@@ -47,7 +47,7 @@ _c?>
# Get sender's email address
my $u = LJ::load_userid($remote->{'userid'});
$u->{'emailpref'} = $u->email_raw;
- if ( $LJ::USER_EMAIL && $u->can_have_email_alias ) {
+ if ( $u->can_have_email_alias ) {
$u->{'emailpref'} = $u->{'user'} . '@' . $LJ::USER_DOMAIN;
}
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog