1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +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)
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,
@@ -173,7 +172,6 @@ def render_group_info(request, group_id, form):
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,
"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
except:
repo.latest_modify = None
continue

View File

@@ -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)