+ class="message_row{{^is_stream}} private-message{{/is_stream}}{{#include_sender}} include-sender{{/include_sender}}">
{{#include_sender}}
| |
- ";
});
autocomplete_needs_update = false;
};
-function get_huddle_recipients(query_string) {
+function get_pm_recipients(query_string) {
// Assumes email addresses don't have commas or semicolons in them
return query_string.split(/\s*[,;]\s*/);
}
-// Returns an array of huddle recipients, removing empty elements.
+// Returns an array of private message recipients, removing empty elements.
// For example, "a,,b, " => ["a", "b"]
-function get_cleaned_huddle_recipients(query_string) {
- var recipients = get_huddle_recipients(query_string);
+function get_cleaned_pm_recipients(query_string) {
+ var recipients = get_pm_recipients(query_string);
recipients = $.grep(recipients, function (elem, idx) {
return elem.match(/\S/);
});
return recipients;
}
-function get_last_recipient_in_huddle(query_string) {
- var recipients = get_huddle_recipients(query_string);
+function get_last_recipient_in_pm(query_string) {
+ var recipients = get_pm_recipients(query_string);
return recipients[recipients.length-1];
}
// Loosely based on Bootstrap's default highlighter, but with escaping added.
function composebox_typeahead_highlighter(item) {
var query = this.query;
- if ($(this.$element).attr('id') === 'huddle_recipient') {
- // There could be multiple recipients in a huddle, we want to
- // decide what to highlight based only on the most recent one
- // we're entering.
- query = get_last_recipient_in_huddle(this.query);
+ if ($(this.$element).attr('id') === 'private_message_recipient') {
+ // There could be multiple recipients in a private message,
+ // we want to decide what to highlight based only on the most
+ // recent one we're entering.
+ query = get_last_recipient_in_pm(this.query);
}
query = query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
var regex = new RegExp('(' + query + ')', 'ig');
@@ -177,14 +177,14 @@ exports.initialize = function () {
highlighter: composebox_typeahead_highlighter,
tabSkips: true
});
- $( "#huddle_recipient" ).typeahead({
+ $( "#private_message_recipient" ).typeahead({
source: function (query, process) {
- return huddle_typeahead_list;
+ return private_message_typeahead_list;
},
items: 4,
highlighter: composebox_typeahead_highlighter,
matcher: function (item) {
- var current_recipient = get_last_recipient_in_huddle(this.query);
+ var current_recipient = get_last_recipient_in_pm(this.query);
// If the name is only whitespace (does not contain any non-whitespace),
// we're between typing names; don't autocomplete anything for us.
if (! current_recipient.match(/\S/)) {
@@ -194,7 +194,7 @@ exports.initialize = function () {
return (item.toLowerCase().indexOf(current_recipient.toLowerCase()) !== -1);
},
updater: function (item) {
- var previous_recipients = get_cleaned_huddle_recipients(this.query);
+ var previous_recipients = get_cleaned_pm_recipients(this.query);
previous_recipients.pop();
previous_recipients = previous_recipients.join(", ");
if (previous_recipients.length !== 0) {
@@ -210,9 +210,9 @@ exports.initialize = function () {
stopAdvance: true // Do not advance to the next field on a tab or enter
});
- $( "#huddle_recipient" ).blur(function (event) {
+ $( "#private_message_recipient" ).blur(function (event) {
var val = $(this).val();
- var recipients = get_cleaned_huddle_recipients(val);
+ var recipients = get_cleaned_pm_recipients(val);
$(this).val(recipients.join(", "));
});
diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js
index 20b33f1011..689746f053 100644
--- a/zephyr/static/js/hotkey.js
+++ b/zephyr/static/js/hotkey.js
@@ -91,7 +91,7 @@ function process_hotkey(e) {
compose.start('stream');
return process_compose_hotkey;
case 67: // 'C': compose huddle
- compose.start('personal');
+ compose.start('private');
return process_compose_hotkey;
case 114: // 'r': respond to message
respond_to_message();
diff --git a/zephyr/static/js/reload.js b/zephyr/static/js/reload.js
index 76c29a67fb..f14fe3b647 100644
--- a/zephyr/static/js/reload.js
+++ b/zephyr/static/js/reload.js
@@ -23,7 +23,7 @@ function preserve_compose(send_after_reload) {
url += "+stream=" + encodeURIComponent(compose.stream_name());
url += "+subject=" + encodeURIComponent(compose.subject());
} else {
- url += "+msg_type=huddle";
+ url += "+msg_type=private";
url += "+recipient=" + encodeURIComponent(compose.recipient());
}
url += "+msg="+ encodeURIComponent(compose.message_content());
@@ -55,7 +55,7 @@ $(function () {
// TODO: preserve focus
compose.start(vars.msg_type, {stream: vars.stream,
subject: vars.subject,
- huddle_recipient: vars.recipient,
+ private_message_recipient: vars.recipient,
message: vars.msg});
if (send_now) {
compose.finish();
diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js
index 8683779a40..1c6658a550 100644
--- a/zephyr/static/js/ui.js
+++ b/zephyr/static/js/ui.js
@@ -310,8 +310,8 @@ $(function () {
$('#message-type-tabs a[href="#stream-message"]').on('shown', function (e) {
compose.set_message_type('stream');
});
- $('#message-type-tabs a[href="#personal-message"]').on('shown', function (e) {
- compose.set_message_type('huddle');
+ $('#message-type-tabs a[href="#private-message"]').on('shown', function (e) {
+ compose.set_message_type('private');
});
// Prepare the click handler for subbing to a new stream to which
diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js
index f0ad9b8964..b2602417f9 100644
--- a/zephyr/static/js/zephyr.js
+++ b/zephyr/static/js/zephyr.js
@@ -107,23 +107,23 @@ function respond_to_message(reply_type) {
subject = message.subject;
}
- var huddle_recipient = message.reply_to;
+ var pm_recipient = message.reply_to;
if (reply_type === "personal" && message.type === "huddle") {
// reply_to for huddle messages is the whole huddle, so for
// personals replies we need to set the the huddle recipient
// to just the sender
- huddle_recipient = message.sender_email;
+ pm_recipient = message.sender_email;
}
- msg_type = reply_type;
- if (msg_type === undefined) {
+ if (reply_type === 'personal'
+ || message.type === 'personal'
+ || message.type === 'huddle')
+ {
+ msg_type = 'private';
+ } else {
msg_type = message.type;
}
- if (msg_type === "huddle") {
- // Huddle messages use the personals compose box
- msg_type = "personal";
- }
compose.start(msg_type, {'stream': stream, 'subject': subject,
- 'huddle_recipient': huddle_recipient});
+ 'private_message_recipient': pm_recipient});
}
// Called by mouseover etc.
diff --git a/zephyr/static/styles/zephyr.css b/zephyr/static/styles/zephyr.css
index 04851d1951..081a653796 100644
--- a/zephyr/static/styles/zephyr.css
+++ b/zephyr/static/styles/zephyr.css
@@ -154,7 +154,7 @@ td.pointer {
border-left: 0px;
}
-.messagebox.personal-message {
+.messagebox.private-message {
border-color: #444;
border-width: 0px 1px 1px 1px;
background-color: #feffe0;
@@ -301,7 +301,7 @@ img.profile_picture {
filter: alpha(opacity=40);
}
-.compose_table #personal-message {
+.compose_table #private-message {
display: none;
}
@@ -349,7 +349,7 @@ input.recipient_box {
#subject.recipient_box {
width: 64%;
}
-#huddle_recipient.recipient_box {
+#private_message_recipient.recipient_box {
width: 75%;
}
diff --git a/zephyr/tests.py b/zephyr/tests.py
index 918b4b3548..e48b4b0247 100644
--- a/zephyr/tests.py
+++ b/zephyr/tests.py
@@ -358,7 +358,7 @@ class MessagePOSTTest(AuthedTestCase):
Sending a personal message to a valid username is successful.
"""
self.login("hamlet@humbughq.com")
- result = self.client.post("/json/send_message", {"type": "personal",
+ result = self.client.post("/json/send_message", {"type": "private",
"content": "Test message",
"client": "test suite",
"recipient": "othello@humbughq.com"})
@@ -369,7 +369,7 @@ class MessagePOSTTest(AuthedTestCase):
Sending a personal message to an invalid email returns error JSON.
"""
self.login("hamlet@humbughq.com")
- result = self.client.post("/json/send_message", {"type": "personal",
+ result = self.client.post("/json/send_message", {"type": "private",
"content": "Test message",
"client": "test suite",
"recipient": "nonexistent"})
diff --git a/zephyr/tests/frontend/tests.js b/zephyr/tests/frontend/tests.js
index b31fcd7706..11653df8fc 100644
--- a/zephyr/tests/frontend/tests.js
+++ b/zephyr/tests/frontend/tests.js
@@ -154,17 +154,17 @@ wait_and_send('stream', {
content: 'test message C'
});
-wait_and_send('personal', {
+wait_and_send('private', {
recipient: 'cordelia@humbughq.com, hamlet@humbughq.com',
content: 'personal A'
});
-wait_and_send('personal', {
+wait_and_send('private', {
recipient: 'cordelia@humbughq.com, hamlet@humbughq.com',
content: 'personal B'
});
-wait_and_send('personal', {
+wait_and_send('private', {
recipient: 'cordelia@humbughq.com',
content: 'personal C'
});
@@ -193,7 +193,7 @@ wait_for_receive(function () {
});
});
-wait_and_send('personal', {
+wait_and_send('private', {
recipient: 'cordelia@humbughq.com, hamlet@humbughq.com',
content: 'personal D'
});
diff --git a/zephyr/views.py b/zephyr/views.py
index d224be5da2..d4e0cb6770 100644
--- a/zephyr/views.py
+++ b/zephyr/views.py
@@ -483,10 +483,10 @@ def create_mirrored_message_users(request, user_profile):
if "recipient" not in request.POST:
return (False, None)
- huddle_recipients = extract_recipients(request)
+ pm_recipients = extract_recipients(request)
- # Then, check that all huddle/personal recipients are in our realm:
- for recipient in huddle_recipients:
+ # Then, check that all private message recipients are in our realm:
+ for recipient in pm_recipients:
if not same_realm_email(user_profile, recipient):
return (False, None)
@@ -498,8 +498,8 @@ def create_mirrored_message_users(request, user_profile):
else:
sender = user_profile
- # Create users for huddle/personal recipients, if needed.
- for recipient in huddle_recipients:
+ # Create users for private message recipients, if needed.
+ for recipient in pm_recipients:
create_user_if_needed(user_profile.realm, recipient,
recipient.split('@')[0],
recipient.split('@')[0],
@@ -524,7 +524,7 @@ def send_message_backend(request, user_profile, sender, message_type_name = POST
if client_name == "zephyr_mirror":
# Here's how security works for non-superuser mirroring:
#
- # The message must be (1) a huddle/personal message (2) that
+ # The message must be (1) a private message (2) that
# is both sent and received exclusively by other users in your
# realm which (3) must be the MIT realm and (4) you must have
# received the message.
@@ -534,7 +534,7 @@ def send_message_backend(request, user_profile, sender, message_type_name = POST
# you report having sent you a message.
if "sender" not in request.POST:
return json_error("Missing sender")
- if message_type_name != "personal" and not is_super_user:
+ if message_type_name != "private" and not is_super_user:
return json_error("User not authorized for this query")
(valid_input, mirror_sender) = create_mirrored_message_users(request, user_profile)
if not valid_input:
@@ -572,16 +572,16 @@ def send_message_backend(request, user_profile, sender, message_type_name = POST
except Stream.DoesNotExist:
return json_error("Stream does not exist")
recipient = Recipient.objects.get(type_id=stream.id, type=Recipient.STREAM)
- elif message_type_name == 'personal':
+ elif message_type_name == 'private':
if "recipient" not in request.POST:
return json_error("Missing recipients")
- huddle_recipients = extract_recipients(request)
+ pm_recipients = extract_recipients(request)
if client_name == "zephyr_mirror":
- if user_profile.user.email not in huddle_recipients and not forged:
+ if user_profile.user.email not in pm_recipients and not forged:
return json_error("User not authorized for this query")
recipient_profile_ids = set()
- for recipient in huddle_recipients:
+ for recipient in pm_recipients:
if recipient == "":
continue
try:
@@ -589,7 +589,7 @@ def send_message_backend(request, user_profile, sender, message_type_name = POST
except UserProfile.DoesNotExist:
return json_error("Invalid email '%s'" % (recipient,))
if len(recipient_profile_ids) > 1:
- # Make sure the sender is included in the huddle
+ # Make sure the sender is included in huddle messages
recipient_profile_ids.add(sender.id)
huddle = get_huddle(list(recipient_profile_ids))
recipient = Recipient.objects.get(type_id=huddle.id, type=Recipient.HUDDLE)
|