Exemple #1
0
def rts_user_connection():
    user = g.user

    if user:
        realtime.unread_message_count(user)
        realtime.unread_notification_count(user)

    return jsonify({})
def rts_user_connection():
    user = g.user

    if user:
        realtime.unread_message_count(user)
        realtime.unread_notification_count(user)

    return jsonify({})
def notification_notify_task(notification_id, send_email):
    notification = Notification.query.get(notification_id)

    user = notification.user
    player = notification.player

    if user:
        realtime.unread_notification_count(user)

        if send_email:
            email.send_notification_email(user, notification)

    if notification.can_notify_ingame and player:
        api.new_notification(player, notification)
def notification_notify_task(notification_id, send_email):
    notification = Notification.query.get(notification_id)

    user = notification.user
    player = notification.player

    if user:
        realtime.unread_notification_count(user)

        if send_email:
            email.send_notification_email(user, notification)

    if notification.can_notify_ingame and player:
        api.new_notification(player, notification)
def read_notification_all():
    user = g.user

    Notification.query.filter_by(
        user=user,
        seen_at=None
    ).update({
        'seen_at': datetime.utcnow()
    })

    db.session.commit()

    realtime.unread_notification_count(user)

    return redirect(url_for('notifications'))
def read_notification(notification_id):
    user = g.user

    notification = Notification.query.get(notification_id)
    if not notification:
        abort(404)

    if notification.user != user:
        abort(403)

    notification.seen_at = datetime.utcnow()
    notification.save(commit=True)

    realtime.unread_notification_count(user)

    return jsonify({
        'err': 0
    })