thanks, that was one of the clunkiest parts of the rewrite for me!
Tweaked 8d73131df2381e8a16f96803a98c89c0ca261c22


On Fri, Apr 19, 2013 at 1:55 PM, Mark Smith <notifications@github.com>wrote:

> In cgi-bin/DW/EmailPost/Entry.pm:
>
> > +    my $self = $_[0];
> > +
> > +    my $from = $self->{from};
> > +    my $pin = $self->{pin};
> > +    my $u = $self->{u};
> > +
> > +    # Validity checks.  We only care about these if they aren't using PGP.
> > +    unless ( lc $pin eq 'pgp' && $LJ::USE_PGP ) {
> > +        my $addrlist = LJ::Emailpost::Web::get_allowed_senders( $self->{u} );
> > +        unless ( ref $addrlist && keys %$addrlist ) {
> > +            $self->{error} = "No allowed senders have been saved for your account.";
> > +            $self->{error_args} = { nomail => 1 };
> > +            return;
> > +        }
> > +
> > +        $self->{error} = "Unauthorized sender address: $from" and return
>
> Mmf. I don't really like "and return" style. I know it works, but using
> low-precedence and is just... unclear. I'd recommend instead,
>
> my $error = sub {
>     $self->{error} = $_[0];
>     return undef;}
> return $error->("Unauthorized...") unless ...
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/dreamwidth/dw-free/pull/346/files#r3868259>
> .
>