Пример #1
0
def get_group(gid):
    appid = request.appid
    uid = request.uid

    obj = Group.get_group(g._imdb, gid)
    members = Group.get_group_members(g._imdb, gid)
    for m in members:
        name = User.get_user_name(g.rds, appid, uid)
        m['name'] = name if name else ''
    obj['members'] = members

    q = User.get_user_notification_quiet(g.rds, appid, uid, gid)
    obj['quiet'] = bool(q)

    resp = {"data":obj}
    return make_response(200, resp)
Пример #2
0
def get_groups():
    appid = request.appid
    uid = request.uid

    groups = Group.get_groups(g._imdb, appid, uid)
    fields = request.args.get("fields", '')

    fields = fields.split(",")
    for obj in groups:
        gid = obj['id']
        if "members" in fields:
            members = Group.get_group_members(g._imdb, gid)
            for m in members:
                name = User.get_user_name(g.rds, appid, uid)
                m['name'] = name if name else ''
            obj['members'] = members
     
        if "quiet" in fields:
            q = User.get_user_notification_quiet(g.rds, appid, uid, gid)
            obj['quiet'] = bool(q)
        
    resp = {"data":groups}
    return make_response(200, resp)