[dw-free] Allow entries to be posted with non-existent userpic keywords.
[commit: http://hg.dwscoalition.org/dw-free/rev/9005f6273171]
http://bugs.dwscoalition.org/show_bug.cgi?id=757
Restore inactive userpic check, but allow importer to bypass this
restriction.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=757
Restore inactive userpic check, but allow importer to bypass this
restriction.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/Worker/ContentImporter/Local/Entries.pm
- cgi-bin/ljprotocol.pl
-------------------------------------------------------------------------------- diff -r 36c60aee341c -r 9005f6273171 cgi-bin/DW/Worker/ContentImporter/Local/Entries.pm --- a/cgi-bin/DW/Worker/ContentImporter/Local/Entries.pm Tue Apr 14 08:11:37 2009 +0000 +++ b/cgi-bin/DW/Worker/ContentImporter/Local/Entries.pm Tue Apr 14 08:15:26 2009 +0000 @@ -140,6 +140,7 @@ sub post_event { noauth => 1, nonotify => 1, ignore_tags_max => 1, + allow_inactive => 1, } ); diff -r 36c60aee341c -r 9005f6273171 cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Tue Apr 14 08:11:37 2009 +0000 +++ b/cgi-bin/ljprotocol.pl Tue Apr 14 08:15:26 2009 +0000 @@ -962,13 +962,6 @@ sub common_event_validation return fail($err,205,$pname); } - # This is a system logprop - # fail with unknown metadata here? - if ( $p->{ownership} eq 'system' ) { - $pname =~ s/[^\w]//g; - return fail($err,205,$pname); - } - # don't validate its type if it's 0 or undef (deleting) next unless ($req->{'props'}->{$pname}); @@ -984,6 +977,16 @@ sub common_event_validation if ($pname eq "current_coords" && ! eval { LJ::Location->new(coords => $val) }) { return fail($err,204,"Property \"current_coords\" has invalid value"); } + } + + # check props for inactive userpic + if ( ( my $pickwd = $req->{'props'}->{'picture_keyword'} ) and !$flags->{allow_inactive}) { + my $pic = LJ::get_pic_from_keyword($flags->{'u'}, $pickwd); + + # need to make sure they aren't trying to post with an inactive keyword, but also + # we don't want to allow them to post with a keyword that has no pic at all to prevent + # them from deleting the keyword, posting, then adding it back with editpics.bml + delete $req->{'props'}->{'picture_keyword'} if ! $pic || $pic->{'state'} eq 'I'; } # validate incoming list of tags --------------------------------------------------------------------------------