1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 09:21:54 +00:00

Sort repos im myhome and group page

This commit is contained in:
xiez
2012-06-28 20:02:17 +08:00
parent d48be652a5
commit 6a77ab10b0
3 changed files with 6 additions and 8 deletions

View File

@@ -134,18 +134,17 @@ def render_group_info(request, group_id, form):
repo = get_repo(repo_id) repo = get_repo(repo_id)
if not repo: if not repo:
continue continue
repo.share_from = seafserv_threaded_rpc.get_group_repo_share_from(repo_id) 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 if request.user.username == repo.share_from else False:
repo.share_from_me = True
else:
repo.share_from_me = False
try: try:
repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime
except: except:
repo.latest_modify = None repo.latest_modify = None
continue
repos.append(repo) repos.append(repo)
repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
# remove user notifications # remove user notifications
UserNotification.objects.filter(to_user=request.user.username, UserNotification.objects.filter(to_user=request.user.username,
@@ -173,7 +172,6 @@ def render_group_info(request, group_id, form):
msg.reply_list = MessageReply.objects.filter(reply_to=msg) msg.reply_list = MessageReply.objects.filter(reply_to=msg)
msg.reply_cnt = len(msg.reply_list) msg.reply_cnt = len(msg.reply_list)
return render_to_response("group/group_info.html", { return render_to_response("group/group_info.html", {
"managers": managers, "managers": managers,
"common_members": common_members, "common_members": common_members,

View File

@@ -85,5 +85,3 @@ def calculate_repo_last_modify(repo_list):
repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime
except: except:
repo.latest_modify = None repo.latest_modify = None
continue

View File

@@ -541,11 +541,13 @@ def myhome(request):
# Repos that I own # Repos that I own
owned_repos = seafserv_threaded_rpc.list_owned_repos(email) owned_repos = seafserv_threaded_rpc.list_owned_repos(email)
calculate_repo_last_modify(owned_repos) 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 # Repos that are share to me
in_repos = seafserv_threaded_rpc.list_share_repos(request.user.username, in_repos = seafserv_threaded_rpc.list_share_repos(request.user.username,
'to_email', -1, -1) 'to_email', -1, -1)
calculate_repo_last_modify(in_repos) calculate_repo_last_modify(in_repos)
in_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
# my contacts # my contacts
contacts = Contact.objects.filter(user_email=email) contacts = Contact.objects.filter(user_email=email)