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)
This commit is contained in:
Jessica McKellar 2012-09-11 15:20:24 -04:00
parent e60959ab64
commit f52ec24926
4 changed files with 13 additions and 3 deletions

View File

@ -27,7 +27,9 @@
<td class="messagebox" onclick="select_zephyr({{id}})">
<img class="profile_picture" src="http://www.gravatar.com/avatar/{{gravatar_hash}}?d=identicon"/>
<span class="zephyr_label_clickable zephyr_sender" onclick="prepare_personal('{{sender}}')">
<span class="zephyr_sender_name">{{sender_name}}</span> <span class="zephyr_sender_email">{{sender}}</span></span>
<span class="zephyr_sender_name">{{sender_name}}</span> <span class="zephyr_sender_email">{{sender_email}}</span>
<span class="zephyr_sender_username">{{sender}}</span>
</span>
<p class="zephyr_text">
{{{html_content}}}
</p></td>

View File

@ -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),

View File

@ -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();
}

View File

@ -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;