mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
zephyr.js: Combine get_huddle_recipient{,_names}
(imported from commit dcb4c32250f4ff3a3cf32d999d6469916b17b06e)
This commit is contained in:
@@ -119,7 +119,7 @@ function scroll_to_selected() {
|
|||||||
recenter_view(selected_message);
|
recenter_view(selected_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_huddle_recipient(message) {
|
function get_huddle_recipient(message, attr) {
|
||||||
var recipient, i;
|
var recipient, i;
|
||||||
var other_recipients = $.grep(message.display_recipient,
|
var other_recipients = $.grep(message.display_recipient,
|
||||||
function (element, index) {
|
function (element, index) {
|
||||||
@@ -127,30 +127,12 @@ function get_huddle_recipient(message) {
|
|||||||
});
|
});
|
||||||
if (other_recipients.length === 0) {
|
if (other_recipients.length === 0) {
|
||||||
// huddle with oneself
|
// huddle with oneself
|
||||||
return message.display_recipient[0].email;
|
return message.display_recipient[0][attr];
|
||||||
}
|
}
|
||||||
|
|
||||||
recipient = other_recipients[0].email;
|
recipient = other_recipients[0][attr];
|
||||||
for (i = 1; i < other_recipients.length; i++) {
|
for (i = 1; i < other_recipients.length; i++) {
|
||||||
recipient += ', ' + other_recipients[i].email;
|
recipient += ', ' + other_recipients[i][attr];
|
||||||
}
|
|
||||||
return recipient;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_huddle_recipient_names(message) {
|
|
||||||
var recipient, i;
|
|
||||||
var other_recipients = $.grep(message.display_recipient,
|
|
||||||
function (element, index) {
|
|
||||||
return element.email !== email;
|
|
||||||
});
|
|
||||||
if (other_recipients.length === 0) {
|
|
||||||
// huddle with oneself
|
|
||||||
return message.display_recipient[0].full_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
recipient = other_recipients[0].full_name;
|
|
||||||
for (i = 1; i < other_recipients.length; i++) {
|
|
||||||
recipient += ', ' + other_recipients[i].full_name;
|
|
||||||
}
|
}
|
||||||
return recipient;
|
return recipient;
|
||||||
}
|
}
|
||||||
@@ -435,8 +417,8 @@ function add_message_metadata(dummy, message) {
|
|||||||
|
|
||||||
case 'huddle':
|
case 'huddle':
|
||||||
message.is_huddle = true;
|
message.is_huddle = true;
|
||||||
message.reply_to = get_huddle_recipient(message);
|
message.reply_to = get_huddle_recipient(message, 'email');
|
||||||
message.display_reply_to = get_huddle_recipient_names(message);
|
message.display_reply_to = get_huddle_recipient(message, 'full_name');
|
||||||
|
|
||||||
involved_people = message.display_recipient;
|
involved_people = message.display_recipient;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user