Add support for replying to huddle messages.

(imported from commit 21c760838fa87bf524ff178eab6473dfa3c6921c)
This commit is contained in:
Tim Abbott
2012-09-05 11:14:12 -04:00
parent d13e7d5c2a
commit 08b55de0af
3 changed files with 13 additions and 1 deletions

View File

@@ -138,6 +138,8 @@ $(document).keydown(function(event) {
} else if (event.keyCode == 82) { // 'r' keypress, for responding to a zephyr
var parent = $("#selected").parents("tr");
var zephyr_class = parent.find("span.zephyr_class").text();
var zephyr_huddle = parent.find("span.zephyr_huddle_recipient").text();
var zephyr_personal = parent.find("span.zephyr_personal_recipient").text();
var instance = parent.find("span.zephyr_instance").text();
if (zephyr_class != '') {
$('#zephyr-type-tabs a[href="#class-message"]').tab('show');
@@ -145,7 +147,13 @@ $(document).keydown(function(event) {
$("#instance").val(instance);
$("#new_zephyr").focus();
$("#new_zephyr").select();
} else { // must be a personal
} else if (zephyr_huddle != '') {
var recipients = parent.find("span.zephyr_huddle_recipients_list").text();
$('#zephyr-type-tabs a[href="#personal-message"]').tab('show');
$("#recipient").val(recipients);
$("#new_personal_zephyr").focus();
$("#new_personal_zephyr").select();
} else if (zephyr_personal != '') {
var recipient = parent.find("span.zephyr_sender").text();
if (recipient == username) { // that is, we sent the original message
recipient = parent.find("span.zephyr_personal_recipient").text();

View File

@@ -2,6 +2,8 @@
<td class="pointer"><p></p></td>
<td><p>
{{#is_huddle}}
<span class="hidden zephyr_huddle_recipients_list
">{{#display_recipient}}{{name}}, {{/display_recipient}}</span>
{{#display_recipient}}
<span class="label zephyr_label_clickable zephyr_huddle_recipient"
onclick="narrow_huddle({{id}})">{{name}}</span>

View File

@@ -132,6 +132,8 @@ def zephyr(request):
if ',' in recipient_data:
# This is actually a huddle message
recipients = [r.strip() for r in recipient_data.split(',')]
# Filter out any trailing commas
recipients = [r for r in recipients if r]
recipient_ids = [UserProfile.objects.get(user=User.objects.get(username=r)).id
for r in recipients]
# Include the sender in the new huddle