Esempio n. 1
0
def user_showdashboard(request):
    more = False
    try:
        ttaguser = {'data': request.logged_in_user}
    except:
        ttaguser = ttagServiceByAccessToken(request)
    hubs = ttagGetHubsByOwnerId(ttaguser['data']['_id'],
                                request.COOKIES['access_token'])
    if hubs['result'] == 'OK' and 'data' in hubs and 'hubs' in hubs['data']:
        ttaguser['hubs'] = hubs['data']['hubs']
        if ttaguser['data']['user_state'] == 'HUB':
            ttaguser['data']['email'] = mark_safe(
                '<a href="' +
                reverse('hub-signout',
                        args=('id/', ttaguser['data']['state_ref'])) +
                '">Post as ' + ttaguser['data']['full_name'] + '</a>')
            ttaguser['data']['full_name'] = [
                hub['hub_name'] for hub in ttaguser['hubs']
                if hub['_id'] == ttaguser['data']['state_ref']
            ][0]
            ttaguser['data']['avatar_url'] = [
                hub['hub_icon'] for hub in ttaguser['hubs']
                if hub['_id'] == ttaguser['data']['state_ref']
            ][0]
    return {
        'response': ttaguser,
        'S3TATIC_URL': S3TATIC_URL,
        'ROOT_HOST': hosts.ROOT_HOST,
        'request': request,
        'more': more
    }
Esempio n. 2
0
def user_showfollowers(request):
    ttaguser = ttagServiceByAccessToken(request)
    followers = ttagRequestFollowers(ttaguser['data']['_id'])
    return {
        'response': followers,
        'S3TATIC_URL': S3TATIC_URL,
        'request': request
    }
Esempio n. 3
0
def user_showcount(request):
    if 'access_token' in request.COOKIES :
        ttaguser = ttagServiceByAccessToken(request)
        if ttaguser != False and 'data' in ttaguser and '_id' in ttaguser['data'] :
            notifications = ttagPost('/notification/count',{
                                                            'access_token':request.COOKIES['access_token'],
                                                            'user_id':ttaguser['data']['_id']})
            return {'response':{'data':{'count':notifications['data']['total']-notifications['data']['viewed']}}}
    return {}
Esempio n. 4
0
def user_showdashboard(request):
    more = False
    try :
        ttaguser = {'data':request.logged_in_user}
    except :
        ttaguser = ttagServiceByAccessToken(request)
    hubs = ttagGetHubsByOwnerId(ttaguser['data']['_id'], request.COOKIES['access_token'])
    if hubs['result'] == 'OK' and 'data' in hubs and 'hubs' in hubs['data'] :
        ttaguser['hubs'] = hubs['data']['hubs']
        if ttaguser['data']['user_state'] == 'HUB' :
            ttaguser['data']['email'] = mark_safe('<a href="'+reverse('hub-signout',args=('id/',ttaguser['data']['state_ref']))+'">Post as '+ttaguser['data']['full_name']+'</a>')
            ttaguser['data']['full_name'] = [ hub['hub_name'] for hub in ttaguser['hubs'] if hub['_id'] == ttaguser['data']['state_ref'] ][0]
            ttaguser['data']['avatar_url'] = [ hub['hub_icon'] for hub in ttaguser['hubs'] if hub['_id'] == ttaguser['data']['state_ref'] ][0]
    return {'response':ttaguser,'S3TATIC_URL':S3TATIC_URL,'ROOT_HOST':hosts.ROOT_HOST,'request':request, 'more': more}
Esempio n. 5
0
def user_showcount(request):
    if 'access_token' in request.COOKIES:
        ttaguser = ttagServiceByAccessToken(request)
        if ttaguser != False and 'data' in ttaguser and '_id' in ttaguser[
                'data']:
            notifications = ttagPost(
                '/notification/count', {
                    'access_token': request.COOKIES['access_token'],
                    'user_id': ttaguser['data']['_id']
                })
            return {
                'response': {
                    'data': {
                        'count':
                        notifications['data']['total'] -
                        notifications['data']['viewed']
                    }
                }
            }
    return {}
Esempio n. 6
0
def user_showfollowers(request):
    ttaguser = ttagServiceByAccessToken(request)
    followers = ttagRequestFollowers(ttaguser['data']['_id'])
    return {'response': followers, 'S3TATIC_URL': S3TATIC_URL, 'request': request}