diff --git a/api/bots/check-mirroring b/api/bots/check-mirroring index bc8bd94bfe..12eeaf4f17 100755 --- a/api/bots/check-mirroring +++ b/api/bots/check-mirroring @@ -57,7 +57,7 @@ if child_pid == 0: # Run the humbug => zephyr mirror in the child time.sleep(3) humbug_client.send_message({ - "type": "personal", + "type": "private", "content": str(hzkey1), "recipient": humbug_user, }); diff --git a/api/bots/gcal-bot b/api/bots/gcal-bot index 91b4c13118..0f2fd77d47 100755 --- a/api/bots/gcal-bot +++ b/api/bots/gcal-bot @@ -128,7 +128,7 @@ def send_reminders(): message = 'Reminder:\n\n' + '\n'.join('* ' + m for m in messages) humbug.send_message(dict( - type = 'personal', + type = 'private', recipient = options.user, content = message)) diff --git a/api/bots/zephyr_mirror.py b/api/bots/zephyr_mirror.py index 6a3c37cb05..cf34f0d81a 100755 --- a/api/bots/zephyr_mirror.py +++ b/api/bots/zephyr_mirror.py @@ -247,10 +247,10 @@ def process_notice(notice, log): 'zsig' : zsig, # logged here but not used by app 'content' : body } if is_huddle: - zeph['type'] = 'personal' + zeph['type'] = 'private' zeph['recipient'] = huddle_recipients elif is_personal: - zeph['type'] = 'personal' + zeph['type'] = 'private' zeph['recipient'] = to_humbug_username(notice.recipient) else: zeph['type'] = 'stream' @@ -261,7 +261,7 @@ def process_notice(notice, log): zeph["subject"] = '(instance "%s")' % (notice.instance,) # Add instances in for instanced personals - if zeph['type'] == "personal" and notice.instance.lower() != "personal": + if zeph['type'] == "private" and notice.instance.lower() != "personal": zeph["content"] = "[-i %s]" % (notice.instance,) + "\n" + zeph["content"] zeph = decode_unicode_byte_strings(zeph) diff --git a/api/examples/curl-examples b/api/examples/curl-examples index aa74fd558d..3bf35f3ff5 100755 --- a/api/examples/curl-examples +++ b/api/examples/curl-examples @@ -4,7 +4,7 @@ curl https://humbughq.com/api/v1/send_message \ -d "api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -d "email=tabbott@humbughq.com" \ - -d "type=personal" -d "content=test" \ + -d "type=private" -d "content=test" \ -d "recipient=tabbott@humbughq.com" curl https://humbughq.com/api/v1/get_messages \ diff --git a/api/examples/send-message b/api/examples/send-message index 9c4e60f1da..ee1945b8ae 100755 --- a/api/examples/send-message +++ b/api/examples/send-message @@ -31,7 +31,7 @@ client = api.common.HumbugAPI(email=options.user, site=options.site) message_data = { - "type": "personal", + "type": "private", "content": "test", "recipient": "tabbott@humbughq.com", } diff --git a/templates/zephyr/home.html b/templates/zephyr/home.html index 4af291d3e7..3c069d2b93 100644 --- a/templates/zephyr/home.html +++ b/templates/zephyr/home.html @@ -92,10 +92,10 @@ value="" placeholder="Subject" autocomplete="off" tabindex="130"/> - + - You and @@ -109,7 +109,7 @@
  • - +
  • diff --git a/templates/zephyr/index.html b/templates/zephyr/index.html index f06d59858e..a17ff88d9f 100644 --- a/templates/zephyr/index.html +++ b/templates/zephyr/index.html @@ -123,7 +123,7 @@ var people_list = [
  • - + Feedback diff --git a/tools/review b/tools/review index 0ce9bf6e44..2802b8abd2 100755 --- a/tools/review +++ b/tools/review @@ -309,7 +309,7 @@ def main(args): site="https://staging.humbughq.com", api_key=file(api_key_file).read().strip(), verbose=True) - client.send_message({'type': "personal", + client.send_message({'type': "private", 'recipient': [opts.reviewers], 'content': "I just sent you a review request! Check your email for details."}) diff --git a/zephyr/jstemplates/message.html b/zephyr/jstemplates/message.html index 0e48c3c006..2ad606e961 100644 --- a/zephyr/jstemplates/message.html +++ b/zephyr/jstemplates/message.html @@ -46,7 +46,7 @@ {{/if}} {{/include_recipient}} + 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)