Exemple #1
0
def chats_view(chat_id):
    if not _member_of(current_user.id, chat_id):
        abort(403)
    chat = Chat.get(chat_id)
    if not chat:
        return redirect(url_for('chats_all'))
    return render_template("chats/view.html",
                           chat=chat,
                           messages=Message.find_all_in_chat(chat_id),
                           form=MessageForm())
Exemple #2
0
def chats_get_messages():
    chat_id = request.args.get('chat_id', 0, type=int)
    if not _member_of(current_user.id, chat_id):
        abort(403)
    return jsonify(messages=render_template(
        'messages/messages.html', messages=Message.find_all_in_chat(chat_id)))