afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-07-04 04:59 am

[dw-free] crossposter: /update.bml checkboxes end up in wrong state

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

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

Remember crossposter checkbox form values when spellchecking.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/SpellCheck.pm
  • cgi-bin/weblib.pl
  • htdocs/update.bml
--------------------------------------------------------------------------------
diff -r 495e0731837f -r 7380a425b76d cgi-bin/LJ/SpellCheck.pm
--- a/cgi-bin/LJ/SpellCheck.pm	Sat Jul 04 04:32:15 2009 +0000
+++ b/cgi-bin/LJ/SpellCheck.pm	Sat Jul 04 04:40:08 2009 +0000
@@ -56,6 +56,8 @@ sub check_html {
 sub check_html {
     my $self = shift;
     my $journal = shift;
+
+    return "" unless $$journal;
 
     my $r = DW::Request->get;
     my ( $iwrite, $iread ) = $r->spawn( $self->{command}, $self->{command_args} );
diff -r 495e0731837f -r 7380a425b76d cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Sat Jul 04 04:32:15 2009 +0000
+++ b/cgi-bin/weblib.pl	Sat Jul 04 04:40:08 2009 +0000
@@ -1567,6 +1567,7 @@ MOODS
                 my $accthtml = "";
                 my $xpostbydefault = 0;
                 my $xpost_tabindex = $tabindex->();
+                my $did_spellcheck = $opts->{ spellcheck_html } ? 1 : 0;
                 if (scalar @accounts) {
                     my $xpoststring = $opts->{prop_xpost};
                     my $xpost_selected = DW::External::Account->xpost_string_to_hash($xpoststring);
@@ -1577,6 +1578,8 @@ MOODS
                         my $selected;
                         if ($opts->{mode} eq 'edit') {
                             $selected = $xpost_selected->{$acct->acctid} ? "1" : "0";
+                        } elsif ( $did_spellcheck ) {
+                            $selected = $opts->{ "prop_xpost_$acctid" };
                         } else {
                             $selected = $acct->xpostbydefault;
                         }
diff -r 495e0731837f -r 7380a425b76d htdocs/update.bml
--- a/htdocs/update.bml	Sat Jul 04 04:32:15 2009 +0000
+++ b/htdocs/update.bml	Sat Jul 04 04:40:08 2009 +0000
@@ -191,6 +191,12 @@
         $getextra .= "qotd=" . LJ::eurl($GET{qotd}) . "&" if $GET{'qotd'};
         chop $getextra;
 
+        # if crossposter values were checked, remember them
+        my %xpost_vals;
+        foreach ( grep { /^prop_xpost_/ } ( keys %POST, keys %GET ) ) {
+            $xpost_vals{ $_ } = $POST{ $_ } || $GET{ $_ };
+        }
+
         my $entry = {
             'mode' => "update",
             'auth_as_remote' => $auth_as_remote,
@@ -210,6 +216,8 @@
             'prop_qotdid' => $qid,
             'altlogin' => $GET{altlogin} ? 1 : 0,
             'prop_opt_preformatted' => $opt_preformatted ? 1 : 0,
+            
+            %xpost_vals,
         };
 
         if ($remote) {
--------------------------------------------------------------------------------