← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~deryck/launchpad/dont-cache-comment-resouce-541993 into lp:launchpad/devel

 

Deryck Hodge has proposed merging lp:~deryck/launchpad/dont-cache-comment-resouce-541993 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #541993 Adding comments to a bug shows [Object object] instead of comment
  https://bugs.launchpad.net/bugs/541993


This fixes bug 541993.  There's a good bit of discussion there at
the bug about how I arrived at this fix.  Basically, we want to
randomize the URL used to fetch the comment HTML when posting inline
comments in bug pages because some clients have bad XHR caching and
don't get the correct resource after the comment POST.

Existing Windmill tests should cover this change doesn't break
anything.

./bin/test -cvvt test_bug_commenting

Thanks for the review!

Cheers,
deryck
-- 
https://code.launchpad.net/~deryck/launchpad/dont-cache-comment-resouce-541993/+merge/37056
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/dont-cache-comment-resouce-541993 into lp:launchpad/devel.
=== modified file 'lib/lp/app/javascript/comment.js'
--- lib/lp/app/javascript/comment.js	2010-07-16 14:50:39 +0000
+++ lib/lp/app/javascript/comment.js	2010-09-29 20:17:47 +0000
@@ -127,7 +127,10 @@
             },
             accept: LP.client.XHTML
         };
-        this.lp_client.get(message_entry.get('self_link'), config);
+        // Randomize the URL to fake out bad XHR caching.
+        var randomness = '?' + Math.random();
+        var message_entry_url = message_entry.get('self_link') + randomness;
+        this.lp_client.get(message_entry_url, config);
     },
     /**
      * Insert the specified HTML into the page.


Follow ups