mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-03-26 02:38 pm

[dw-free] draft saving does not include subject or metadata

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

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

Fix some issues with draft metadata and not escaping things.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/tools/endpoints/draft.bml
  • htdocs/update.bml
--------------------------------------------------------------------------------
diff -r 4656f7e79ae4 -r 6acc1456cefe htdocs/tools/endpoints/draft.bml
--- a/htdocs/tools/endpoints/draft.bml	Fri Mar 26 01:13:03 2010 +0000
+++ b/htdocs/tools/endpoints/draft.bml	Fri Mar 26 14:38:49 2010 +0000
@@ -39,7 +39,8 @@ _c?>
     # This property thaws the contents of the userprop 'draft_properties' and
     # sends them back as a JS object.
     if ( defined $GET{getProperties} ) {
-        my $rv = Storable::thaw( $u->prop( 'draft_properties' ) || '' );
+        my $rv = $u->prop( 'draft_properties' ) ? Storable::thaw( $u->prop(
+'draft_properties' ) ) : {};
 
         BML::set_content_type('text/javascript; charset=utf-8');
         BML::finish();
diff -r 4656f7e79ae4 -r 6acc1456cefe htdocs/update.bml
--- a/htdocs/update.bml	Fri Mar 26 01:13:03 2010 +0000
+++ b/htdocs/update.bml	Fri Mar 26 14:38:49 2010 +0000
@@ -576,11 +576,13 @@ head<=
         $draft = LJ::ejs_string($remote->prop('entry_draft'));
         %draft_properties = $remote->prop( 'draft_properties' ) ? 
             %{Storable::thaw( $remote->prop( 'draft_properties' ) )} : ' ';
+        %draft_properties = map { $_ => LJ::ejs_string( $draft_properties{$_} ) }
+            qw( subject userpic taglist moodid mood location1 music adultreason commentset commentscr adultcnt );
     }
 
     my $eMLautosave = LJ::ejs(BML::ml('.draft.autosave', { 'time' => '[[time]]' }));
     my $eMLconfirm = LJ::ejs( BML::ml( '.draft.confirm2', 
-                { 'subjectline' => LJ::ejs_string( $draft_properties{subject} ) } ) );
+                { 'subjectline' => $draft_properties{subject}} ) );
     my $eMLrestored = LJ::ejs($ML{'.draft.restored'});
 
     # Setup draft saving and try to restore from a draft
@@ -610,17 +612,17 @@ head<=
         
         // These JS variables contain the contents of the various draft fields.
         var restoredDraft       = $draft;
-        var restoredSubject     = '$draft_properties{subject}';
-        var restoredUserpic     = '$draft_properties{userpic}';
-        var restoredTaglist     = '$draft_properties{taglist}';
-        var restoredMoodID      = '$draft_properties{moodid}';
-        var restoredMood        = '$draft_properties{mood}';
-        var restoredLocation    = '$draft_properties{location1}';
-        var restoredMusic       = '$draft_properties{music}';
-        var restoredAdultReason = '$draft_properties{adultreason}';
-        var restoredCommentSet  = '$draft_properties{commentset}';
-        var restoredCommentScr  = '$draft_properties{commentscr}';
-        var restoredAdultCnt    = '$draft_properties{adultcnt}';
+        var restoredSubject     = $draft_properties{subject};
+        var restoredUserpic     = $draft_properties{userpic};
+        var restoredTaglist     = $draft_properties{taglist};
+        var restoredMoodID      = $draft_properties{moodid};
+        var restoredMood        = $draft_properties{mood};
+        var restoredLocation    = $draft_properties{location1};
+        var restoredMusic       = $draft_properties{music};
+        var restoredAdultReason = $draft_properties{adultreason};
+        var restoredCommentSet  = $draft_properties{commentset};
+        var restoredCommentScr  = $draft_properties{commentscr};
+        var restoredAdultCnt    = $draft_properties{adultcnt};
 
         function init_update_bml() {
             $initDraft
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org