diff --git a/group/views.py b/group/views.py index 5b3b98abcd..2abc5d3275 100644 --- a/group/views.py +++ b/group/views.py @@ -134,18 +134,17 @@ def render_group_info(request, group_id, form): repo = get_repo(repo_id) if not repo: continue + repo.share_from = seafserv_threaded_rpc.get_group_repo_share_from(repo_id) - if request.user.username == repo.share_from: - repo.share_from_me = True - else: - repo.share_from_me = False + repo.share_from_me = True if request.user.username == repo.share_from else False: + try: repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime except: repo.latest_modify = None - continue repos.append(repo) + repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify)) # remove user notifications UserNotification.objects.filter(to_user=request.user.username, @@ -172,7 +171,6 @@ def render_group_info(request, group_id, form): for msg in group_msgs: msg.reply_list = MessageReply.objects.filter(reply_to=msg) msg.reply_cnt = len(msg.reply_list) - return render_to_response("group/group_info.html", { "managers": managers, diff --git a/utils.py b/utils.py index a499ffbfd3..a6e63d83a8 100644 --- a/utils.py +++ b/utils.py @@ -85,5 +85,3 @@ def calculate_repo_last_modify(repo_list): repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime except: repo.latest_modify = None - continue - diff --git a/views.py b/views.py index 02410611ac..f173cb2533 100644 --- a/views.py +++ b/views.py @@ -541,11 +541,13 @@ def myhome(request): # Repos that I own owned_repos = seafserv_threaded_rpc.list_owned_repos(email) calculate_repo_last_modify(owned_repos) + owned_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify)) # Repos that are share to me in_repos = seafserv_threaded_rpc.list_share_repos(request.user.username, 'to_email', -1, -1) calculate_repo_last_modify(in_repos) + in_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify)) # my contacts contacts = Contact.objects.filter(user_email=email)