Actually fix deduplication of synced huddle messages.

(imported from commit 63e7fbdc89e1271751f73d20f2185a048b56dd60)
This commit is contained in:
Tim Abbott 2012-09-24 17:38:21 -04:00
parent a3a027f8c7
commit 3b817ecc1c
1 changed files with 4 additions and 3 deletions

View File

@ -190,9 +190,10 @@ def forge_zephyr(request):
if (request.POST['type'] == 'personal' and ',' in request.POST['recipient']):
# Huddle message, need to make sure we're not syncing it twice!
if Zephyr.objects.filter(sender__user__email=request.POST['sender'],
content=request.POST['new_zephyr'],
pub_date=datetime.datetime.utcfromtimestamp(float(request.POST['time'])).replace(tzinfo=utc)):
if Zephyr.objects.filter(sender__user__email=email,
content=md_engine.convert(request.POST['new_zephyr']),
pub_date__gt=datetime.datetime.utcfromtimestamp(float(request.POST['time']) - 1).replace(tzinfo=utc),
pub_date__lt=datetime.datetime.utcfromtimestamp(float(request.POST['time']) + 1).replace(tzinfo=utc)):
# This is a duplicate huddle message, deduplicate!
return json_success()