mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: don't let blocked users reach post creator or new post queue
correct broken spec
This commit is contained in:
@ -88,6 +88,15 @@ class PostsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
||||||
|
if !is_api? && current_user.blocked?
|
||||||
|
|
||||||
|
# error has parity with what user would get if they posted when blocked
|
||||||
|
# and it went through post creator
|
||||||
|
render json: {errors: [I18n.t("topic_not_found")]}, status: 422
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
@manager_params = create_params
|
@manager_params = create_params
|
||||||
@manager_params[:first_post_checks] = !is_api?
|
@manager_params[:first_post_checks] = !is_api?
|
||||||
|
|
||||||
|
@ -484,6 +484,8 @@ describe PostsController do
|
|||||||
it 'queues the post if min_first_post_typing_time is not met' do
|
it 'queues the post if min_first_post_typing_time is not met' do
|
||||||
|
|
||||||
SiteSetting.min_first_post_typing_time = 3000
|
SiteSetting.min_first_post_typing_time = 3000
|
||||||
|
# our logged on user here is tl1
|
||||||
|
SiteSetting.auto_block_fast_typers_max_trust_level = 1
|
||||||
|
|
||||||
xhr :post, :create, {raw: 'this is the test content', title: 'this is the test title for the topic'}
|
xhr :post, :create, {raw: 'this is the test content', title: 'this is the test title for the topic'}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user