From 7e4776322d629cbf50b89b77fc448f46583ac137 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Mon, 3 Dec 2012 13:49:12 -0500 Subject: [PATCH] [manual] Unify huddles and personals into private messages on the receive path feedback-bot and zephyr_mirror will need to be updated and restarted when this is deployed to prod. (imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69) --- api/bots/feedback-bot | 2 +- api/bots/zephyr_mirror_backend.py | 21 ++++--- templates/zephyr/home.html | 12 ++-- tools/jslint/check-all.js | 2 +- zephyr/jstemplates/message.html | 4 +- .../jstemplates/userinfo_popover_content.html | 2 +- zephyr/models.py | 58 +++++++++---------- zephyr/static/js/hotkey.js | 8 +-- zephyr/static/js/narrow.js | 37 ++++-------- zephyr/static/js/notifications.js | 4 +- zephyr/static/js/ui.js | 8 +-- zephyr/static/js/zephyr.js | 48 ++++----------- zephyr/static/styles/zephyr.css | 6 +- zephyr/views.py | 2 +- 14 files changed, 86 insertions(+), 128 deletions(-) diff --git a/api/bots/feedback-bot b/api/bots/feedback-bot index b1d521ebfc..75f130dcc6 100755 --- a/api/bots/feedback-bot +++ b/api/bots/feedback-bot @@ -18,7 +18,7 @@ staging_client = humbug.Client( site="https://staging.humbughq.com") def forward_message(message): - if message["type"] != "personal": + if message["type"] != "private" or len(message["recipient"]) != 2: return forwarded_message = { "type": "stream", diff --git a/api/bots/zephyr_mirror_backend.py b/api/bots/zephyr_mirror_backend.py index 058c8ddac6..8428ea5d65 100755 --- a/api/bots/zephyr_mirror_backend.py +++ b/api/bots/zephyr_mirror_backend.py @@ -461,13 +461,14 @@ def forward_to_zephyr(message): instance = zephyr_class zephyr_class = "message" zwrite_args.extend(["-c", zephyr_class, "-i", instance]) - elif message['type'] == "personal": - recipient = to_zephyr_username(message["display_recipient"]["email"]) - zwrite_args.extend([recipient]) - elif message['type'] == "huddle": - zwrite_args.extend(["-C"]) - zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "") - for user in message["display_recipient"]]) + elif message['type'] == "private": + if len(message['display_recipient']) == 1: + recipient = to_zephyr_username(message["display_recipient"][0]["email"]) + zwrite_args.extend([recipient]) + else: + zwrite_args.extend(["-C"]) + zwrite_args.extend([to_zephyr_username(user["email"]).replace("@ATHENA.MIT.EDU", "") + for user in message["display_recipient"]]) if options.test_mode: logger.debug("Would have forwarded: %s\n%s" % @@ -522,12 +523,10 @@ received it, Zephyr users did not. The error message from zwrite was: def maybe_forward_to_zephyr(message): if (message["sender_email"] == options.user + "@mit.edu"): if not ((message["type"] == "stream") or - (message["type"] == "personal" and - message["display_recipient"]["email"].lower().endswith("mit.edu")) or - (message["type"] == "huddle" and + (message["type"] == "private" and False not in [u["email"].lower().endswith("mit.edu") for u in message["display_recipient"]])): - # Don't try forward personals/huddles with non-MIT users + # Don't try forward private messages with non-MIT users # to MIT Zephyr. return timestamp_now = datetime.datetime.now().strftime("%s") diff --git a/templates/zephyr/home.html b/templates/zephyr/home.html index 4a54f3e090..435e9e909b 100644 --- a/templates/zephyr/home.html +++ b/templates/zephyr/home.html @@ -29,9 +29,9 @@ - - - + + + @@ -90,15 +90,15 @@ - - + + You and -
+