##// END OF EJS Templates
Make status an error if the user is banned in api_add_post
neko259 -
r638:e9babb2a default
parent child Browse files
Show More
@@ -77,13 +77,15 b' def api_add_post(request, opening_post_i'
77 error_class=PlainErrorList)
77 error_class=PlainErrorList)
78 form.session = request.session
78 form.session = request.session
79
79
80 #if form.need_to_ban:
80 if form.need_to_ban:
81 # # Ban user because he is suspected to be a bot
81 # Ban user because he is suspected to be a bot
82 # _ban_current_user(request)
82 # _ban_current_user(request)
83 # status = STATUS_ERROR
83 status = STATUS_ERROR
84 if form.is_valid():
84 if form.is_valid():
85 ThreadView().new_post(request, form, opening_post,
85 result = ThreadView().new_post(request, form, opening_post,
86 html_response=False)
86 html_response=False)
87 if not result:
88 status = STATUS_ERROR
87 else:
89 else:
88 status = STATUS_ERROR
90 status = STATUS_ERROR
89 errors = form.as_json_errors()
91 errors = form.as_json_errors()
@@ -95,7 +95,7 b' class ThreadView(BaseBoardView, PostMixi'
95 if html_response:
95 if html_response:
96 return redirect(BannedView().as_view())
96 return redirect(BannedView().as_view())
97 else:
97 else:
98 return
98 return False
99
99
100 data = form.cleaned_data
100 data = form.cleaned_data
101
101
@@ -125,3 +125,5 b' class ThreadView(BaseBoardView, PostMixi'
125 return redirect(reverse(
125 return redirect(reverse(
126 'thread',
126 'thread',
127 kwargs={'post_id': thread_to_show}) + '#' + str(post.id))
127 kwargs={'post_id': thread_to_show}) + '#' + str(post.id))
128 else:
129 return True
General Comments 0
You need to be logged in to leave comments. Login now