1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

Fixed bug in show group message in home page

This commit is contained in:
zhengxie
2013-06-01 10:52:16 +08:00
parent 63b36c8923
commit d8d747ee05
2 changed files with 5 additions and 24 deletions

View File

@@ -34,7 +34,7 @@
</div>
</div>
{% if grpmsg_list or grpmsg_reply_list or orgmsg_list %}
{% if grpmsg_list or grpmsg_reply_list %}
<div class="info-item">
<h3 class="info-item-top">{% trans "Reminding..." %}</h3>
<ul class="info-item-bottom">
@@ -57,14 +57,6 @@
{% endblocktrans %}</a></li>
{% endif %}
{% if orgmsg_list %}
<li><a href="{% url 'org_msg' %}" class="no-bold">
{% blocktrans count counter=orgmsg_list|length %}
one org message
{% plural %}
{{ counter }} org messages
{% endblocktrans %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}

View File

@@ -816,18 +816,16 @@ def myhome(request):
# user notifications
grpmsg_list = []
grpmsg_reply_list = []
orgmsg_list = []
joined_group_ids = [x.id for x in joined_groups]
notes = UserNotification.objects.filter(to_user=request.user.username)
for n in notes:
if n.msg_type == 'group_msg':
grp = get_group(n.detail)
if not grp:
if int(n.detail) not in joined_group_ids:
continue
grp = get_group(int(n.detail))
grpmsg_list.append(grp)
elif n.msg_type == 'grpmsg_reply':
grpmsg_reply_list.append(n.detail)
elif n.msg_type == 'org_join_msg':
orgmsg_list.append(n.detail)
# get nickname
profiles = Profile.objects.filter(user=request.user.username)
@@ -836,15 +834,7 @@ def myhome(request):
autocomp_groups = joined_groups
contacts = Contact.objects.get_registered_contacts_by_user(email)
if request.cloud_mode:
allow_public_share = False
else:
allow_public_share = True
# Clear org messages just in case. Should never happen in production
# environment.
orgmsg_list = []
allow_public_share = False if request.cloud_mode else True
# events
if EVENTS_ENABLED:
@@ -882,7 +872,6 @@ def myhome(request):
"notes": notes,
"grpmsg_list": grpmsg_list,
"grpmsg_reply_list": grpmsg_reply_list,
"orgmsg_list": orgmsg_list,
"create_shared_repo": False,
"allow_public_share": allow_public_share,
"events": events,