]> git.openstreetmap.org Git - osqa.git/commitdiff
OSQA-538, fixing the IE caching issues, now we append the Nocache random number to...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 9 Apr 2011 19:29:45 +0000 (19:29 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 9 Apr 2011 19:29:45 +0000 (19:29 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@954 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/media/js/osqa.main.js
forum/views/commands.py

index 49fedda89dd8f9a23ac449b9353cb3f0f1d0a893..2de5ecf56dc70bc74b66babf28e0618f96b91b56 100644 (file)
@@ -328,19 +328,22 @@ $(function() {
     $('a.ajax-command').live('click', function(evt) {\r
         if (running) return false;\r
 \r
-        $('.context-menu-dropdown').slideUp('fast');\r
-\r
         var el = $(this);\r
 \r
+        var ajax_url = el.attr('href')\r
+        ajax_url = ajax_url + "?nocache=" + new Date().getTime()\r
+\r
+        $('.context-menu-dropdown').slideUp('fast');\r
+\r
         if (el.is('.withprompt')) {\r
-            load_prompt(evt, el, el.attr('href'));\r
+            load_prompt(evt, el, ajax_url);\r
         } else if(el.is('.confirm')) {\r
             var doptions = {\r
                 html: messages.confirm,\r
                 extra_class: 'confirm',\r
                 yes_callback: function() {\r
                     start_command();\r
-                    $.getJSON(el.attr('href'), function(data) {\r
+                    $.getJSON(ajax_url, function(data) {\r
                         process_ajax_response(data, evt);\r
                         $dialog.fadeOut('fast', function() {\r
                             $dialog.remove();\r
@@ -358,7 +361,7 @@ $(function() {
             var $dialog = show_dialog(doptions);\r
         } else {\r
             start_command();\r
-            $.getJSON(el.attr('href'), function(data) {\r
+            $.getJSON(ajax_url, function(data) {\r
                 process_ajax_response(data, evt);\r
             });\r
         }\r
index 3849ca3d82c45a374c5e806891f7efb5e5368c0d..175b6d1ec970da150e57283fde721cc7345801d3 100644 (file)
@@ -91,13 +91,11 @@ def vote_post(request, id, vote_type):
                     )
 
         old_vote.cancel(ip=request.META['REMOTE_ADDR'])
-        score_inc += (old_vote.__class__ == VoteDownAction) and 1 or -1
-
-    if old_vote.__class__ != new_vote_cls:
-        new_vote_cls(user=user, node=post, ip=request.META['REMOTE_ADDR']).save()
-        score_inc += (new_vote_cls == VoteUpAction) and 1 or -1
-    else:
+        score_inc = (old_vote.__class__ == VoteDownAction) and 1 or -1
         vote_type = "none"
+    else:
+        new_vote_cls(user=user, node=post, ip=request.META['REMOTE_ADDR']).save()
+        score_inc = (new_vote_cls == VoteUpAction) and 1 or -1
 
     response = {
     'commands': {