From 07433b80cc940e88f9eb719b3a24fa9cd1a31b29 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Thu, 14 Mar 2013 14:55:44 -0400 Subject: [PATCH] Don't mark your message as read if it comes from the API (imported from commit 0570d4db590e21b0fadd544b10c9865fa7acd66b) --- zephyr/lib/actions.py | 4 +++- zephyr/static/js/zephyr.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zephyr/lib/actions.py b/zephyr/lib/actions.py index 09387caacf..fe1690e3b8 100644 --- a/zephyr/lib/actions.py +++ b/zephyr/lib/actions.py @@ -154,7 +154,9 @@ def do_send_message(message, rendered_content=None, no_log=False): for user_profile in recipients if user_profile.user.is_active] for um in ums_to_create: - if um.user_profile == message.sender: + sent_by_human = message.sending_client.name.lower() in \ + ['website', 'iphone', 'android'] + if um.user_profile == message.sender and sent_by_human: um.flags |= UserMessage.flags.read batch_bulk_create(UserMessage, ums_to_create) diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index a639701441..f343a7068a 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -197,7 +197,10 @@ function message_unread(message) { return false; } - if (message.sender_email === email) { + var sent_by_human = ['website', 'iphone', 'android'] + .indexOf(message.client.toLowerCase()) !== -1; + + if (message.sender_email === email && sent_by_human) { return false; }