[dw-free] migrate journaltype checks to use abstracted functions instead
[commit: http://hg.dwscoalition.org/dw-free/rev/b31a63fd1737]
http://bugs.dwscoalition.org/show_bug.cgi?id=1384
Code cleanup: use journaltype & statusvis methods instead of direct lookups.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1384
Code cleanup: use journaltype & statusvis methods instead of direct lookups.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- bin/moveucluster.pl
- bin/upgrading/blobify_userpics.pl
- bin/upgrading/migrate-phoneposts.pl
- bin/upgrading/migrate-userpics.pl
- bin/upgrading/move0cluster.pl
- cgi-bin/Apache/LiveJournal.pm
- cgi-bin/Apache/LiveJournal/Interface/Blogger.pm
- cgi-bin/DW/BusinessRules/InviteCodes.pm
- cgi-bin/DW/InviteCodes.pm
- cgi-bin/DW/Logic/LogItems.pm
- cgi-bin/DW/Logic/UserLinkBar.pm
- cgi-bin/DW/User/Edges/WatchTrust/UserHelper.pm
- cgi-bin/LJ/CProd/Feeds.pm
- cgi-bin/LJ/Comment.pm
- cgi-bin/LJ/Console/Command/ChangeJournalType.pm
- cgi-bin/LJ/Console/Command/SetBadpassword.pm
- cgi-bin/LJ/Entry.pm
- cgi-bin/LJ/M/FriendsOf.pm
- cgi-bin/LJ/Portal/Box/Friends.pm
- cgi-bin/LJ/Portal/Box/FriendsPage.pm
- cgi-bin/LJ/Portal/Box/PopWithFriends.pm
- cgi-bin/LJ/Portal/Box/RecentComments.pm
- cgi-bin/LJ/S2.pm
- cgi-bin/LJ/S2/DayPage.pm
- cgi-bin/LJ/S2/EntryPage.pm
- cgi-bin/LJ/S2/FriendsPage.pm
- cgi-bin/LJ/S2/MonthPage.pm
- cgi-bin/LJ/S2/RecentPage.pm
- cgi-bin/LJ/S2/ReplyPage.pm
- cgi-bin/LJ/Session.pm
- cgi-bin/LJ/SixDegrees.pm
- cgi-bin/LJ/User.pm
- cgi-bin/ljfeed.pl
- cgi-bin/ljprotocol.pl
- cgi-bin/supportlib.pl
- cgi-bin/taglib.pl
- cgi-bin/talklib.pl
- cgi-bin/weblib.pl
- htdocs/accountstatus.bml
- htdocs/admin/userlog.bml
- htdocs/allpics.bml
- htdocs/birthdays.bml
- htdocs/community/join.bml
- htdocs/community/leave.bml
- htdocs/community/manage.bml
- htdocs/community/members.bml
- htdocs/community/sentinvites.bml
- htdocs/community/settings.bml
- htdocs/community/transfer.bml
- htdocs/delcomment.bml
- htdocs/editjournal.bml
- htdocs/edittags.bml
- htdocs/inbox/compose.bml
- htdocs/interests.bml
- htdocs/login.bml
- htdocs/lostinfo.bml
- htdocs/manage/circle/add.bml
- htdocs/manage/index.bml
- htdocs/mobile/index.bml
- htdocs/multisearch.bml
- htdocs/register.bml
- htdocs/support/see_request.bml
- htdocs/talkpost.bml
- htdocs/talkread.bml
- htdocs/tools/memadd.bml
- htdocs/tools/memories.bml
- htdocs/tools/recent_comments.bml
- htdocs/view/index.bml
-------------------------------------------------------------------------------- diff -r 17d6af7ec9b3 -r b31a63fd1737 bin/moveucluster.pl --- a/bin/moveucluster.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/bin/moveucluster.pl Thu Jul 30 11:38:40 2009 -0500 @@ -680,8 +680,8 @@ sub moveUser { "random_user_set" => 1, # " ); - $skip_table{'inviterecv'} = 1 if $u->{journaltype} ne 'P'; # non-person, skip invites received - $skip_table{'invitesent'} = 1 if $u->{journaltype} ne 'C'; # not community, skip invites sent + $skip_table{'inviterecv'} = 1 unless $u->is_person; # if not person, skip invites received + $skip_table{'invitesent'} = 1 unless $u->is_community; # if not community, skip invites sent # we had a concern at the time of writing this dependency optization # that we might use "log3" and "talk3" tables in the future with the @@ -740,8 +740,7 @@ sub moveUser { next if $skip_table{$table}; # people accounts don't have moderated posts - next if $u->{'journaltype'} eq "P" && ($table eq "modlog" || - $table eq "modblob"); + next if $u->is_person && ($table eq "modlog" || $table eq "modblob"); # don't waste time looking at dependent tables with empty parents next if $dep{$table} && $was_empty{$dep{$table}}; diff -r 17d6af7ec9b3 -r b31a63fd1737 bin/upgrading/blobify_userpics.pl --- a/bin/upgrading/blobify_userpics.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/bin/upgrading/blobify_userpics.pl Thu Jul 30 11:38:40 2009 -0500 @@ -38,7 +38,7 @@ while ($loop) { die "Can't find userid: $uid" unless $u; # sometimes expunges don't expunge all the way. - if ($u->{'statusvis'} eq "X") { + if ( $u->is_expunged ) { $db->do("DELETE FROM userpicblob2 WHERE userid=$uid AND picid=$picid"); next; } diff -r 17d6af7ec9b3 -r b31a63fd1737 bin/upgrading/migrate-phoneposts.pl --- a/bin/upgrading/migrate-phoneposts.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/bin/upgrading/migrate-phoneposts.pl Thu Jul 30 11:38:40 2009 -0500 @@ -155,7 +155,7 @@ sub handle_userid { # if they're expunged, they might have data somewhere if they were # copy-moved from A to B, then expunged on B. now we're on A and # need to delete it ourselves (if purge-old is on) - if ($u->{clusterid} == 0 && $u->{statusvis} eq "X") { + if ( $u->{clusterid} == 0 && $u->is_expunged ) { return unless $purge; # if we get here, the user has indicated they want data purged, get handle my $to_purge_dbcm = get_db_handle($cid); diff -r 17d6af7ec9b3 -r b31a63fd1737 bin/upgrading/migrate-userpics.pl --- a/bin/upgrading/migrate-userpics.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/bin/upgrading/migrate-userpics.pl Thu Jul 30 11:38:40 2009 -0500 @@ -161,7 +161,7 @@ sub handle_userid { # if they're expunged, they might have data somewhere if they were # copy-moved from A to B, then expunged on B. now we're on A and # need to delete it ourselves (if purge-old is on) - if ($u->{clusterid} == 0 && $u->{statusvis} eq "X") { + if ( $u->{clusterid} == 0 && $u->is_expunged ) { return unless $purge; # if we get here, the user has indicated they want data purged, get handle my $to_purge_dbcm = get_db_handle($cid); diff -r 17d6af7ec9b3 -r b31a63fd1737 bin/upgrading/move0cluster.pl --- a/bin/upgrading/move0cluster.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/bin/upgrading/move0cluster.pl Thu Jul 30 11:38:40 2009 -0500 @@ -123,7 +123,7 @@ if ($opt_prelocked) { } } -if ($opt_expungedel && $u->{'statusvis'} eq "D" && +if ($opt_expungedel && $u->is_deleted && LJ::mysqldate_to_time($u->{'statusvisdate'}) < time() - 86400*31) { print "Expunging user '$u->{'user'}'\n"; @@ -512,7 +512,7 @@ elsif ($sclust > 0) # manual moving (dumb copies) foreach my $table (@manual_move, @local_tables) { - next if ($table eq "modlog" || $table eq "modblob") && $u->{journaltype} eq "P"; + next if ($table eq "modlog" || $table eq "modblob") && $u->is_person; print " moving $table ...\n" if $optv > 1; my @cols; my $sth = $dbo->prepare("DESCRIBE $table"); diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/Apache/LiveJournal.pm --- a/cgi-bin/Apache/LiveJournal.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/Apache/LiveJournal.pm Thu Jul 30 11:38:40 2009 -0500 @@ -730,7 +730,7 @@ sub trans # journals. This ensures redirects work sensibly for all valid paths # under a given username, without sprinkling redirects everywhere. my $u = LJ::load_user($user); - if ($u && $u->{'journaltype'} eq 'R' && $u->{'statusvis'} eq 'R') { + if ( $u && $u->is_redirect && $u->is_renamed ) { LJ::load_user_props($u, 'renamedto'); my $renamedto = $u->{'renamedto'}; if ($renamedto ne '') { @@ -1076,7 +1076,7 @@ sub userpic_content # Load the user object and pic and make sure the picture is viewable my $u = LJ::load_userid($userid); - return NOT_FOUND unless $u && $u->{'statusvis'} !~ /[XS]/; + return NOT_FOUND unless $u && ! ( $u->is_expunged || $u->is_suspended ); my %upics; LJ::load_userpics(\%upics, [ $u, $picid ]); @@ -1358,7 +1358,7 @@ sub journal_content { my $u = LJ::load_user($RQ{'user'}); my $base = "$LJ::SITEROOT/users/$RQ{'user'}"; - $base = "$LJ::SITEROOT/community/$RQ{'user'}" if $u && $u->{'journaltype'} eq "C"; + $base = "$LJ::SITEROOT/community/$RQ{'user'}" if $u && $u->is_community; return redir($r, "$base$uri$args_wq"); } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/Apache/LiveJournal/Interface/Blogger.pm --- a/cgi-bin/Apache/LiveJournal/Interface/Blogger.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/Apache/LiveJournal/Interface/Blogger.pm Thu Jul 30 11:38:40 2009 -0500 @@ -130,7 +130,7 @@ sub getUsersBlogs { my $us = LJ::load_userids(@$ids); my @list = ($u); foreach (sort { $a->{user} cmp $b->{user} } values %$us) { - next unless $_->{'statusvis'} eq "V"; + next unless $_->is_visible; push @list, $_; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/DW/BusinessRules/InviteCodes.pm --- a/cgi-bin/DW/BusinessRules/InviteCodes.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/DW/BusinessRules/InviteCodes.pm Thu Jul 30 11:38:40 2009 -0500 @@ -134,9 +134,7 @@ sub search_class { while (my $row = $sth->fetchrow_hashref) { push @uids, $row->{userid} - if $row->{journaltype} eq 'P' - && $row->{status} eq 'A' - && $row->{statusvis} eq 'V'; + if $row->is_person && $row->{status} eq 'A' && $row->is_visible; $max_nusers--; } @@ -151,9 +149,7 @@ sub search_class { while (my $row = $sth->fetchrow_hashref) { push @uids, $row->{userid} - if $row->{journaltype} eq 'P' - && $row->{status} eq 'A' - && $row->{statusvis} eq 'V'; + if $row->is_person && $row->{status} eq 'A' && $row->is_visible; $max_nusers--; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/DW/InviteCodes.pm --- a/cgi-bin/DW/InviteCodes.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/DW/InviteCodes.pm Thu Jul 30 11:38:40 2009 -0500 @@ -194,7 +194,7 @@ sub check_code { # is the inviter suspended? my $u = LJ::load_userid( $ac->{userid} ); - return 0 if ( $u && $u->{statusvis} eq "S" ); + return 0 if ( $u && $u->is_suspended ); return 1; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/DW/Logic/LogItems.pm --- a/cgi-bin/DW/Logic/LogItems.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/DW/Logic/LogItems.pm Thu Jul 30 11:38:40 2009 -0500 @@ -97,8 +97,8 @@ sub watch_items # delete u objects based on 'showtypes' foreach my $fid ( keys %$friends_u ) { my $fu = $friends_u->{$fid}; - if ($fu->{statusvis} ne 'V' || - $valid_types && index(uc($valid_types), $fu->{journaltype}) == -1) + if ( ! $fu->is_visible || + $valid_types && index(uc($valid_types), $fu->{journaltype}) == -1 ) { delete $friends_u->{$fid}; delete $friends->{$fid}; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/DW/Logic/UserLinkBar.pm --- a/cgi-bin/DW/Logic/UserLinkBar.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/DW/Logic/UserLinkBar.pm Thu Jul 30 11:38:40 2009 -0500 @@ -411,7 +411,7 @@ sub tellafriend { my $remote = $self->{remote}; my $user = $u->user; - if ( $remote && $u->{journaltype} ne 'I' && LJ::is_enabled('tellafriend') ) + if ( $remote && ! $u->is_identity && LJ::is_enabled('tellafriend') ) { my $link = { url => "tools/tellafriend.bml?user=$user", diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/DW/User/Edges/WatchTrust/UserHelper.pm --- a/cgi-bin/DW/User/Edges/WatchTrust/UserHelper.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/DW/User/Edges/WatchTrust/UserHelper.pm Thu Jul 30 11:38:40 2009 -0500 @@ -147,8 +147,7 @@ sub _mutually_trusted_users { my $us = LJ::load_userids(@ids); return $fom->{t_mut_users} = [ sort { $a->display_name cmp $b->display_name } - grep { $_->{statusvis} =~ /[VML]/ && - ($_->{journaltype} eq "P" || $_->{journaltype} eq "I") } + grep { $_->statusvis =~ /[VML]/ && $_->is_individual } map { $us->{$_} ? ($us->{$_}) : () } @ids ]; @@ -164,8 +163,7 @@ sub _mutually_watched_users { my $us = LJ::load_userids(@ids); return $fom->{w_mut_users} = [ sort { $a->display_name cmp $b->display_name } - grep { $_->{statusvis} =~ /[VML]/ && - ($_->{journaltype} eq "P" || $_->{journaltype} eq "I") } + grep { $_->statusvis =~ /[VML]/ && $_->is_individual } map { $us->{$_} ? ($us->{$_}) : () } @ids ]; @@ -245,19 +243,11 @@ sub _trusted_by_users { my $us = LJ::load_userids(@to_load); return $fom->{_trusted_by_users} = [ - sort { - $a->display_name cmp $b->display_name - } - grep { - $_->{statusvis} =~ /[VML]/ && - ($_->{journaltype} eq "P" || - $_->{journaltype} eq "I") - } - map { - $us->{$_} ? ($us->{$_}) : () - } - @to_load - ]; + sort { $a->display_name cmp $b->display_name } + grep { $_->statusvis =~ /[VML]/ && $_->is_individual } + map { $us->{$_} ? ($us->{$_}) : () } + @to_load + ]; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/CProd/Feeds.pm --- a/cgi-bin/LJ/CProd/Feeds.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/CProd/Feeds.pm Thu Jul 30 11:38:40 2009 -0500 @@ -14,7 +14,7 @@ sub applicable { my ($user, $name, $suserid, $url, $count) = @{ $popsyn->[$_] }; my $suser = LJ::load_userid($suserid); - return 0 if ($friends{$suserid} || $suser->{'statusvis'} ne "V"); + return 0 if ( $friends{$suserid} || ! $suser->is_visible ); } return 1; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Comment.pm --- a/cgi-bin/LJ/Comment.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Comment.pm Thu Jul 30 11:38:40 2009 -0500 @@ -857,7 +857,7 @@ sub visible_to { || LJ::u_equals($u, $self->entry->poster )); # posted the entry # comments from suspended users aren't visible - return 0 if $self->poster && $self->poster->{statusvis} eq 'S'; + return 0 if $self->poster && $self->poster->is_suspended; return 1; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Console/Command/ChangeJournalType.pm --- a/cgi-bin/LJ/Console/Command/ChangeJournalType.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Console/Command/ChangeJournalType.pm Thu Jul 30 11:38:40 2009 -0500 @@ -40,7 +40,7 @@ sub execute { unless $u->is_visible; return $self->error("Account is not a personal or community journal.") - unless $u->journaltype =~ /[PC]/; + unless $u->is_person || $u->is_community; return $self->error("You cannot convert your own account.") if LJ::u_equals($remote, $u); diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Console/Command/SetBadpassword.pm --- a/cgi-bin/LJ/Console/Command/SetBadpassword.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Console/Command/SetBadpassword.pm Thu Jul 30 11:38:40 2009 -0500 @@ -34,8 +34,8 @@ sub execute { return $self->error("Cannot set bad password flag for a purged account.") if $u->is_expunged; - return $self->error("Account is not a personal or shared journal.") - unless $u->journaltype =~ /[PS]/; + return $self->error("Account is not a personal journal.") + unless $u->is_person; return $self->error("Second argument must be 'on' or 'off'.") unless $state =~ /^(?:on|off)/; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Entry.pm --- a/cgi-bin/LJ/Entry.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Entry.pm Thu Jul 30 11:38:40 2009 -0500 @@ -842,10 +842,10 @@ sub visible_to # can't see anything unless the journal is visible # unless you have viewsome. then, other restrictions apply if (!$viewsome) { - return 0 if $self->journal->{statusvis} =~ m/[DSX]/; + return 0 if $self->journal->is_inactive; # can't see anything by suspended users - return 0 if $self->poster->{statusvis} eq 'S'; + return 0 if $self->poster->is_suspended; # can't see suspended entries return 0 if $self->is_suspended_for($remote); @@ -872,7 +872,7 @@ sub visible_to # if it's usemask, we have to refuse non-personal journals, # so we have to load the user - return 0 unless $remote->{'journaltype'} eq 'P' || $remote->{'journaltype'} eq 'I'; + return 0 unless $remote->is_individual; # check if it's a community and they're a member return 1 if $self->journal->is_community && @@ -1669,7 +1669,7 @@ sub get_log2_recent_user next if $item->{'security'} eq 'private' and $item->{'journalid'} != $remote->{'userid'}; if ($item->{'security'} eq 'usemask') { - next unless $remote->{'journaltype'} eq "P" || $remote->{'journaltype'} eq 'I'; + next unless $remote->is_individual; my $permit = ($item->{'journalid'} == $remote->{'userid'}); unless ($permit) { # $mask for $item{journalid} should always be the same since get_log2_recent_log @@ -1730,7 +1730,7 @@ sub get_itemid_near2 my $dbr = LJ::get_cluster_reader($u); my $jid = $u->{'userid'}+0; - my $field = $u->{'journaltype'} eq "P" ? "revttime" : "rlogtime"; + my $field = $u->is_person ? "revttime" : "rlogtime"; my $stime = $dbr->selectrow_array("SELECT $field FROM log2 WHERE ". "journalid=$jid AND jitemid=$jitemid"); diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/M/FriendsOf.pm --- a/cgi-bin/LJ/M/FriendsOf.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/M/FriendsOf.pm Thu Jul 30 11:38:40 2009 -0500 @@ -113,11 +113,10 @@ sub _mutual_friends { my $us = LJ::load_userids(@ids); return $fom->{mutual_friends} = [ sort { $a->display_name cmp $b->display_name } - grep { $_->{statusvis} =~ /[VML]/ && - ($_->{journaltype} eq "P" || $_->{journaltype} eq "I") } + grep { $_->statusvis =~ /[VML]/ && $_->is_individual } map { $us->{$_} ? ($us->{$_}) : () } @ids - ]; + ]; } # returns arrayref of mutual friendids. sorted by username @@ -174,19 +173,11 @@ sub _friend_ofs { my $us = LJ::load_userids(@to_load); return $fom->{_friendof_us} = [ - sort { - $a->display_name cmp $b->display_name - } - grep { - $_->{statusvis} =~ /[VML]/ && - ($_->{journaltype} eq "P" || - $_->{journaltype} eq "I") - } - map { - $us->{$_} ? ($us->{$_}) : () - } - @to_load - ]; + sort { $a->display_name cmp $b->display_name } + grep { $_->statusvis =~ /[VML]/ && $_->is_individual } + map { $us->{$_} ? ($us->{$_}) : () } + @to_load + ]; } @@ -206,19 +197,11 @@ sub _member_of { my $us = LJ::load_userids(@to_load); return $fom->{_member_of_us} = [ - sort { - $a->display_name cmp $b->display_name - } - grep { - $_->{statusvis} eq 'V' && - ($_->{journaltype} eq "C" || - $_->{journaltype} eq "S") - } - map { - $us->{$_} ? ($us->{$_}) : () - } + sort { $a->display_name cmp $b->display_name } + grep { $_->is_visible && $_->is_community } + map { $us->{$_} ? ($us->{$_}) : () } @to_load - ]; + ]; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Portal/Box/Friends.pm --- a/cgi-bin/LJ/Portal/Box/Friends.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Portal/Box/Friends.pm Thu Jul 30 11:38:40 2009 -0500 @@ -54,12 +54,12 @@ sub generate_content { my $displaying; if ($friends_u) { - grep { $friendcount++ if $friends_u->{$_}->{'journaltype'} eq 'P'; } keys %$friends_u; + grep { $friendcount++ if $friends_u->{$_}->is_person; } keys %$friends_u; my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp $friends_u->{$b}->{'user'} } keys %$friends_u; foreach my $fid (@sortedfriends) { my $fu = $friends_u->{$fid}; - next if $fu->{'journaltype'} ne 'P'; + next unless $fu->is_person; unless ($foundfriends < $maxshow) { chop $friendlist; @@ -110,13 +110,13 @@ sub generate_content { if ($showcomm) { if ($friends_u) { - grep { $commcount++ if $friends_u->{$_}->{'journaltype'} eq 'C'; } keys %$friends_u; + grep { $commcount++ if $friends_u->{$_}->is_community; } keys %$friends_u; my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp $friends_u->{$b}->{'user'} } keys %$friends_u; foreach my $fid (@sortedfriends) { my $fu = $friends_u->{$fid}; - next if $fu->{'journaltype'} ne 'C'; + next unless $fu->is_community; my $journallink = $fu->journal_base(); $commlist .= "<a href=\"$journallink\">$fu->{user}</a>, "; @@ -144,13 +144,13 @@ sub generate_content { if ($showsyn) { if ($friends_u) { - grep { $syncount++ if $friends_u->{$_}->{'journaltype'} eq 'Y'; } keys %$friends_u; + grep { $syncount++ if $friends_u->{$_}->is_syndicated; } keys %$friends_u; my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp $friends_u->{$b}->{'user'} } keys %$friends_u; foreach my $fid (@sortedfriends) { my $fu = $friends_u->{$fid}; - next if $fu->{'journaltype'} ne 'Y'; + next unless $fu->is_syndicated; my $journallink = $fu->journal_base(); $synlist .= "<a href=\"$journallink\">$fu->{user}</a>, "; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Portal/Box/FriendsPage.pm --- a/cgi-bin/LJ/Portal/Box/FriendsPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Portal/Box/FriendsPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -98,7 +98,7 @@ sub generate_content { my $posteru = $entry->poster; - next if $posteru && $posteru->{statusvis} =~ /[XSD]/; + next if $posteru && $posteru->is_inactive; my $poster = $posteru->ljuser_display; my $props = $entry->props; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Portal/Box/PopWithFriends.pm --- a/cgi-bin/LJ/Portal/Box/PopWithFriends.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Portal/Box/PopWithFriends.pm Thu Jul 30 11:38:40 2009 -0500 @@ -102,10 +102,9 @@ sub generate_content { my $fofu = $fofus->{$popid}; - my $journaltype = $fofu->{journaltype}; - next if ($journaltype eq 'P' || $journaltype eq 'I') && !$showpeople; - next if $journaltype eq 'C' && !$showcoms; - next if $journaltype eq 'Y' && !$showsyn; + next if $fofu->is_individual && !$showpeople; + next if $fofu->is_community && !$showcoms; + next if $fofu->is_syndicated && !$showsyn; my $friendcount = $count{$popid}; next if $friendcount == 0; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Portal/Box/RecentComments.pm --- a/cgi-bin/LJ/Portal/Box/RecentComments.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Portal/Box/RecentComments.pm Thu Jul 30 11:38:40 2009 -0500 @@ -88,7 +88,7 @@ sub generate_content { last unless $commentcount++ < $maxshow; my $pu = $us->{$r->{posterid}}; - next if $pu && $pu->{statusvis} =~ /[XS]/; + next if $pu && ( $pu->is_suspended || $pu->is_expunged) ; my $jtalkid = $r->{'jtalkid'}; # get entry info for linking diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2.pm Thu Jul 30 11:38:40 2009 -0500 @@ -2071,7 +2071,7 @@ sub Page } # Identity (type I) accounts only have read views - $p->{'views_order'} = [ 'read', 'userinfo' ] if $u->{'journaltype'} eq 'I'; + $p->{'views_order'} = [ 'read', 'userinfo' ] if $u->is_identity; return $p; } @@ -2493,7 +2493,7 @@ sub viewer_is_friend return 0 unless defined($LJ::S2::CURR_PAGE); my $ju = $LJ::S2::CURR_PAGE->{'_u'}; - return 0 if $ju->{journaltype} eq 'C'; + return 0 if $ju->is_community; return $ju->trusts( $remote ); } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/DayPage.pm --- a/cgi-bin/LJ/S2/DayPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/DayPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -138,7 +138,7 @@ sub DayPage } # don't show posts from suspended users or suspended posts - next ENTRY if $apu{$posterid} && $apu{$posterid}->{'statusvis'} eq 'S' && ! $viewsome; + next ENTRY if $apu{$posterid} && $apu{$posterid}->is_suspended && ! $viewsome; next ENTRY if $entry_obj && $entry_obj->is_suspended_for($remote); if ($LJ::UNICODE && $logprops{$itemid}->{'unknown8bit'}) { diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/EntryPage.pm --- a/cgi-bin/LJ/S2/EntryPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/EntryPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -134,7 +134,7 @@ sub EntryPage $text =~ s{<(?!/?lj)(.*?)>} {<$1>}gi; } LJ::CleanHTML::clean_comment(\$text, { 'preformatted' => $com->{'props'}->{'opt_preformatted'}, - 'anon_comment' => (!$pu || $pu->{'journaltype'} eq 'I'), + 'anon_comment' => (!$pu || $pu->is_identity), }); # local time in mysql format to gmtime @@ -254,7 +254,7 @@ sub EntryPage # don't show info from suspended users # FIXME: ideally the load_comments should only return these # items if there are children, otherwise they should be hidden entirely - if ($pu && $pu->{'statusvis'} eq "S" && !$viewsome) { + if ($pu && $pu->is_suspended && !$viewsome) { $s2com->{'text'} = ""; $s2com->{'subject'} = ""; $s2com->{'full'} = 0; @@ -427,7 +427,7 @@ sub EntryPage_entry } } - if (($pu && $pu->{'statusvis'} eq 'S') && !$viewsome) { + if ( $pu && $pu->is_suspended && ! $viewsome ) { $opts->{'suspendeduser'} = 1; return; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/FriendsPage.pm --- a/cgi-bin/LJ/S2/FriendsPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/FriendsPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -246,7 +246,7 @@ sub FriendsPage my $po = $posters{$posterid} || $friends{$posterid}; # don't allow posts from suspended users or suspended posts - if ($po->{'statusvis'} eq 'S' || ($entry_obj && $entry_obj->is_suspended_for($remote))) { + if ($po->is_suspended || ($entry_obj && $entry_obj->is_suspended_for($remote))) { $hiddenentries++; # Remember how many we've skipped for later next ENTRY; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/MonthPage.pm --- a/cgi-bin/LJ/S2/MonthPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/MonthPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -122,7 +122,7 @@ sub MonthPage # don't show posts from suspended users or suspended posts next unless $pu{$posterid}; - next ENTRY if $pu{$posterid}->{'statusvis'} eq 'S' && !$viewsome; + next ENTRY if $pu{$posterid}->is_suspended && !$viewsome; next ENTRY if $entry_obj && $entry_obj->is_suspended_for($remote); if ($LJ::UNICODE && $logprops{$itemid}->{'unknown8bit'}) { diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/RecentPage.pm --- a/cgi-bin/LJ/S2/RecentPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/RecentPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -97,8 +97,7 @@ sub RecentPage security => $opts->{securityfilter}, itemids => \@itemids, dateformat => 'S2', - order => ( $u->{journaltype} eq 'C' || $u->{journaltype} eq 'Y' ) # community or syndicated - ? 'logtime' : '', + order => ( $u->is_community || $u->is_syndicated ) ? 'logtime' : '', err => \$err, ); @@ -153,7 +152,7 @@ sub RecentPage $itemnum++; # don't show posts from suspended users or suspended posts unless the user doing the viewing says to (and is allowed) - next ENTRY if $apu{$posterid} && $apu{$posterid}->{'statusvis'} eq 'S' && !$viewsome; + next ENTRY if $apu{$posterid} && $apu{$posterid}->is_suspended && !$viewsome; next ENTRY if $entry_obj && $entry_obj->is_suspended_for($remote); if ($LJ::UNICODE && $logprops{$itemid}->{'unknown8bit'}) { diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/S2/ReplyPage.pm --- a/cgi-bin/LJ/S2/ReplyPage.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/S2/ReplyPage.pm Thu Jul 30 11:38:40 2009 -0500 @@ -159,7 +159,7 @@ sub ReplyPage my $comment_userpic; if ($parpost->{'posterid'}) { $pu = LJ::load_userid($parpost->{'posterid'}); - return $opts->{handler_return} = 403 if $pu->{statusvis} eq 'S'; # do not show comments by suspended users + return $opts->{handler_return} = 403 if $pu->is_suspended; # do not show comments by suspended users $s2poster = UserLite($pu); my $pickw = LJ::Entry->userpic_kw_from_props($parpost->{'props'}); @@ -169,7 +169,7 @@ sub ReplyPage LJ::CleanHTML::clean_comment(\$parpost->{'body'}, { 'preformatted' => $parpost->{'props'}->{'opt_preformatted'}, - 'anon_comment' => !$parpost->{posterid} || $pu->{'journaltype'} eq 'I', + 'anon_comment' => !$parpost->{posterid} || $pu->is_identity, }); diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/Session.pm --- a/cgi-bin/LJ/Session.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/Session.pm Thu Jul 30 11:38:40 2009 -0500 @@ -604,7 +604,7 @@ sub session_from_master_cookie { } # locked accounts can't be logged in - if ($u->{statusvis} eq 'L') { + if ( $u->is_locked ) { $err->("User account is locked."); next COOKIE; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/SixDegrees.pm --- a/cgi-bin/LJ/SixDegrees.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/SixDegrees.pm Thu Jul 30 11:38:40 2009 -0500 @@ -11,7 +11,7 @@ sub find_path { my ($fu, $tu, $timeout) = @_; return () unless $fu && $tu; - return () unless $fu->{journaltype} eq "P" && $tu->{journaltype} eq "P"; + return () unless $fu->is_individual && $tu->is_individual; $LJ::SixDegrees::MEMC_EXPIRE ||= 86400; @@ -178,7 +178,7 @@ sub link_fetch my @clean_list; # visible users, not communities foreach my $uid (@$listref) { my $u = $cache->{$uid}; - next unless $u && $u->{'statusvis'} eq "V" && $u->{'journaltype'} eq "P"; + next unless $u && $u->is_visible && $u->is_individual; push @clean_list, $uid; } diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/LJ/User.pm Thu Jul 30 11:38:40 2009 -0500 @@ -405,6 +405,10 @@ sub is_expunged { return $u->statusvis eq 'X' || $u->clusterid == 0; } +sub is_inactive { + my $u = shift; + return $u->statusvis eq 'D' || $u->statusvis eq 'X' || $u->statusvis eq 'S'; +} sub is_locked { my $u = shift; @@ -662,6 +666,12 @@ sub is_person { return $u->{journaltype} eq "P"; } *is_personal = \&is_person; + + +sub is_redirect { + my $u = shift; + return $u->{journaltype} eq "R"; +} sub is_syndicated { diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/ljfeed.pl --- a/cgi-bin/ljfeed.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/ljfeed.pl Thu Jul 30 11:38:40 2009 -0500 @@ -62,7 +62,7 @@ sub make_feed # for syndicated accounts, redirect to the syndication URL # However, we only want to do this if the data we're returning # is similar. (Not FOAF, for example) - if ($u->{'journaltype'} eq 'Y') { + if ( $u->is_syndicated ) { my $synurl = $dbr->selectrow_array("SELECT synurl FROM syndicated WHERE userid=$u->{'userid'}"); unless ($synurl) { return 'No syndication URL available.'; @@ -175,7 +175,7 @@ sub make_feed my $ditemid = $itemid*256 + $it->{'anum'}; my $entry_obj = LJ::Entry->new($u, ditemid => $ditemid); - next ENTRY if $posteru{$it->{'posterid'}} && $posteru{$it->{'posterid'}}->{'statusvis'} eq 'S'; + next ENTRY if $posteru{$it->{'posterid'}} && $posteru{$it->{'posterid'}}->is_suspended; next ENTRY if $entry_obj && $entry_obj->is_suspended_for($remote); if ($LJ::UNICODE && $logprops{$itemid}->{'unknown8bit'}) { @@ -589,12 +589,12 @@ sub create_view_atom # create a FOAF page for a user sub create_view_foaf { my ($journalinfo, $u, $opts) = @_; - my $comm = ($u->{journaltype} eq 'C'); + my $comm = $u->is_community; my $ret; # return nothing if we're not a user - unless ($u->{journaltype} eq 'P' || $comm) { + unless ( $u->is_person || $comm ) { $opts->{handler_return} = 404; return undef; } @@ -713,12 +713,12 @@ sub create_view_foaf { } # user schools - if ($u->{'journaltype'} ne 'Y' && + if (!$u->is_syndicated && LJ::is_enabled('schools') && ($u->{'opt_showschools'} eq '' || $u->{'opt_showschools'} eq 'Y')) { my $schools = LJ::Schools::get_attended($u); - if ($u->{'journaltype'} ne 'C' && $schools && %$schools ) { + if ( ! $u->is_community && $schools && %$schools ) { my @links; foreach my $sid (sort { $schools->{$a}->{year_start} <=> $schools->{$b}->{year_start} } keys %$schools) { my $link = "$LJ::SITEROOT/schools/" . @@ -777,7 +777,7 @@ sub create_view_foaf { foreach my $trustid ( @ids ) { next if $trustid == $u->id; my $fu = $users->{$trustid}; - next if $fu->{statusvis} =~ /[DXS]/ || $fu->{journaltype} ne 'P'; + next if $fu->is_inactive || ! $fu->is_person; my $name = LJ::exml($fu->name_raw); my $tagline = LJ::exml($fu->prop('journaltitle') || ''); @@ -805,7 +805,7 @@ sub create_view_foaf { # YADIS capability discovery sub create_view_yadis { my ($journalinfo, $u, $opts) = @_; - my $person = ($u->{journaltype} eq 'P'); + my $person = $u->is_person; my $ret = ""; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/ljprotocol.pl Thu Jul 30 11:38:40 2009 -0500 @@ -462,7 +462,7 @@ sub sendmessage return undef unless authenticate($req, $err, $flags); my $u = $flags->{'u'}; - return fail($err, 305) if $u->statusvis eq 'S'; # suspended cannot send private messages + return fail($err, 305) if $u->is_suspended; # suspended cannot send private messages my $msg_limit = LJ::get_cap($u, "usermessage_length"); @@ -541,7 +541,7 @@ sub login if $ver>=1 and not $LJ::UNICODE; # do not let locked people log in - return fail($err, 308) if $u->{statusvis} eq 'L'; + return fail($err, 308) if $u->is_locked; ## return a message to the client to be displayed (optional) login_message($req, $res, $flags); @@ -925,7 +925,7 @@ sub common_event_validation # only people should have unknown8bit entries. my $uowner = $flags->{u_owner} || $flags->{u}; return fail($err,207,'Posting in a community with international or special characters require a Unicode-capable LiveJournal client. Download one at http://www.livejournal.com/download/.') - if $uowner->{journaltype} ne 'P'; + if ! $uowner->is_person; # so rest of site can change chars to ? marks until # default user's encoding is set. (legacy support) @@ -1019,17 +1019,16 @@ sub postevent return fail($err,200) unless $req->{'event'} =~ /\S/; ### make sure community or identity journals don't post - return fail($err,150) if ($u->{'journaltype'} eq "C" || - $u->{'journaltype'} eq "I"); + return fail($err,150) if $u->is_community || $u->is_identity; # suspended users can't post - return fail($err,305) if ($u->{'statusvis'} eq "S"); + return fail($err,305) if $u->is_suspended; # memorials can't post - return fail($err,309) if $u->{statusvis} eq 'M'; + return fail($err,309) if $u->is_memorial; # locked accounts can't post - return fail($err,308) if $u->{statusvis} eq 'L'; + return fail($err,308) if $u->is_locked; # check the journal's read-only bit return fail($err,306) if LJ::get_cap($uowner, "readonly"); @@ -1047,7 +1046,7 @@ sub postevent return fail($err,317) if $uowner->is_readonly; # can't post to deleted/suspended community - return fail($err,307) unless $uowner->{'statusvis'} eq "V"; + return fail($err,307) unless $uowner->is_visible; # must have a validated email address to post to a community # unless this is approved from the mod queue (we'll error out initially, but in case they change later) @@ -1117,7 +1116,7 @@ sub postevent } # are they trying to post back in time? - if ($posterid == $ownerid && $u->{'journaltype'} ne 'Y' && + if ($posterid == $ownerid && !$u->is_syndicated && !$time_was_faked && $u->{'newesteventtime'} && $eventtime lt $u->{'newesteventtime'} && !$req->{'props'}->{'opt_backdated'}) { @@ -1162,7 +1161,7 @@ sub postevent # don't allow backdated posts in communities return fail($err,152) if ($req->{'props'}->{"opt_backdated"} && - $uowner->{'journaltype'} ne "P"); + ! $uowner->is_person); # do processing of embedded polls (doesn't add to database, just # does validity checking) @@ -1171,7 +1170,7 @@ sub postevent { return fail($err,301,"Your account type doesn't permit creating polls.") unless (LJ::get_cap($u, "makepoll") - || ($uowner->{'journaltype'} eq "C" + || ($uowner->is_community && LJ::get_cap($uowner, "makepoll"))); my $error = ""; @@ -1239,7 +1238,7 @@ sub postevent }; # if posting to a moderated community, store and bail out here - if ($uowner->{'journaltype'} eq 'C' && $uowner->{'moderated'} && !$flags->{'nomod'}) { + if ($uowner->is_community && $uowner->{'moderated'} && !$flags->{'nomod'}) { # don't moderate admins, moderators & pre-approved users my $dbh = LJ::get_db_writer(); my $relcount = $dbh->selectrow_array("SELECT COUNT(*) FROM reluser ". @@ -1346,7 +1345,7 @@ sub postevent $getlock->(); return $res if $res_done; # do rate-checking - if ($u->{'journaltype'} ne "Y" && ! LJ::rate_log($u, "post", 1)) { + if ( ! $u->is_syndicated && ! LJ::rate_log($u, "post", 1) ) { return $fail->($err,405); } @@ -1586,7 +1585,7 @@ sub editevent return fail($err,306) if LJ::get_cap($uowner, "readonly"); # can't edit in deleted/suspended community - return fail($err,307) unless $uowner->{'statusvis'} eq "V" || $uowner->is_readonly; + return fail($err,307) unless $uowner->is_visible || $uowner->is_readonly; my $dbcm = LJ::get_cluster_master($uowner); return fail($err,306) unless $dbcm; @@ -1699,7 +1698,7 @@ sub editevent # don't allow backdated posts in communities return fail($err,152) if ($req->{'props'}->{"opt_backdated"} && - $uowner->{'journaltype'} ne "P"); + ! $uowner->is_person); # make year/mon/day/hour/min optional in an edit event, # and just inherit their old values @@ -1926,7 +1925,7 @@ sub getevents return fail($err,502) unless $dbcr && $dbr; # can't pull events from deleted/suspended journal - return fail($err,307) unless $uowner->{'statusvis'} eq "V" || $uowner->is_readonly; + return fail($err,307) unless $uowner->is_visible || $uowner->is_readonly; my $reject_code = $LJ::DISABLE_PROTOCOL{getevents}; if (ref $reject_code eq "CODE") { @@ -1937,7 +1936,7 @@ sub getevents # if this is on, we sort things different (logtime vs. posttime) # to avoid timezone issues - my $is_community = ($uowner->{journaltype} eq "C"); + my $is_community = $uowner->is_community; # in some cases we'll use the master, to ensure there's no # replication delay. useful cases: getting one item, use master @@ -2290,7 +2289,7 @@ sub sessiongenerate { }; # do not let locked people do this - return fail($err, 308) if $u->{statusvis} eq 'L'; + return fail($err, 308) if $u->is_locked; my $sess = LJ::Session->create($u, %$sess_opts); @@ -2337,7 +2336,7 @@ sub list_friends grep { $us->{$_->[0]} } @frow) { my $u = $us->{$f->[0]}; - next if $opts->{'friendof'} && $u->{'statusvis'} ne 'V'; + next if $opts->{'friendof'} && ! $u->is_visible; my $r = { 'username' => $u->{'user'}, @@ -2373,13 +2372,13 @@ sub list_friends 'C' => 'community', 'Y' => 'syndicated', 'I' => 'identity', - }->{$u->{'journaltype'}} if $u->{'journaltype'} ne 'P'; + }->{$u->journaltype} unless $u->is_person; $r->{"status"} = { 'D' => "deleted", 'S' => "suspended", 'X' => "purged", - }->{$u->{'statusvis'}} if $u->{'statusvis'} ne 'V'; + }->{$u->statusvis} unless $u->is_visible; push @$res, $r; # won't happen for zero limit (which means no limit) @@ -2709,7 +2708,7 @@ sub authenticate } return fail( $err, 100 ) unless $u; - return fail( $err, 100 ) if $u->{statusvis} eq 'X'; + return fail( $err, 100 ) if $u->is_expunged; return fail( $err, 505 ) unless $u->{clusterid}; my $r = DW::Request->get; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/supportlib.pl --- a/cgi-bin/supportlib.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/supportlib.pl Thu Jul 30 11:38:40 2009 -0500 @@ -221,7 +221,7 @@ sub can_append my ($sp, $remote, $auth) = @_; if (is_poster($sp, $remote, $auth)) { return 1; } return 0 unless $remote; - return 0 unless $remote->{'statusvis'} eq "V"; + return 0 unless $remote->is_visible; if ($sp->{_cat}->{'allow_screened'}) { return 1; } if (can_help($sp, $remote)) { return 1; } return 0; diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/taglib.pl --- a/cgi-bin/taglib.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/taglib.pl Thu Jul 30 11:38:40 2009 -0500 @@ -461,7 +461,7 @@ sub can_add_tags { my $u = LJ::want_user(shift); my $remote = LJ::want_user(shift); return undef unless $u && $remote; - return undef unless $remote->{journaltype} eq 'P'; + return undef unless $remote->is_person; return undef if LJ::is_banned($remote, $u); # get permission hashref and check it; note that we fall back to the control @@ -486,7 +486,7 @@ sub can_control_tags { my $u = LJ::want_user(shift); my $remote = LJ::want_user(shift); return undef unless $u && $remote; - return undef unless $remote->{journaltype} eq 'P'; + return undef unless $remote->is_person; return undef if LJ::is_banned($remote, $u); # get permission hashref and check it @@ -545,10 +545,10 @@ sub get_permission_levels { # return defaults for accounts unless ($u->{opt_tagpermissions}) { - if ($u->{journaltype} eq 'C') { + if ( $u->is_community ) { # communities are members (friends) add, private (maintainers) control return { add => 'friends', control => 'private' }; - } elsif ($u->{journaltype} eq 'P') { + } elsif ( $u->is_person ) { # people let friends add, self control return { add => 'private', control => 'private' }; } else { diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/talklib.pl --- a/cgi-bin/talklib.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/talklib.pl Thu Jul 30 11:38:40 2009 -0500 @@ -1211,7 +1211,7 @@ sub talkform { # make sure journal isn't locked return "Sorry, this journal is locked and comments cannot be posted to it or edited at this time." - if $journalu->{statusvis} eq 'L'; + if $journalu->is_locked; # check max comments only if posting a new comment (not when editing) unless ($editid) { @@ -2844,7 +2844,7 @@ sub init { return $bmlerr->('talk.error.nojournal') unless $journalu; return $err->($LJ::MSG_READONLY_USER) if LJ::get_cap($journalu, "readonly"); - return $err->("Account is locked, unable to post or edit a comment.") if $journalu->{statusvis} eq 'L'; + return $err->("Account is locked, unable to post or edit a comment.") if $journalu->is_locked; my $r = BML::get_request(); $r->notes->{journalid} = $journalu->{'userid'} @@ -2941,8 +2941,7 @@ sub init { $bmlerr->("$SC.error.noopenid"); } - unless ($up->{'journaltype'} eq "P" || - ($up->{'journaltype'} eq "I" && $cookie_auth)) { + unless ( $up->is_person || ( $up->is_identity && $cookie_auth ) ) { $bmlerr->("$SC.error.postshared"); } @@ -3124,7 +3123,7 @@ sub init { $init->{parpost} = $parpost; # don't allow anonymous comments on syndicated items - if ($journalu->{'journaltype'} eq "Y" && $journalu->{'opt_whocanreply'} eq "all") { + if ( $journalu->is_syndicated && $journalu->{'opt_whocanreply'} eq "all" ) { $journalu->{'opt_whocanreply'} = "reg"; } @@ -3139,16 +3138,13 @@ sub init { } if ($up) { - if ($up->{'status'} eq "N" && $up->{'journaltype'} ne "I" && !LJ::run_hook("journal_allows_unvalidated_commenting", $journalu)) { + if ($up->{'status'} eq "N" && !$up->is_identity && !LJ::run_hook("journal_allows_unvalidated_commenting", $journalu)) { $err->(BML::ml("$SC.error.noverify2", {'aopts' => "href='$LJ::SITEROOT/register.bml'"})); } - if ($up->{'statusvis'} eq "D") { - $bmlerr->("$SC.error.deleted"); - } elsif ($up->{'statusvis'} eq "S") { - $bmlerr->("$SC.error.suspended"); - } elsif ($up->{'statusvis'} eq "X") { - $bmlerr->("$SC.error.purged"); - } + + $bmlerr->("$SC.error.purged") if $up->is_expunged; + $bmlerr->("$SC.error.deleted") if $up->is_deleted; + $bmlerr->("$SC.error.suspended") if $up->is_suspended; } if ($journalu->{'opt_whocanreply'} eq "friends") { @@ -3590,7 +3586,7 @@ sub check_rate { return 1 unless @LJ::MEMCACHE_SERVERS; # return right away if the account is suspended - return 0 if $remote && $remote->{'statusvis'} =~ /[SD]/; + return 0 if $remote && ( $remote->is_suspended || $remote->is_deleted ); # allow some users to be very aggressive commenters and authors. i.e. our bots. return 1 if $remote diff -r 17d6af7ec9b3 -r b31a63fd1737 cgi-bin/weblib.pl --- a/cgi-bin/weblib.pl Thu Jul 30 09:32:00 2009 -0500 +++ b/cgi-bin/weblib.pl Thu Jul 30 11:38:40 2009 -0500 @@ -3643,12 +3643,11 @@ sub statusvis_message_js { return "" unless $u; - my $statusvis = $u->statusvis; - return "" unless $statusvis =~ /^[LMO]$/; + return "" unless $u->is_locked || $u->is_memorial || $u->is_readonly; - my $statusvis_full = "locked" if $statusvis eq "L"; - $statusvis_full = "memorial" if $statusvis eq "M"; - $statusvis_full = "readonly" if $statusvis eq "O"; + my $statusvis_full = "locked" if $u->is_locked; + $statusvis_full = "memorial" if $u->is_memorial; + $statusvis_full = "readonly" if $u->is_readonly; LJ::need_res("js/statusvis_message.js"); return "<script>Site.StatusvisMessage=\"" . LJ::Lang::ml("statusvis_message.$statusvis_full") . "\";</script>"; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/accountstatus.bml --- a/htdocs/accountstatus.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/accountstatus.bml Thu Jul 30 11:38:40 2009 -0500 @@ -49,7 +49,7 @@ body<= # invalid statusvis return LJ::bad_input($ML{'.error.invalid'}) - unless $statusvis eq 'D' || $statusvis eq 'V'; + unless $u->is_deleted || $u->is_visible; # no need to change? return $ok->(BML::ml('.message.nochange', {'statusvis' => $statusvis{$statusvis} })) @@ -62,7 +62,7 @@ body<= my @date = localtime(time); my $date = sprintf("%02d:%02d %02d/%02d/%04d", @date[2,1], $date[3], $date[4]+1, $date[5]+1900); - if ($statusvis eq 'D') { + if ( $u->is_deleted ) { $res = $u->set_deleted; @@ -76,7 +76,7 @@ body<= datetime => $date, })->fire; } - } elsif ($statusvis eq 'V') { + } elsif ( $u->is_visible ) { ## Restore previous statusvis of journal. It may be different ## from 'V', it may be read-only, or locked, or whatever. my @previous_status = grep { $_ ne 'D' } $u->get_previous_statusvis; @@ -110,7 +110,7 @@ body<= # success $ret .= $ok->(BML::ml('.message.success', {'statusvis' => $statusvis{$statusvis} })); - if ($statusvis eq 'D') { + if ( $u->is_deleted ) { $ret .= "<?p $ML{'.message.deleted'} p?>"; if ( $u->is_person ) { diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/admin/userlog.bml --- a/htdocs/admin/userlog.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/admin/userlog.bml Thu Jul 30 11:38:40 2009 -0500 @@ -51,7 +51,7 @@ FORM unless $u; return $err->("User is deleted and purged.") - if $u->statusvis eq "X"; + if $u->is_expunged; my $dbcr = LJ::get_cluster_reader($u); return $err->("Unable to get user cluster reader.") diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/allpics.bml --- a/htdocs/allpics.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/allpics.bml Thu Jul 30 11:38:40 2009 -0500 @@ -80,7 +80,7 @@ } # redirect renamed users - if ($u->{'journaltype'} eq "R") { + if ( $u->is_redirect ) { LJ::load_user_props($u, "renamedto"); return BML::redirect("$LJ::SITEROOT/allpics.bml?user=$u->{'renamedto'}") if $u->{'renamedto'}; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/birthdays.bml --- a/htdocs/birthdays.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/birthdays.bml Thu Jul 30 11:38:40 2009 -0500 @@ -17,7 +17,7 @@ body<= return BML::ml('.error.invaliduser', { user => LJ::ehtml($GET{user}) }) unless $u; return BML::ml('.error.badstatus', { user => LJ::ljuser($u->{user}) }) - if $u->{statusvis} ne 'V'; + unless $u->is_visible; } my $body; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/join.bml --- a/htdocs/community/join.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/join.bml Thu Jul 30 11:38:40 2009 -0500 @@ -15,7 +15,7 @@ body<= # bad statusvis? return "<?h1 $ML{'.error.statusvis.title'} h1?><?p $ML{'.error.statusvis.body'} p?>" - unless $remote->{statusvis} eq 'V'; + unless $remote->is_visible; # make sure a community doesn't join a community return "<?h1 $ML{'Error'} h1?><?p $ML{'.label.commlogged'} p?>" diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/leave.bml --- a/htdocs/community/leave.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/leave.bml Thu Jul 30 11:38:40 2009 -0500 @@ -26,7 +26,7 @@ # error check return $error->($ML{'.label.infoerror'}) - unless $cu && $cu->{journaltype} =~ /[CS]/; + unless $cu && $cu->is_community; # used in both paths below my $ecname = LJ::ehtml($cu->{'name'}); diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/manage.bml --- a/htdocs/community/manage.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/manage.bml Thu Jul 30 11:38:40 2009 -0500 @@ -20,7 +20,7 @@ body<= } return "<?h1 $ML{'Error'} h1?><?p $ML{'.error.badaccounttype'} p?>" - unless $remote->{journaltype} eq 'P'; + unless $remote->is_person; $ret .= "<?p $ML{'.commlist.text'} p?>"; $ret .= "<div style='margin: 15px 0'>"; @@ -49,7 +49,7 @@ body<= $sth->execute; while (my ($uid, $membership) = $sth->fetchrow_array) { my $cu = $us->{$uid}; - next unless $cu && $cu->{statusvis} eq "V" || $cu->is_readonly; + next unless $cu && ( $cu->is_visible || $cu->is_readonly ); $names{$uid} = [ $cu->{user}, $cu->{name}, -1 ]; if ($mods{$uid}) { $modcount{$uid} = $names{$uid}[2] = LJ::get_mod_queue_count( $uid ); diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/members.bml --- a/htdocs/community/members.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/members.bml Thu Jul 30 11:38:40 2009 -0500 @@ -104,7 +104,7 @@ body<= my $target_disp = LJ::ljuser($target); - unless ($target->{statusvis} eq 'V') { + unless ( $target->is_visible ) { push @add_errors, BML::ml( '.error.notactive', { user => $target_disp } ); next; @@ -118,7 +118,7 @@ body<= next; } - unless ($target->{'journaltype'} eq 'P') { + unless ( $target->is_person ) { push @add_errors, BML::ml( '.error.invaliduser', { user => $target_disp, type => $target->{'journaltype'} } ); diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/sentinvites.bml --- a/htdocs/community/sentinvites.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/sentinvites.bml Thu Jul 30 11:38:40 2009 -0500 @@ -40,7 +40,7 @@ body<= } # make sure it is a comm - unless ($c->{'journaltype'} eq 'C') { + unless ( $c->is_community ) { $ret .= "<?h1 $ML{'Error'} h1?><?p "; $ret .= BML::ml('.error.notcomm', { 'user' => LJ::ljuser($c) }); $ret .= " p?>"; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/settings.bml --- a/htdocs/community/settings.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/settings.bml Thu Jul 30 11:38:40 2009 -0500 @@ -41,7 +41,7 @@ body<= return $ret; } - unless ($remote->{'journaltype'} eq 'P') { + unless ( $remote->is_person ) { $ret .= "<?h1 $ML{'Error'} h1?><?p $ML{'.error.maintainertype'} p?>"; return $ret; } @@ -92,7 +92,7 @@ body<= } # if it's already a community, don't let them turn it into a community - if ($mode eq 'create' && !%errors && $cu->{journaltype} eq 'C') { + if ( $mode eq 'create' && !%errors && $cu->is_community ) { $errors{'username'} = $ML{'.error.alreadycomm'}; } @@ -206,7 +206,7 @@ body<= return BML::redirect("$LJ::SITEROOT/community/manage.bml"); } - unless ($c->{'journaltype'} eq 'C') { + unless ( $c->is_community ) { $ret .= "<?h1 $ML{'Error'} h1?><?p $ML{'.error.notcomm'} p?>"; return $ret; } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/community/transfer.bml --- a/htdocs/community/transfer.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/community/transfer.bml Thu Jul 30 11:38:40 2009 -0500 @@ -10,7 +10,7 @@ return "<?needlogin?>" unless $remote; # bad statusvis? - unless ($remote->{statusvis} eq 'V') { + unless ( $remote->is_visible ) { $body = "<?h1 $ML{'.badstatus.title'} h1?><?p $ML{'.badstatus.body'} p?>"; return; } @@ -25,8 +25,8 @@ # the rest of the errors assume a community exists if ($cu) { # status/type errors - $errors{username} = $ML{'.error.notcomm'} unless $cu->{journaltype} eq 'C'; - $errors{username} = $ML{'.error.badstatus'} if !%errors && $cu->{statusvis} !~ /[VD]/; + $errors{username} = $ML{'.error.notcomm'} unless $cu->is_community; + $errors{username} = $ML{'.error.badstatus'} unless %errors || $cu->is_visible || $cu->is_deleted; # are they already a maintainer? $errors{username} = $ML{'.error.alreadyadmin'} if !%errors && LJ::can_manage($remote, $cu); diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/delcomment.bml --- a/htdocs/delcomment.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/delcomment.bml Thu Jul 30 11:38:40 2009 -0500 @@ -48,7 +48,7 @@ _info?><?_code # can't delete if you're suspended return $bad_input->($ML{'.error.suspended'}) - if $remote->{statusvis} eq 'S'; + if $remote->is_suspended; return $error->($LJ::MSG_READONLY_USER) if LJ::get_cap($u, "readonly"); @@ -84,7 +84,7 @@ _info?><?_code # can $remote delete this comment? unless (LJ::Talk::can_delete($remote, $u, $jposter, $tp->{'userpost'})) { - my $err = $u->{'journaltype'} eq 'C' ? $ML{'.error.cantdelete.comm'} : $ML{'.error.cantdelete'}; + my $err = $u->is_community ? $ML{'.error.cantdelete.comm'} : $ML{'.error.cantdelete'}; return $error->($err); } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/editjournal.bml --- a/htdocs/editjournal.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/editjournal.bml Thu Jul 30 11:38:40 2009 -0500 @@ -29,7 +29,7 @@ body<= return LJ::bad_input( $ML{'error.invalidauth'} ) unless $u; return LJ::bad_input( $ML{'error.person'} ) - unless $u->{'journaltype'} eq 'P'; + unless $u->is_person; # are we modify a community post? my $usejournal = $GET{'usejournal'} || $POST{'usejournal'} || $GET{'journal'}; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/edittags.bml --- a/htdocs/edittags.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/edittags.bml Thu Jul 30 11:38:40 2009 -0500 @@ -23,7 +23,7 @@ body<= my $u = LJ::load_user($journal); return $err->($ML{'.invalid.journal'}) unless $u; return $err->($ML{'.readonly.journal'}) if $u->is_readonly; - return $err->($ML{'.invalid.journal'}) unless $u->{statusvis} eq 'V'; + return $err->($ML{'.invalid.journal'}) unless $u->is_visible; my $ditemid = ($GET{itemid} || $POST{itemid})+0; my $anum = $ditemid % 256; @@ -42,7 +42,7 @@ body<= unless ($remote->can_manage($u) && !$pu->is_suspended) { return $err->($ML{'.readonly.poster'}) if $pu->is_readonly; - return $err->($ML{'.invalid.journal'}) if $pu->{statusvis} ne 'V'; + return $err->($ML{'.invalid.journal'}) unless $pu->is_visible; } } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/inbox/compose.bml --- a/htdocs/inbox/compose.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/inbox/compose.bml Thu Jul 30 11:38:40 2009 -0500 @@ -36,7 +36,7 @@ body<= my @errors; - push @errors, $ML{'.suspended.cannot.send'} if $remote->statusvis eq 'S'; + push @errors, $ML{'.suspended.cannot.send'} if $remote->is_suspended; # Submitted message if (LJ::did_post()) { diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/interests.bml --- a/htdocs/interests.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/interests.bml Thu Jul 30 11:38:40 2009 -0500 @@ -28,7 +28,7 @@ body<= my $maxinterests = $remote ? $remote->get_cap( 'interests' ) : 0; - my $table = sub { $_[0]->{'journaltype'} eq 'C' ? 'comminterests' : 'userinterests' }; + my $table = sub { $_[0]->is_community ? 'comminterests' : 'userinterests' }; if (!$did_post && $GET{'view'} eq "popular") { return $ML{'.popular.disabled'} unless LJ::is_enabled('interests-popular'); @@ -120,7 +120,7 @@ body<= } # if a community, remove any old rows from userinterests - if ($remote->{'journaltype'} eq 'C') { + if ( $remote->is_community ) { $dbh->do("DELETE FROM userinterests WHERE userid=?", undef, $remote->{'userid'}); } @@ -340,7 +340,7 @@ body<= } # if a community, remove any old rows from userinterests - if ($u->{'journaltype'} eq 'C') { + if ( $u->is_community ) { my $dbh = LJ::get_db_writer(); $dbh->do("DELETE FROM userinterests WHERE userid=?", undef, $u->{'userid'}); } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/login.bml --- a/htdocs/login.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/login.bml Thu Jul 30 11:38:40 2009 -0500 @@ -283,7 +283,7 @@ } else { push @errors, [ purged_user => "$ML{'error.purged.text'}" ] if $u->is_expunged; push @errors, [ community_disabled_login => "$ML{'error.nocommlogin'}" ] - if $u->{'journaltype'} eq 'C' && ! LJ::is_enabled('community-logins'); + if $u->is_community && ! LJ::is_enabled('community-logins'); } if (LJ::get_cap($u, "readonly")) { @@ -319,7 +319,7 @@ } push @errors, [ account_locked => 'This account is locked and cannot be logged in to at this time.' ] - if $u->{statusvis} eq 'L'; + if $u->is_locked; if (@errors) { $login_html->(); diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/lostinfo.bml --- a/htdocs/lostinfo.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/lostinfo.bml Thu Jul 30 11:38:40 2009 -0500 @@ -105,11 +105,11 @@ body<= return "<?h1 $title h1?>\n<?p $msg p?>"; }; - if ($u->{'journaltype'} eq 'Y') { + if ( $u->is_syndicated ) { return $err->( $ML{'.error.syndicated'} ); } - if ($u->{'journaltype'} eq 'C' && !length $u->password) { + if ( $u->is_community && ! length $u->password ) { # community with no password return $err->( $ML{'.error.commnopassword'} ); } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/manage/circle/add.bml --- a/htdocs/manage/circle/add.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/manage/circle/add.bml Thu Jul 30 11:38:40 2009 -0500 @@ -120,16 +120,16 @@ my $icon = $u->large_journal_icon; if ( $u->is_visible ) { # was this a syndicated add? - if ($u->{journaltype} eq 'Y') { + if ( $u->is_syndicated ) { $windowtitle = BML::ml('.confirm.syn.title1'.$add, {'user'=> $user }); $title = BML::ml('.confirm.syn.title1'.$add, {'icon'=> $icon, 'user'=> $user }); $body .= "<?p $ML{'.confirm.text1.feed'} p?>"; # Is this account redirected? - } elsif ($u->{'journaltype'} eq "R" && $u->prop('renamedto')) { + } elsif ( $u->is_redirect && $u->prop('renamedto') ) { return BML::redirect("$LJ::SITEROOT/manage/circle/add.bml?user=" . $u->prop('renamedto')); - } elsif ($u->{'journaltype'} eq "C") { + } elsif ( $u->is_community ) { $windowtitle = BML::ml('.confirm.title.community'.$add, {'user'=> $user }); $title = BML::ml('.confirm.title.community'.$add, {'icon'=> $icon, 'user'=> $user }); unless ( $remote->member_of( $u ) ) { @@ -140,7 +140,7 @@ } } } else { - if ($u->{'journaltype'} eq "I") { + if ( $u->is_identity ) { $windowtitle = BML::ml('.confirm.title.person'.$add, {'user'=> $u->display_name }); $title = BML::ml('.confirm.title.person'.$add, {'icon'=> $icon, 'user'=> $u->display_name }); } else { @@ -439,7 +439,7 @@ $ret .= "</div>\n"; - if ($u->{'journaltype'} eq "C") { + if ( $u->is_community ) { $body .= "<br />$ML{'.disclaimer'}"; } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/manage/index.bml --- a/htdocs/manage/index.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/manage/index.bml Thu Jul 30 11:38:40 2009 -0500 @@ -111,7 +111,7 @@ list<= <?_code my $u = $BMLCodeBlock::u; - return '' if $u->{'journaltype'} eq 'I'; + return '' if $u->is_identity; return '<li><a href="/changepassword.bml" title="<?_ml .information.changepass.about _ml?>"><?_ml .information.changepass _ml?></a></li>'; _code?> @@ -122,7 +122,7 @@ _code?> <?_code my $u = $BMLCodeBlock::u; - return '' if $u->{'journaltype'} eq 'I'; + return '' if $u->is_identity; return '<li><a href="./emailpost.bml" title="<?_ml .information.mobilepost.about _ml?>"><?_ml .information.mobilepost _ml?></a></li>'; _code?> @@ -186,7 +186,7 @@ list<= list<= <?_code my $u = $BMLCodeBlock::u; - return '' if $u->{'journaltype'} eq 'I'; + return '' if $u->is_identity; return '<li><a href="/editjournal.bml" title="<?_ml .entries.edit.about _ml?>"><?_ml /editjournal.bml.title _ml?></a></li>'; _code?> @@ -195,7 +195,7 @@ _code?> <?_code my $u = $BMLCodeBlock::u; - return '' if $u->{'journaltype'} eq 'I'; + return '' if $u->is_identity; return '' unless LJ::is_enabled('tags'); my $authas = $BMLCodeBlock::authas; return qq(<li><a href="/manage/tags.bml$authas" title="<?_ml .entries.tags.about _ml?>"><?_ml /manage/tags.bml.title2 _ml?></a></li>); @@ -233,7 +233,7 @@ block?> <?_code my $u = $BMLCodeBlock::u; - return '' if $u->{'journaltype'} eq 'I'; + return '' if $u->is_identity; return qq( <?block diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/mobile/index.bml --- a/htdocs/mobile/index.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/mobile/index.bml Thu Jul 30 11:38:40 2009 -0500 @@ -25,7 +25,7 @@ $ret .= "<li>" . BML::ml( ".options.logged_in", { aopts => "href='login'" } ); $ret .= $u->display_name . "</li>"; $ret .= "<li>" . BML::ml( ".options.post", { aopts => "href='post'", sitename => $LJ::SITENAMESHORT } ). "</li>" - unless $u->{'journaltype'} eq 'I'; + unless $u->is_identity; $ret .= "<li>" . BML::ml( ".options.readingpage", { aopts => "href='read'" } ) . "</li>"; } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/multisearch.bml --- a/htdocs/multisearch.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/multisearch.bml Thu Jul 30 11:38:40 2009 -0500 @@ -39,7 +39,7 @@ # presumably users will start registering usernames that match our site navigation tags, # so let's preempt that and throw them into a lame bottom section when site-defined tags # are alse present. - $last_is_untrusted = 1 if $u->{statusvis} eq "V"; + $last_is_untrusted = 1 if $u->is_visible; } } @@ -81,7 +81,7 @@ } else { $link = "<a href=\"" . LJ::ehtml($dst->url) . "\">" . LJ::ehtml($dst->title) . "</a>"; } - if (!$lju || ($lju && $lju->{statusvis} eq "V")) { + if ( ! $lju || $lju->is_visible ) { $body .= "<li>$link</li>\n"; } } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/register.bml --- a/htdocs/register.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/register.bml Thu Jul 30 11:38:40 2009 -0500 @@ -85,8 +85,8 @@ body<= BML::ml('.error.emailchanged', { aopts => "href='$LJ::SITEROOT/register.bml'" }) . " p?>"; } - ## if the user is OpenID, prove that he is human - if ($u->{journaltype} eq 'I' && LJ::is_enabled("recaptcha")) { + ## if the user is OpenID, prove that he or she is human + if ( $u->is_identity && LJ::is_enabled("recaptcha") ) { require Captcha::reCAPTCHA; my $c = Captcha::reCAPTCHA->new; if ($POST{recaptcha_response_field}) { diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/support/see_request.bml --- a/htdocs/support/see_request.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/support/see_request.bml Thu Jul 30 11:38:40 2009 -0500 @@ -876,7 +876,7 @@ body<= my $validationnag; if (!(LJ::isu($u) && ($u->{'status'} eq 'T')) && ($u->{'status'} eq "N" || $u->{'status'} eq "T") && - $u->{'journaltype'} ne 'I' && ! $is_poster) { + ! $u->is_identity && ! $is_poster) { my $reminder = LJ::load_include('validationreminder'); $validationnag .= "\n\n$reminder" if $reminder; } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/talkpost.bml --- a/htdocs/talkpost.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/talkpost.bml Thu Jul 30 11:38:40 2009 -0500 @@ -57,7 +57,7 @@ body<= return $LJ::MSG_READONLY_USER if $LJ::CLUSTER_DOWN{0} || ! $dbcr; # redirect if account was renamed - if ($u->{'journaltype'} eq "R") { + if ( $u->is_redirect ) { LJ::load_user_props($u, "renamedto"); if ($u->{'renamedto'} ne "") { my $id = $FORM{'itemid'}+0; @@ -185,7 +185,7 @@ body<= if $parpost->{'state'} eq "F"; # don't allow anonymous comments on syndicated items - if ($u->{'journaltype'} eq "Y" && $u->{'opt_whocanreply'} eq "all") { + if ( $u->is_syndicated && $u->{'opt_whocanreply'} eq "all" ) { $u->{'opt_whocanreply'} = "reg"; } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/talkread.bml --- a/htdocs/talkread.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/talkread.bml Thu Jul 30 11:38:40 2009 -0500 @@ -80,7 +80,7 @@ body<= } # redirect if account was renamed - if ($u->{'journaltype'} eq "R") { + if ( $u->is_redirect ) { LJ::load_user_props($u, "renamedto"); if ($u->{'renamedto'} ne "") { return BML::redirect(LJ::journal_base($u->{'renamedto'}) . "/$ditemid.html"); @@ -670,7 +670,7 @@ body<= $ret .= "</td></tr><tr><td class='commentbody usercontent'>"; LJ::CleanHTML::clean_comment(\$post->{'body'}, { 'preformatted' => $post->{'props'}->{'opt_preformatted'}, - 'anon_comment' => (!$pu || $pu->{'journaltype'} eq 'I'), + 'anon_comment' => ( !$pu || $pu->is_identity ), }); BML::ebml(\$post->{'body'}); my $event = $post->{'body'}; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/tools/memadd.bml --- a/htdocs/tools/memadd.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/tools/memadd.bml Thu Jul 30 11:38:40 2009 -0500 @@ -38,7 +38,7 @@ 'friends' => $ML{'label.security.friends'}, 'private' => $ML{'label.security.private'}, ); - if ($memoryu->{'journaltype'} eq "C") { + if ( $memoryu->is_community ) { $secopts{'private'} = $ML{'label.security.maintainers'}; $secopts{'friends'} = $ML{'label.security.members'}; } @@ -253,7 +253,7 @@ $body .= "<tr><th align='right' valign='top'>$ML{'.security'}</th><td>"; $body .= LJ::html_select({name => 'security', selected => defined $memory ? $memory->{'security'} : undef}, map { ($_, $secopts{$_}) } qw(public friends private)); - if ($memoryu->{'journaltype'} eq "C") { + if ( $memoryu->is_community ) { $body .= "<br /><small>$ML{'.whocansee.comm'}</small></td></tr><tr><th></th><td>\n"; } else { $body .= "<br /><small>$ML{'.whocansee'}</small></td></tr><tr><th></th><td>\n"; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/tools/memories.bml --- a/htdocs/tools/memories.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/tools/memories.bml Thu Jul 30 11:38:40 2009 -0500 @@ -76,7 +76,7 @@ my $userid = $u->{'userid'}; - if ($u->{'journaltype'} eq "R") { + if ( $u->is_redirect ) { LJ::load_user_props($u, "renamedto"); return BML::redirect("/tools/memories.bml?user=$u->{'renamedto'}$authasarg"); } @@ -164,7 +164,7 @@ if ($authasu) { if ($is_owner) { $securities = []; - } elsif ($authasu->{'journaltype'} eq 'P' && $u->trusts_or_has_member( $authasu )) { + } elsif ( $authasu->is_person && $u->trusts_or_has_member( $authasu ) ) { $securities = ['public', 'friends']; } } diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/tools/recent_comments.bml --- a/htdocs/tools/recent_comments.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/tools/recent_comments.bml Thu Jul 30 11:38:40 2009 -0500 @@ -43,7 +43,7 @@ body<= my (@recv, @posted, %talkids); my %need_userid; - $need_userid{$u->{userid}} = 1 if $u->{'journaltype'} eq 'C'; # Need to load the community for logtext + $need_userid{$u->{userid}} = 1 if $u->is_community; # Need to load the community for logtext my %logrow; # "jid nodeid" -> $logrow my %need_logids; # hash of "journalid jitemid" => [journalid, jitemid] @@ -133,7 +133,7 @@ body<= next if $r->{state} eq "D"; my $pu = $us->{$r->{posterid}}; - next if $pu->{statusvis} =~ /[XS]/; + next if $pu->is_expunged || $pu->is_suspended; $r->{'props'} = $props{$r->{'jtalkid'}}; diff -r 17d6af7ec9b3 -r b31a63fd1737 htdocs/view/index.bml --- a/htdocs/view/index.bml Thu Jul 30 09:32:00 2009 -0500 +++ b/htdocs/view/index.bml Thu Jul 30 11:38:40 2009 -0500 @@ -44,7 +44,7 @@ return; } - if ($u->{'journaltype'} eq "R") { + if ( $u->is_redirect ) { LJ::load_user_props($u, "renamedto"); if ($u->{'renamedto'}) { return BML::redirect(sprintf(LJ::journal_base($u->{'renamedto'}) . "/%04d/%02d/", $FORM{'y'}, $FORM{'m'})); @@ -94,7 +94,7 @@ if ($remote) { if ($remote->{'userid'} == $u->{'userid'} || $viewall) { $secwhere = ""; # see everything - } elsif ($remote->{'journaltype'} eq 'P') { + } elsif ( $remote->is_person ) { my $gmask = $u->trustmask( $remote ); $secwhere = "AND (l.security='public' OR (l.security='usemask' AND l.allowmask & $gmask))" if $gmask; @@ -113,7 +113,7 @@ $title = $monlang; $title .= ", $year - $u->{'user'}"; - my $is_person = $u->{'journaltype'} eq "P"; + my $is_person = $u->is_person; if ($is_person) { $body .= "<?h1 Month View h1?><?p Here are the subjects of all posts by user " . LJ::ljuser($u->{'user'}) . " in $monlang, $year. p?>"; } else { --------------------------------------------------------------------------------