mason/pastebin/dhandler: Some small refactorings.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 6 Jul 2015 11:34:33 +0000 (12:34 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 6 Jul 2015 11:34:33 +0000 (12:34 +0100)
mason/pastebin/dhandler

index 7014dca..7f6ea24 100644 (file)
@@ -21,8 +21,8 @@
              $r->content_type("text/plain; charset=utf8");
              $m->print($old{content});
            } else {
-             $m->comp("%show", tag => $tag, %old,
-                      edit => $Odin::COOKIE{"odin-handoff.$tag"});
+             $edit = $Odin::COOKIE{"odin-handoff.$tag"};
+             $m->comp("%show", tag => $tag, edit => $edit, %old);
            }
          } else {
            if ($op eq "del") {
@@ -30,8 +30,8 @@
              set_handoff_cookie $tag, "nil", -max_age => 5;
              $m->redirect("$Odin::PASTEBIN/");
            } else {
-             my $editp = Odin::update_pastebin $tag, $edit, %props;
              set_handoff_cookie $tag, $edit;
+             my $editp = Odin::update_pastebin $tag, $edit, %props;
              if ($editp) { $m->redirect("$Odin::PASTEBIN/$tag"); }
              else { $m->comp("%edit", tag => $tag, edit => $edit, %props); }
            }