Skip to content

Commit

Permalink
Make change set comment rate limit errors display properly
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Nov 2, 2023
1 parent b5995c5 commit ef4c9a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/index/changeset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/browse/changeset.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
4 changes: 4 additions & 0 deletions lib/osm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ def status

# Raised when a rate limit is exceeded
class APIRateLimitExceeded < APIError
def initialize
super "Rate limit exceeded"
end

def status
:too_many_requests
end
Expand Down

0 comments on commit ef4c9a3

Please sign in to comment.