From f52ec249262950b54c7bed46848b011a3c32bb3a Mon Sep 17 00:00:00 2001 From: Jessica McKellar Date: Tue, 11 Sep 2012 15:20:24 -0400 Subject: [PATCH] For now, compose zephyrs to usernames. We'll eventually need to normalize emails, autocompleted names, etc. to one entity we use when talking to the server about senders and personals recipients, but for now since we've hardcoded usernames everywhere, just use those. (imported from commit 4a0e033b301b8dec55d97157eb4993982f6b2641) --- zephyr/jstemplates/zephyr.html | 4 +++- zephyr/models.py | 3 ++- zephyr/static/js/zephyr.js | 5 ++++- zephyr/static/styles/zephyr.css | 4 ++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/zephyr/jstemplates/zephyr.html b/zephyr/jstemplates/zephyr.html index ef7eefa684..20a26adc0f 100644 --- a/zephyr/jstemplates/zephyr.html +++ b/zephyr/jstemplates/zephyr.html @@ -27,7 +27,9 @@ - {{sender_name}} {{sender}} + {{sender_name}} {{sender_email}} + {{sender}} +

{{{html_content}}}

diff --git a/zephyr/models.py b/zephyr/models.py index 2eda1e4a4e..d2796f39b7 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -133,7 +133,8 @@ class Zephyr(models.Model): def to_dict(self): return {'id' : self.id, - 'sender' : self.sender.user.email, + 'sender' : self.sender.user.username, + 'sender_email' : self.sender.user.email, 'sender_name' : self.sender.full_name, 'type' : self.recipient.type_name(), 'display_recipient': get_display_recipient(self.recipient), diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 1213751b09..bf0a7c6989 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -229,7 +229,10 @@ function process_hotkey(code) { $("#new_personal_zephyr").focus(); $("#new_personal_zephyr").select(); } else if (zephyr_personal !== '') { - var recipient = parent.find("span.zephyr_sender").text(); + // Until we allow sending zephyrs based on multiple meaningful + // representations of a user (name, username, email, etc.), just + // deal with usernames. + var recipient = parent.find("span.zephyr_sender_username").text(); if (recipient === username) { // that is, we sent the original message recipient = parent.find("span.zephyr_personal_recipient").text(); } diff --git a/zephyr/static/styles/zephyr.css b/zephyr/static/styles/zephyr.css index 89a93b9f77..38a74b5d26 100644 --- a/zephyr/static/styles/zephyr.css +++ b/zephyr/static/styles/zephyr.css @@ -77,6 +77,10 @@ span.zephyr_sender_email { font-size: 80%; } +span.zephyr_sender_username { + visibility: hidden; +} + span.zephyr_label_clickable:hover { cursor: pointer; color: #08C;