mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-17 06:27:28 +00:00
Fixed head commit bug in repo page
This commit is contained in:
parent
bbdfa51e49
commit
d56c070c7c
@ -1,19 +1,15 @@
|
|||||||
{% load seahub_tags avatar_tags i18n %}
|
{% load seahub_tags avatar_tags i18n %}
|
||||||
<span class="commit-msg vam" data-cmtid="{{ current_commit.id }}">
|
<span class="commit-msg vam" data-cmtid="{{ current_commit.id }}">
|
||||||
{{ current_commit.props.desc|translate_commit_desc }}
|
{{ info_commit.props.desc|translate_commit_desc }}
|
||||||
<a class="lsch" href="#" data-url="{% url 'repo_history_changes' repo.id %}?commit_id={{ current_commit.id }}" data-time="{{ current_commit.props.ctime|tsstr_sec }}">{% trans "Details"%}</a>
|
<a class="lsch" href="#" data-url="{% url 'repo_history_changes' repo.id %}?commit_id={{ info_commit.id }}" data-time="{{ info_commit.props.ctime|tsstr_sec }}">{% trans "Details"%}</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="meta-info split">
|
<span class="meta-info split">
|
||||||
{% if current_commit.props.creator_name %}
|
{% if info_commit.props.creator_name %}
|
||||||
{% if not current_commit.second_parent_id %}
|
{% avatar info_commit.props.creator_name 20 %}
|
||||||
{% avatar current_commit.props.creator_name 20 %}
|
<a class="vam" href="{% url 'user_profile' info_commit.creator_name|id_or_email %}">{{ info_commit.creator_name|email2nickname }}</a>
|
||||||
<a class="vam" href="{% url 'user_profile' current_commit.creator_name|id_or_email %}">{{ current_commit.creator_name|email2nickname }}</a>
|
|
||||||
{% else %}
|
|
||||||
<span class="vam">{% trans "Generated by system"%}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="vam">{% trans "Unknown"%}</span>
|
<span class="vam">{% trans "Unknown"%}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="time vam">{{ current_commit.props.ctime|translate_seahub_time }}</span>
|
<span class="time vam">{{ info_commit.props.ctime|translate_seahub_time }}</span>
|
||||||
</span>
|
</span>
|
||||||
<a href="{% url 'seahub.views.repo_history' repo.id %}" class="more vam split">{% trans "History"%}</a>
|
<a href="{% url 'seahub.views.repo_history' repo.id %}" class="more vam split">{% trans "History"%}</a>
|
||||||
|
@ -253,6 +253,11 @@ def list_dir(request, repo_id):
|
|||||||
return HttpResponse(json.dumps({'error': err_msg}),
|
return HttpResponse(json.dumps({'error': err_msg}),
|
||||||
status=500, content_type=content_type)
|
status=500, content_type=content_type)
|
||||||
|
|
||||||
|
if new_merge_with_no_conflict(head_commit):
|
||||||
|
info_commit = get_commit_before_new_merge(head_commit)
|
||||||
|
else:
|
||||||
|
info_commit = head_commit
|
||||||
|
|
||||||
path = request.GET.get('p', '/')
|
path = request.GET.get('p', '/')
|
||||||
if path[-1] != '/':
|
if path[-1] != '/':
|
||||||
path = path + '/'
|
path = path + '/'
|
||||||
@ -284,6 +289,7 @@ def list_dir(request, repo_id):
|
|||||||
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
|
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
|
||||||
"sub_lib_enabled": sub_lib_enabled,
|
"sub_lib_enabled": sub_lib_enabled,
|
||||||
'current_commit': head_commit,
|
'current_commit': head_commit,
|
||||||
|
'info_commit': info_commit,
|
||||||
}
|
}
|
||||||
html = render_to_string('snippets/repo_dir_data.html', ctx,
|
html = render_to_string('snippets/repo_dir_data.html', ctx,
|
||||||
context_instance=RequestContext(request))
|
context_instance=RequestContext(request))
|
||||||
@ -958,12 +964,15 @@ def get_current_commit(request, repo_id):
|
|||||||
err_msg = _(u'Error: no head commit id')
|
err_msg = _(u'Error: no head commit id')
|
||||||
return HttpResponse(json.dumps({'error': err_msg}),
|
return HttpResponse(json.dumps({'error': err_msg}),
|
||||||
status=500, content_type=content_type)
|
status=500, content_type=content_type)
|
||||||
|
|
||||||
if new_merge_with_no_conflict(head_commit):
|
if new_merge_with_no_conflict(head_commit):
|
||||||
head_commit = get_commit_before_new_merge(head_commit)
|
info_commit = get_commit_before_new_merge(head_commit)
|
||||||
|
else:
|
||||||
|
info_commit = head_commit
|
||||||
|
|
||||||
ctx = {
|
ctx = {
|
||||||
'repo': repo,
|
'repo': repo,
|
||||||
'current_commit': head_commit
|
'info_commit': info_commit
|
||||||
}
|
}
|
||||||
html = render_to_string('snippets/current_commit.html', ctx,
|
html = render_to_string('snippets/current_commit.html', ctx,
|
||||||
context_instance=RequestContext(request))
|
context_instance=RequestContext(request))
|
||||||
|
@ -196,8 +196,11 @@ def render_repo(request, repo):
|
|||||||
head_commit = get_commit(repo.head_cmmt_id)
|
head_commit = get_commit(repo.head_cmmt_id)
|
||||||
if not head_commit:
|
if not head_commit:
|
||||||
raise Http404
|
raise Http404
|
||||||
|
|
||||||
if new_merge_with_no_conflict(head_commit):
|
if new_merge_with_no_conflict(head_commit):
|
||||||
head_commit = get_commit_before_new_merge(head_commit)
|
info_commit = get_commit_before_new_merge(head_commit)
|
||||||
|
else:
|
||||||
|
info_commit = head_commit
|
||||||
|
|
||||||
repo_size = get_repo_size(repo.id)
|
repo_size = get_repo_size(repo.id)
|
||||||
no_quota = is_no_quota(repo.id)
|
no_quota = is_no_quota(repo.id)
|
||||||
@ -229,6 +232,7 @@ def render_repo(request, repo):
|
|||||||
'repo_owner': repo_owner,
|
'repo_owner': repo_owner,
|
||||||
'is_repo_owner': is_repo_owner,
|
'is_repo_owner': is_repo_owner,
|
||||||
'current_commit': head_commit,
|
'current_commit': head_commit,
|
||||||
|
'info_commit': info_commit,
|
||||||
'password_set': True,
|
'password_set': True,
|
||||||
'repo_size': repo_size,
|
'repo_size': repo_size,
|
||||||
'dir_list': dir_list,
|
'dir_list': dir_list,
|
||||||
|
Loading…
Reference in New Issue
Block a user