Fix messages API to not NPE

show_if does not work on a method route
This commit is contained in:
Joseph Schorr 2016-10-17 17:43:12 -04:00
parent f45aac063e
commit b1c17b1a45

View file

@ -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)