def _update_service_announcement(text, is_published):
    ToolSetting.upsert('SERVICE_ANNOUNCEMENT_TEXT', text)
    ToolSetting.upsert('SERVICE_ANNOUNCEMENT_IS_PUBLISHED', is_published)
    return {
        'text': text,
        'isPublished': is_published,
    }
Пример #2
0
def update_service_announcement():
    params = request.get_json()
    text = process_input_from_rich_text_editor(params.get('text', ''))
    if not text and _is_service_announcement_published():
        raise BadRequestError('If the service announcement is published then API requires \'text\'')
    ToolSetting.upsert('SERVICE_ANNOUNCEMENT_TEXT', text)
    return tolerant_jsonify(_get_service_announcement())
Пример #3
0
def publish_service_announcement():
    publish = to_bool_or_none(request.get_json().get('publish'))
    if publish is None:
        raise BadRequestError('API requires \'publish\' arg')
    ToolSetting.upsert('SERVICE_ANNOUNCEMENT_IS_PUBLISHED', publish)
    return tolerant_jsonify(_get_service_announcement())