[livejournal] r17966: Minor bugfix:
Committer: gariev
Minor bugfix: 1. Don't die on polls of expunged users
2. Remove invalid call of LJ::Lang::ml() that eventually tried to get ml itemid for undef itemcode, and then to created a new ml_item (cgi-bin/ljlang.pl +308)
U trunk/cgi-bin/LJ/Poll.pm
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm 2010-12-17 10:11:19 UTC (rev 17965)
+++ trunk/cgi-bin/LJ/Poll.pm 2010-12-17 10:44:24 UTC (rev 17966)
@@ -230,33 +230,8 @@
my $p = HTML::TokeParser->new($postref);
- # if we're being called from mailgated, then we're not in web context and therefore
- # do not have any BML::ml functionality. detect this now and report errors in a
- # plaintext, non-translated form to be bounced via email.
-
- # FIXME: the above comment is obsolete, we now have LJ::Lang::ml
- # which will do the right thing
- my $have_bml = eval { LJ::Lang::ml() } || ! $@;
-
my $err = sub {
- # more than one element, either make a call to LJ::Lang::ml
- # or build up a semi-useful error string from it
- if (@_ > 1) {
- if ($have_bml) {
- $$error = LJ::Lang::ml(@_);
- return 0;
- }
-
- $$error = shift() . ": ";
- while (my ($k, $v) = each %{$_[0]}) {
- $$error .= "$k=$v,";
- }
- chop $$error;
- return 0;
- }
-
- # single element, either look up in %BML::ML or return verbatim
- $$error = $have_bml ? LJ::Lang::ml($_[0]) : $_[0];
+ $$error = LJ::Lang::ml(@_);
return 0;
};
@@ -596,6 +571,7 @@
} else {
my $u = LJ::load_userid($journalid)
or die "Invalid journalid $journalid";
+ return unless $u->is_visible; ## expunged and suspended journals
# double-check to make sure we are consulting the right table
if ($u->polls_clustered) {
