1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

Fixed none issue when list user notifications.

This commit is contained in:
zhengxie
2013-12-02 12:07:56 +08:00
parent 497f00860e
commit 8bf8b56266
2 changed files with 32 additions and 14 deletions

View File

@@ -412,6 +412,9 @@ class UserNotification(models.Model):
repo_id = d['repo_id']
repo = seafile_api.get_repo(repo_id)
if repo is None:
return None
msg = _(u"%(user)s has shared a library named <a href='%(href)s'>%(repo_name)s</a> to you.") % {
'user': share_from,
'href': reverse('repo', args=[repo.id]),
@@ -463,7 +466,10 @@ class UserNotification(models.Model):
return _(u"Internal error")
group_id = d.get('group_id')
group = seaserv.get_group(group_id)
group = seaserv.get_group(group_id)
if group is None:
return None
msg_from = d.get('msg_from')
if msg_from is None:

View File

@@ -25,26 +25,38 @@
<th width="20%">{% trans "Time"%}</th>
</tr>
{% for notice in notices %}
{% if notice.is_group_msg %}
<tr class="{% if not notice.seen %}bold{% endif %}">
<td>{{ notice.format_group_message|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% if notice.is_group_msg %}
{% with group_message=notice.format_group_message %}
{% if group_message %}
<tr class="{% if not notice.seen %}bold{% endif %}">
<td>{{ group_message|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% endif %}
{% endwith %}
{% elif notice.is_grpmsg_reply %}
<tr class="{% if not notice.seen %}bold{% endif %}">
<td>{{ notice.format_grpmsg_reply|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% with grpmsg_reply=notice.format_grpmsg_reply %}
{% if grpmsg_reply %}
<tr class="{% if not notice.seen %}bold{% endif %}">
<td>{{ grpmsg_reply|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% endif %}
{% endwith %}
{% elif notice.is_file_uploaded_msg %}
<tr class="{% if not notice.is_seen %}bold{% endif %}">
<td>{{ notice.format_file_uploaded_msg|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% elif notice.is_repo_share_msg %}
<tr class="{% if not notice.is_seen %}bold{% endif %}">
<td>{{ notice.format_repo_share_msg|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% with repo_share_msg=notice.format_repo_share_msg %}
{% if repo_share_msg %}
<tr class="{% if not notice.is_seen %}bold{% endif %}">
<td>{{ repo_share_msg|safe }}</td>
<td>{{ notice.timestamp|translate_seahub_time }}</td>
</tr>
{% endif %}
{% endwith %}
{% elif notice.is_priv_file_share_msg %}
<tr class="{% if not notice.is_seen %}bold{% endif %}">
<td>{{ notice.format_priv_file_share_msg|safe }}</td>