1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 14:21:23 +00:00

[api2] Fix bug:group msg attachment more than 1

This commit is contained in:
poetwang
2014-04-26 16:39:28 +08:00
committed by zhengxie
parent 284304dc26
commit e499ca6927

View File

@@ -319,18 +319,21 @@ def group_msg_to_json(msg, get_all_replies):
}
try:
att = MessageAttachment.objects.get(group_message_id=msg.id)
atts = MessageAttachment.objects.filter(group_message_id=msg.id)
except MessageAttachment.DoesNotExist:
att = None
atts = []
if att:
atts_json = []
for att in atts:
att_json = {
'path' : att.path,
'repo' : att.repo_id,
'type' : att.attach_type,
'src' : att.src,
}
ret['att'] = att_json
atts_json.append(att_json)
if len(atts_json) > 0:
ret['atts'] = atts_json
reply_list = MessageReply.objects.filter(reply_to=msg)
msg.reply_cnt = reply_list.count()