users: allow anonymous users to use /profile.json.
Allow logged out users to call https://danbooru.donmai.us/profile.json. This allows getting information on default settings and limits for anonymous users. May be a breaking API change if users were using the HTTP response code from /profile.json to check if they were successfully logged in.
This commit is contained in:
@@ -57,7 +57,7 @@ class UsersController < ApplicationController
|
||||
elsif request.format.html?
|
||||
redirect_to login_path(url: profile_path)
|
||||
else
|
||||
raise ActiveRecord::RecordNotFound
|
||||
respond_with(@user, methods: @user.full_attributes, template: "users/show")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -228,9 +228,9 @@ class UsersControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_redirected_to login_path(url: "/profile")
|
||||
end
|
||||
|
||||
should "return 404 for anonymous api calls" do
|
||||
should "return success for anonymous api calls" do
|
||||
get profile_path(format: :json)
|
||||
assert_response 404
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user