mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:23:17 -05:00
DEV: toggle_anon missing from requires_login (#37644)
The `toggle_anon` action in `UsersController` was missing from the `requires_login` filter,
This commit is contained in:
@@ -40,6 +40,7 @@ class UsersController < ApplicationController
|
||||
reset_recent_searches
|
||||
user_menu_bookmarks
|
||||
user_menu_messages
|
||||
toggle_anon
|
||||
]
|
||||
|
||||
skip_before_action :check_xhr,
|
||||
|
||||
@@ -804,6 +804,12 @@ RSpec.describe UsersController do
|
||||
end
|
||||
|
||||
describe "#toggle_anon" do
|
||||
it "requires login" do
|
||||
post "/u/toggle-anon.json"
|
||||
expect(response.status).to eq(403)
|
||||
expect(response.parsed_body["error_type"]).to eq("not_logged_in")
|
||||
end
|
||||
|
||||
it "allows you to toggle anon if enabled" do
|
||||
SiteSetting.allow_anonymous_mode = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user