Fix messages API to not NPE
show_if does not work on a method route
This commit is contained in:
parent
f45aac063e
commit
b1c17b1a45
1 changed files with 3 additions and 1 deletions
|
@ -71,9 +71,11 @@ class GlobalUserMessages(ApiResource):
|
||||||
@nickname('createGlobalMessage')
|
@nickname('createGlobalMessage')
|
||||||
@validate_json_request('CreateMessage')
|
@validate_json_request('CreateMessage')
|
||||||
@require_scope(scopes.SUPERUSER)
|
@require_scope(scopes.SUPERUSER)
|
||||||
@show_if(features.SUPER_USERS)
|
|
||||||
def post(self):
|
def post(self):
|
||||||
""" Create a message """
|
""" Create a message """
|
||||||
|
if not features.SUPER_USERS:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
if SuperUserPermission().can():
|
if SuperUserPermission().can():
|
||||||
model.message.create([request.get_json()['message']])
|
model.message.create([request.get_json()['message']])
|
||||||
return make_response('', 201)
|
return make_response('', 201)
|
||||||
|
|
Reference in a new issue