fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-31 02:03 pm

[dw-free] Revamp /update

[commit: http://hg.dwscoalition.org/dw-free/rev/fbe67ebe89f3]

http://bugs.dwscoalition.org/show_bug.cgi?id=2524

Fix link to poll, and making creating a new poll work.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/Controller/Entry.pm
  • htdocs/poll/create.bml
  • views/entry.tt
--------------------------------------------------------------------------------
diff -r 160282d42b25 -r fbe67ebe89f3 cgi-bin/DW/Controller/Entry.pm
--- a/cgi-bin/DW/Controller/Entry.pm	Mon Oct 31 21:45:41 2011 +0800
+++ b/cgi-bin/DW/Controller/Entry.pm	Mon Oct 31 22:03:41 2011 +0800
@@ -93,7 +93,8 @@
                 $spellcheck{results} = $spellchecker->check_html( \$event, 1 );
                 $spellcheck{did_spellcheck} = 1;
             }
-        } elsif ( $okay_formauth ) {
+        } elsif ( $okay_formauth && ! $post->{showform} # some other form posted content to us, which the user will want to edit further
+        ) {
             my $flags = {};
 
             my %auth = _auth( $flags, $post, $remote );
diff -r 160282d42b25 -r fbe67ebe89f3 htdocs/poll/create.bml
--- a/htdocs/poll/create.bml	Mon Oct 31 21:45:41 2011 +0800
+++ b/htdocs/poll/create.bml	Mon Oct 31 22:03:41 2011 +0800
@@ -760,7 +760,9 @@
 
         # submit button / form
         my $usejournal = $getextra ? "?usejournal=$authas" : '';
-        $ret .= "<form method='post' action='$LJ::SITEROOT/update$usejournal' style='display: inline'>\n";
+        my $update_url = LJ::BetaFeatures->user_in_beta( $remote => "updatepage" )
+            ? "$LJ::SITEROOT/entry/new" : "$LJ::SITEROOT/update";
+        $ret .= "<form method='post' action='$update_url$usejournal' style='display: inline'>\n";
         $ret .= LJ::form_auth();
         $ret .= LJ::html_hidden('event', $code) . "\n";
         $ret .= LJ::html_submit('showform', undef, { 'raw' => "value='$ML{'.button.postpoll'} &rarr;'" }) . "\n";
diff -r 160282d42b25 -r fbe67ebe89f3 views/entry.tt
--- a/views/entry.tt	Mon Oct 31 21:45:41 2011 +0800
+++ b/views/entry.tt	Mon Oct 31 22:03:41 2011 +0800
@@ -174,7 +174,7 @@
                 <!-- TODO make this only take up one tab area? -->
                 <div class="toolbar">
                     <div id="main-tools" class='subtoolbar'>
-                        <a href="http://www.dreamwidth.org/poll/create">Create Poll</a>
+                        <a href="[%site.root%]/poll/create">Create Poll</a>
                         [%- preview_label = 'talk.btn.preview' | ml;
                             form.submit( value = preview_label
                                          name = "action:preview"
--------------------------------------------------------------------------------