diff --git a/hc/front/tests/test_ping_details.py b/hc/front/tests/test_ping_details.py index 9d372499..539324f6 100644 --- a/hc/front/tests/test_ping_details.py +++ b/hc/front/tests/test_ping_details.py @@ -11,12 +11,12 @@ class LastPingTestCase(BaseTestCase): Ping.objects.create(owner=check, body="this is body") self.client.login(username="alice@example.org", password="password") - r = self.client.post("/checks/%s/last_ping/" % check.code) + r = self.client.get("/checks/%s/last_ping/" % check.code) self.assertContains(r, "this is body", status_code=200) def test_it_requires_user(self): check = Check.objects.create() - r = self.client.post("/checks/%s/last_ping/" % check.code) + r = self.client.get("/checks/%s/last_ping/" % check.code) self.assertEqual(r.status_code, 403) def test_it_accepts_n(self): @@ -29,8 +29,8 @@ class LastPingTestCase(BaseTestCase): self.client.login(username="alice@example.org", password="password") - r = self.client.post("/checks/%s/pings/1/" % check.code) + r = self.client.get("/checks/%s/pings/1/" % check.code) self.assertContains(r, "foo-123", status_code=200) - r = self.client.post("/checks/%s/pings/2/" % check.code) + r = self.client.get("/checks/%s/pings/2/" % check.code) self.assertContains(r, "bar-456", status_code=200) diff --git a/hc/front/views.py b/hc/front/views.py index 361079fd..54d3b261 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -275,7 +275,6 @@ def cron_preview(request): return render(request, "front/cron_preview.html", ctx) -@require_POST def ping_details(request, code, n=None): if not request.user.is_authenticated: return HttpResponseForbidden() diff --git a/static/js/checks.js b/static/js/checks.js index 6df7fa4d..719466ec 100644 --- a/static/js/checks.js +++ b/static/js/checks.js @@ -44,7 +44,6 @@ $(function () { $(".last-ping").on("click", function() { if (this.innerText == "Never") { - showUsage(this); return false; } @@ -53,14 +52,8 @@ $(function () { var code = $(this).closest("tr.checks-row").attr("id"); var lastPingUrl = "/checks/" + code + "/last_ping/"; - var token = $('input[name=csrfmiddlewaretoken]').val(); - $.ajax({ - url: lastPingUrl, - type: "post", - headers: {"X-CSRFToken": token}, - success: function(data) { - $("#ping-details-body" ).html(data); - } + $.get(lastPingUrl, function(data) { + $("#ping-details-body" ).html(data); }); var logUrl = "/checks/" + code + "/log/"; diff --git a/static/js/details.js b/static/js/details.js index 64d6bd1c..1f141dbd 100644 --- a/static/js/details.js +++ b/static/js/details.js @@ -88,15 +88,10 @@ $(function () { $("#ping-details-body").text("Updating..."); $('#ping-details-modal').modal("show"); - var token = $('input[name=csrfmiddlewaretoken]').val(); - $.ajax({ - url: this.dataset.url, - type: "post", - headers: {"X-CSRFToken": token}, - success: function(data) { - $("#ping-details-body" ).html(data); + $.get(this.dataset.url, function(data) { + $("#ping-details-body").html(data); } - }); + ); return false; }); diff --git a/static/js/log.js b/static/js/log.js index 84dd33cc..3b056d16 100644 --- a/static/js/log.js +++ b/static/js/log.js @@ -3,14 +3,8 @@ $(function () { $("#ping-details-body").text("Updating..."); $('#ping-details-modal').modal("show"); - var token = $('input[name=csrfmiddlewaretoken]').val(); - $.ajax({ - url: this.dataset.url, - type: "post", - headers: {"X-CSRFToken": token}, - success: function(data) { - $("#ping-details-body" ).html(data); - } + $.get(this.dataset.url, function(data) { + $("#ping-details-body" ).html(data); }); return false; @@ -26,7 +20,6 @@ $(function () { }) } - $("#format-switcher").click(function(ev) { var format = ev.target.getAttribute("data-format"); switchDateFormat(format); diff --git a/templates/front/log.html b/templates/front/log.html index a5029541..1f4e36d9 100644 --- a/templates/front/log.html +++ b/templates/front/log.html @@ -144,9 +144,6 @@ -
{% endblock %}