Exemplo n.º 1
0
def report_user():
    us = User()
    user_id = request.args.get('id')
    info = json.loads(session['log'])
    ct = us.count_query('''DELETE FROM reports WHERE to_id = ? AND from_id = ?''', (user_id, info['id']))
    if ct == 0:
        us.query('''INSERT INTO reports(to_id, from_id) VALUES(?, ?)''', (user_id, info['id']))
    return jsonify(result=[])
Exemplo n.º 2
0
def block_user():
    us = User()
    user_id = request.args.get('id')
    info = json.loads(session['log'])
    res = False
    ct = us.count_query('''DELETE FROM blocks WHERE to_id = ? AND from_id = ?''', (user_id, info['id']))
    if ct == 0:
        res = True
        us.query('''INSERT INTO blocks(to_id, from_id) VALUES(?, ?)''', (user_id, info['id']))
    return jsonify(result=res)