]> git.openstreetmap.org Git - rails.git/commitdiff
Make change set comment rate limit errors display properly
authorTom Hughes <tom@compton.nu>
Thu, 2 Nov 2023 10:08:19 +0000 (10:08 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 2 Nov 2023 10:08:19 +0000 (10:08 +0000)
Fixes #4320

app/assets/javascripts/index/changeset.js
app/views/browse/changeset.html.erb
lib/osm.rb

index a6213b9c434367a9141062be608e1a2b53d49bf0..a659feef6373924d9ff0872e008c35915012fd63 100644 (file)
@@ -47,7 +47,7 @@ OSM.Changeset = function (map) {
         OSM.loadSidebarContent(window.location.pathname, page.load);
       },
       error: function (xhr, xhr_status, http_status) {
-        $(form).find("#comment-error").text(http_status);
+        $(form).find("#comment-error").text(xhr.responseText);
         $(form).find("#comment-error").prop("hidden", false);
         $(form).find("input[type=submit]").prop("disabled", false);
       }
index 93e0abf219cbae0f908edcd53b43112ed5dd6885..74596e529c6e1ed5f8926161c71fa227c4e1131a 100644 (file)
@@ -78,7 +78,7 @@
         <div class="mb-3">
           <textarea class="form-control" name="text" cols="40" rows="5"></textarea>
         </div>
-        <div id="comment-error" class="alert-danger p-2 mb-3" hidden>
+        <div id="comment-error" class="alert alert-danger p-2 mb-3" hidden>
         </div>
         <div>
           <input type="submit" name="comment" value="<%= t("javascripts.changesets.show.comment") %>" data-changeset-id="<%= @changeset.id %>" data-method="POST" data-url="<%= changeset_comment_url(@changeset) %>" disabled="1" class="btn btn-sm btn-primary" />
index 6d945c4fe871250f404af3926a1813cfa7858881..905f3ac97459e4890d5270d59f1d76ef110c5746 100644 (file)
@@ -355,6 +355,10 @@ module OSM
 
   # Raised when a rate limit is exceeded
   class APIRateLimitExceeded < APIError
+    def initialize
+      super "Rate limit exceeded"
+    end
+
     def status
       :too_many_requests
     end