Make change set comment rate limit errors display properly

Fixes #4320
This commit is contained in:
Tom Hughes 2023-11-02 10:08:19 +00:00
parent b5995c5175
commit ef4c9a3306
3 changed files with 6 additions and 2 deletions

View 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);
}

View 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" />

View 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