[dw-nonfree] suggestions generator needs to check for valid post before posting admin entry
[commit: http://hg.dwscoalition.org/dw-nonfree/rev/fb214aa59453]
http://bugs.dwscoalition.org/show_bug.cgi?id=4134
Only post the admin entry if the first entry was postetd.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4134
Only post the admin entry if the first entry was postetd.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/site/suggest.bml
-------------------------------------------------------------------------------- diff -r d8d2ef8cf17a -r fb214aa59453 htdocs/site/suggest.bml --- a/htdocs/site/suggest.bml Fri Dec 23 20:11:20 2011 +0800 +++ b/htdocs/site/suggest.bml Fri Dec 23 23:57:54 2011 +0800 @@ -101,55 +101,57 @@ 'nopassword' => 1, } ); + if ( $journalpost ) { - # having built the post for public display, we now do - # a second post containing the link to create the new bug - # for the suggestion. we can't use $suggestion that we built, - # because we need to use a different escaping function, but - # that's okay, because we want to format this a little - # differently anyway. The Bugzilla template is going to need - # some messing with at the time of posting, but I'd rather do - # that manually at the time of posting than try to fuss with it - # here. - - my ( $bugzilla_subject, $bugzilla_desc, $bugzilla_post ); - - $bugzilla_subject = LJ::eurl( $POST{title} ); - - $bugzilla_desc .= "Summary%3A%0D%0A%0D%0A"; - $bugzilla_desc .= LJ::eurl( $POST{summary} ); - $bugzilla_desc .= "%0D%0A%0D%0ADescription%3A%0D%0A%0D%0A"; - $bugzilla_desc .= LJ::eurl( $POST{description} ); - $bugzilla_desc .= "%0D%0A%0D%0ASuggested by%3A%0D%0A%0D%0A"; - $bugzilla_desc .= LJ::eurl( $remote->user ); - - $bugzilla_post .= "To post this entry to Bugzilla, use this link and change any of the fields as appropriate:<br /><br /> <a href='"; - - # oh my god bugzilla makes ugly URLs: - $bugzilla_post .= "http://bugs.dwscoalition.org/enter_bug.cgi?assigned_to=&blocked=&bug_file_loc=http%3A%2F%2F&bug_severity=enhancement&bug_status=NEW&comment=" . $bugzilla_desc . "&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&dependson=&description=&flag_type-1=X&flag_type-10=X&flag_type-11=X&flag_type-2=X&flag_type-3=X&flag_type-5=X&flag_type-7=X&form_name=enter_bug&keywords=&op_sys=All&priority=P-&product=Dreamwidth%20Development&qa_contact=&rep_platform=All&short_desc=" . $bugzilla_subject . "&target_milestone=-undecided-&version=1.0"; - - $bugzilla_post .= "'>Post '$POST{title}' to Bugzilla</a>.<br /><br />Once you do, retag both this entry and the public entry it belongs with."; - - # and we post that post to the community. (the suggestions_bot - # account should have unmoderated posting ability, so that the - # post is posted directly to the comm without having to go - # through moderation.) for this post, we tag it as - # "admin: unmigrated", so the suggestions maintainer can find - # any/all unposted bugzilla links. - - my $bugzillapost = LJ::Protocol::do_request( 'postevent', { - 'ver' => $LJ::PROTOCOL_VER, - 'username' => $suggestions_bot->user, - 'subject' => $POST{title}, - 'event' => $bugzilla_post, - 'usejournal' => $destination->user, - 'security' => 'private', - 'usejournal_okay' => 1, - 'props' => { 'taglist' => 'admin: unmigrated' }, - 'tz' => 'guess', - }, \$response2, { - 'nopassword' => 1, - } ); + # having built the post for public display, we now do + # a second post containing the link to create the new bug + # for the suggestion. we can't use $suggestion that we built, + # because we need to use a different escaping function, but + # that's okay, because we want to format this a little + # differently anyway. The Bugzilla template is going to need + # some messing with at the time of posting, but I'd rather do + # that manually at the time of posting than try to fuss with it + # here. + + my ( $bugzilla_subject, $bugzilla_desc, $bugzilla_post ); + + $bugzilla_subject = LJ::eurl( $POST{title} ); + + $bugzilla_desc .= "Summary%3A%0D%0A%0D%0A"; + $bugzilla_desc .= LJ::eurl( $POST{summary} ); + $bugzilla_desc .= "%0D%0A%0D%0ADescription%3A%0D%0A%0D%0A"; + $bugzilla_desc .= LJ::eurl( $POST{description} ); + $bugzilla_desc .= "%0D%0A%0D%0ASuggested by%3A%0D%0A%0D%0A"; + $bugzilla_desc .= LJ::eurl( $remote->user ); + + $bugzilla_post .= "To post this entry to Bugzilla, use this link and change any of the fields as appropriate:<br /><br /> <a href='"; + + # oh my god bugzilla makes ugly URLs: + $bugzilla_post .= "http://bugs.dwscoalition.org/enter_bug.cgi?assigned_to=&blocked=&bug_file_loc=http%3A%2F%2F&bug_severity=enhancement&bug_status=NEW&comment=" . $bugzilla_desc . "&contenttypeentry=&contenttypemethod=autodetect&contenttypeselection=text%2Fplain&data=&dependson=&description=&flag_type-1=X&flag_type-10=X&flag_type-11=X&flag_type-2=X&flag_type-3=X&flag_type-5=X&flag_type-7=X&form_name=enter_bug&keywords=&op_sys=All&priority=P-&product=Dreamwidth%20Development&qa_contact=&rep_platform=All&short_desc=" . $bugzilla_subject . "&target_milestone=-undecided-&version=1.0"; + + $bugzilla_post .= "'>Post '$POST{title}' to Bugzilla</a>.<br /><br />Once you do, retag both this entry and the public entry it belongs with."; + + # and we post that post to the community. (the suggestions_bot + # account should have unmoderated posting ability, so that the + # post is posted directly to the comm without having to go + # through moderation.) for this post, we tag it as + # "admin: unmigrated", so the suggestions maintainer can find + # any/all unposted bugzilla links. + + my $bugzillapost = LJ::Protocol::do_request( 'postevent', { + 'ver' => $LJ::PROTOCOL_VER, + 'username' => $suggestions_bot->user, + 'subject' => $POST{title}, + 'event' => $bugzilla_post, + 'usejournal' => $destination->user, + 'security' => 'private', + 'usejournal_okay' => 1, + 'props' => { 'taglist' => 'admin: unmigrated' }, + 'tz' => 'guess', + }, \$response2, { + 'nopassword' => 1, + } ); + } # once all of that's done, let's tell the user it worked. (or, # if it didn't work, tell them why.) --------------------------------------------------------------------------------
no subject
no subject