mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-16 22:17:59 +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 %}
|
||||
<span class="commit-msg vam" data-cmtid="{{ current_commit.id }}">
|
||||
{{ current_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>
|
||||
{{ info_commit.props.desc|translate_commit_desc }}
|
||||
<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 class="meta-info split">
|
||||
{% if current_commit.props.creator_name %}
|
||||
{% if not current_commit.second_parent_id %}
|
||||
{% avatar current_commit.props.creator_name 20 %}
|
||||
<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 %}
|
||||
{% if info_commit.props.creator_name %}
|
||||
{% avatar info_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>
|
||||
{% else %}
|
||||
<span class="vam">{% trans "Unknown"%}</span>
|
||||
{% 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>
|
||||
<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}),
|
||||
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', '/')
|
||||
if path[-1] != '/':
|
||||
path = path + '/'
|
||||
@ -284,6 +289,7 @@ def list_dir(request, repo_id):
|
||||
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
|
||||
"sub_lib_enabled": sub_lib_enabled,
|
||||
'current_commit': head_commit,
|
||||
'info_commit': info_commit,
|
||||
}
|
||||
html = render_to_string('snippets/repo_dir_data.html', ctx,
|
||||
context_instance=RequestContext(request))
|
||||
@ -958,12 +964,15 @@ def get_current_commit(request, repo_id):
|
||||
err_msg = _(u'Error: no head commit id')
|
||||
return HttpResponse(json.dumps({'error': err_msg}),
|
||||
status=500, content_type=content_type)
|
||||
|
||||
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 = {
|
||||
'repo': repo,
|
||||
'current_commit': head_commit
|
||||
'info_commit': info_commit
|
||||
}
|
||||
html = render_to_string('snippets/current_commit.html', ctx,
|
||||
context_instance=RequestContext(request))
|
||||
|
@ -196,8 +196,11 @@ def render_repo(request, repo):
|
||||
head_commit = get_commit(repo.head_cmmt_id)
|
||||
if not head_commit:
|
||||
raise Http404
|
||||
|
||||
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)
|
||||
no_quota = is_no_quota(repo.id)
|
||||
@ -229,6 +232,7 @@ def render_repo(request, repo):
|
||||
'repo_owner': repo_owner,
|
||||
'is_repo_owner': is_repo_owner,
|
||||
'current_commit': head_commit,
|
||||
'info_commit': info_commit,
|
||||
'password_set': True,
|
||||
'repo_size': repo_size,
|
||||
'dir_list': dir_list,
|
||||
|
Loading…
Reference in New Issue
Block a user