Example #1
0
def leave(env, game_ownership):
    if game_ownership:
        delete = get_or_none(
            env.api.game_ownerships.delete, token=flask_login.current_user.token, game_ownership_id=game_ownership.id)
        if delete and delete.success:
            Flash.success("Successfully leaved game")
    else:
        Flash.error("Unable to leave game")
Example #2
0
 def before_app_request():
     me = flask_login.current_user
     if me.is_authenticated():
         models = get_or_none(env.api.notifications.get, user_id=me.id, token=me.token, limit=0)
         count = models.unread_count if models is not None else 0
     else:
         count = 0
     flask.g.unread_notifications_count = count
Example #3
0
 def before_request():
     if 'static' not in flask.request.url:
         flask.g.games = get_or_none(env.api.games.get) or []