mirror of https://github.com/zulip/zulip.git
web-src: Update comments with "private message" or "PM".
Updates comments in files the `web/src` directory to use "direct message" instead of "private message" or "PM".
This commit is contained in:
parent
5be0f80135
commit
4d3d9bcefa
|
@ -74,7 +74,7 @@ export function compare_function(a, b) {
|
|||
return diff;
|
||||
}
|
||||
|
||||
// Sort equivalent PM names alphabetically
|
||||
// Sort equivalent direct message names alphabetically
|
||||
const person_a = people.get_by_user_id(a);
|
||||
const person_b = people.get_by_user_id(b);
|
||||
|
||||
|
@ -188,8 +188,8 @@ export function get_title_data(user_ids_string, is_group) {
|
|||
};
|
||||
}
|
||||
|
||||
// For buddy list and individual PMS. Since is_group=False, it's
|
||||
// a single, human, user.
|
||||
// For buddy list and individual direct messages.
|
||||
// Since is_group=False, it's a single, human user.
|
||||
const last_seen = user_last_seen_time_status(user_id);
|
||||
const is_my_user = people.is_my_user_id(user_id);
|
||||
|
||||
|
|
|
@ -584,7 +584,7 @@ export function initialize() {
|
|||
);
|
||||
});
|
||||
|
||||
// PM LIST TOOLTIPS (not displayed on touch devices)
|
||||
// DIRECT MESSAGE LIST TOOLTIPS (not displayed on touch devices)
|
||||
$("body").on("mouseenter", ".pm_user_status", (e) => {
|
||||
e.stopPropagation();
|
||||
const $elem = $(e.currentTarget);
|
||||
|
@ -617,12 +617,12 @@ export function initialize() {
|
|||
);
|
||||
});
|
||||
|
||||
// Recent conversations PMs (Not displayed on small widths)
|
||||
// Recent conversations direct messages (Not displayed on small widths)
|
||||
$("body").on("mouseenter", ".recent_topic_stream .pm_status_icon", (e) => {
|
||||
e.stopPropagation();
|
||||
const $elem = $(e.currentTarget);
|
||||
const user_ids_string = $elem.attr("data-user-ids-string");
|
||||
// Don't show tooltip for group PMs.
|
||||
// Don't show tooltip for group direct messages.
|
||||
if (!user_ids_string || user_ids_string.split(",").length !== 1) {
|
||||
return;
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ export function initialize() {
|
|||
".private_messages_container.zoom-out #private_messages_section_header",
|
||||
(e) => {
|
||||
if (e.target.classList.value === "fa fa-align-right") {
|
||||
// Let the browser handle the "all private messages" widget.
|
||||
// Let the browser handle the "all direct messages" widget.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ export function initialize() {
|
|||
const scroll_position = $left_sidebar_scrollbar.scrollTop();
|
||||
|
||||
// This next bit of logic is a bit subtle; this header
|
||||
// button scrolls to the top of the private messages
|
||||
// button scrolls to the top of the direct messages
|
||||
// section is uncollapsed but out of view; otherwise, we
|
||||
// toggle its collapsed state.
|
||||
if (scroll_position === 0 || pm_list.is_private_messages_collapsed()) {
|
||||
|
|
|
@ -144,10 +144,10 @@ export function create_message_object() {
|
|||
message.private_message_recipient = recipient;
|
||||
message.to_user_ids = people.email_list_to_user_ids_string(emails);
|
||||
|
||||
// Note: The `undefined` case is for situations like the
|
||||
// is_zephyr_mirror_realm case where users may be
|
||||
// automatically created when you try to send a private
|
||||
// message to their email address.
|
||||
// Note: The `undefined` case is for situations like
|
||||
// the is_zephyr_mirror_realm case where users may
|
||||
// be automatically created when you try to send a
|
||||
// direct message to their email address.
|
||||
if (message.to_user_ids !== undefined) {
|
||||
message.to = people.user_ids_string_to_ids_array(message.to_user_ids);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ export function start(msg_type, opts) {
|
|||
|
||||
// If we are invoked by a compose hotkey (c or x) or new topic
|
||||
// button, do not assume that we know what the message's topic or
|
||||
// PM recipient should be.
|
||||
// direct message recipient should be.
|
||||
if (
|
||||
opts.trigger === "compose_hotkey" ||
|
||||
opts.trigger === "new topic button" ||
|
||||
|
@ -353,7 +353,7 @@ export function respond_to_message(opts) {
|
|||
}
|
||||
|
||||
// Important note: A reply_type of 'personal' is for the R hotkey
|
||||
// (replying to a message's sender with a private message). All
|
||||
// (replying to a message's sender with a direct message). All
|
||||
// other replies can just copy message.type.
|
||||
if (opts.reply_type === "personal" || message.type === "private") {
|
||||
msg_type = "private";
|
||||
|
@ -370,8 +370,8 @@ export function respond_to_message(opts) {
|
|||
} else {
|
||||
pm_recipient = message.reply_to;
|
||||
if (opts.reply_type === "personal") {
|
||||
// reply_to for private messages is everyone involved, so for
|
||||
// personals replies we need to set the private message
|
||||
// reply_to for direct messages is everyone involved, so for
|
||||
// personals replies we need to set the direct message
|
||||
// recipient to just the sender
|
||||
pm_recipient = people.get_by_user_id(message.sender_id).email;
|
||||
} else {
|
||||
|
@ -497,9 +497,9 @@ export function quote_and_reply(opts) {
|
|||
}
|
||||
|
||||
export function on_narrow(opts) {
|
||||
// We use force_close when jumping between PM narrows with the "p" key,
|
||||
// so that we don't have an open compose box that makes it difficult
|
||||
// to cycle quickly through unread messages.
|
||||
// We use force_close when jumping between direct message narrows with
|
||||
// the "p" key, so that we don't have an open compose box that makes
|
||||
// it difficult to cycle quickly through unread messages.
|
||||
if (opts.force_close) {
|
||||
// This closes the compose box if it was already open, and it is
|
||||
// basically a noop otherwise.
|
||||
|
@ -532,7 +532,7 @@ export function on_narrow(opts) {
|
|||
return;
|
||||
}
|
||||
// Do not open compose box if organization has disabled sending
|
||||
// private messages and recipient is not a bot.
|
||||
// direct messages and recipient is not a bot.
|
||||
if (
|
||||
page_params.realm_private_message_policy ===
|
||||
settings_config.private_message_policy_values.disabled.code &&
|
||||
|
@ -540,7 +540,7 @@ export function on_narrow(opts) {
|
|||
) {
|
||||
const emails = opts.private_message_recipient.split(",");
|
||||
if (emails.length !== 1 || !people.get_by_email(emails[0]).is_bot) {
|
||||
// If we are navigating between private message conversations,
|
||||
// If we are navigating between direct message conversations,
|
||||
// we want the compose box to close for non-bot users.
|
||||
if (compose_state.composing()) {
|
||||
cancel();
|
||||
|
|
|
@ -16,8 +16,8 @@ export function get_recipient_label(message) {
|
|||
if (message === undefined) {
|
||||
if (message_lists.current.visibly_empty()) {
|
||||
// For empty narrows where there's a clear reply target,
|
||||
// i.e. stream+topic or a single PM conversation, we label
|
||||
// the button as replying to the thread.
|
||||
// i.e. stream+topic or a single direct message conversation,
|
||||
// we label the button as replying to the thread.
|
||||
if (narrow_state.narrowed_to_topic()) {
|
||||
message = {
|
||||
stream: narrow_state.stream(),
|
||||
|
|
|
@ -34,7 +34,7 @@ export function would_receive_message(user_id) {
|
|||
return stream_data.is_user_subscribed(focused_recipient.stream_id, user_id);
|
||||
}
|
||||
|
||||
// PM, so check if the given email is in the recipients list.
|
||||
// Direct message, so check if the given email is in the recipients list.
|
||||
return is_pm_recipient(user_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,7 @@ export function update_placeholder_text() {
|
|||
message_type: compose_state.get_message_type(),
|
||||
stream: compose_state.stream_name(),
|
||||
topic: compose_state.topic(),
|
||||
// TODO: to remove a circular import, PM recipient needs
|
||||
// TODO: to remove a circular import, direct message recipient needs
|
||||
// to be calculated in compose_state instead of compose_pm_pill.
|
||||
private_message_recipient: compose_pm_pill.get_emails(),
|
||||
};
|
||||
|
|
|
@ -227,7 +227,7 @@ export function compute_placeholder_text(opts) {
|
|||
}
|
||||
}
|
||||
|
||||
// For private messages
|
||||
// For direct messages
|
||||
if (opts.private_message_recipient) {
|
||||
const recipient_list = opts.private_message_recipient.split(",");
|
||||
const recipient_names = recipient_list
|
||||
|
|
|
@ -38,7 +38,7 @@ import {user_settings} from "./user_settings";
|
|||
// highlighter that escapes (i.e. one that calls
|
||||
// typeahead_helper.highlight_with_escaping).
|
||||
|
||||
// This is what we use for PM/compose typeaheads.
|
||||
// This is what we use for direct message/compose typeaheads.
|
||||
// We export it to allow tests to mock it.
|
||||
export const max_num_items = 8;
|
||||
|
||||
|
|
|
@ -498,7 +498,7 @@ function filter_drafts_by_compose_box_and_recipient(drafts) {
|
|||
else if (draft.type === "stream" && stream_id && !topic && draft.stream_id === stream_id) {
|
||||
narrow_drafts_ids.push(id);
|
||||
}
|
||||
// Match by private message recipient.
|
||||
// Match by direct message recipient.
|
||||
else if (
|
||||
draft.type === "private" &&
|
||||
private_recipients &&
|
||||
|
|
|
@ -171,7 +171,7 @@ export function build_display_recipient(message) {
|
|||
|
||||
if (!sender_in_display_recipients) {
|
||||
// Ensure that the current user is included in
|
||||
// display_recipient for group PMs.
|
||||
// display_recipient for group direct messages.
|
||||
display_recipient.push({
|
||||
id: message.sender_id,
|
||||
email: message.sender_email,
|
||||
|
|
|
@ -36,7 +36,7 @@ export function process_new_message(message) {
|
|||
message.status_emoji_info = user_status.get_status_emoji(message.sender_id);
|
||||
}
|
||||
|
||||
// Convert topic even for PMs, as legacy code
|
||||
// Convert topic even for direct messages, as legacy code
|
||||
// wants the empty field.
|
||||
util.convert_message_topic(message);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ export class MessageListData {
|
|||
|
||||
messages_filtered_for_user_mutes(messages) {
|
||||
if (this.filter.is_non_huddle_pm()) {
|
||||
// We are in a 1:1 PM narrow, so do not do any filtering.
|
||||
// We are in a 1:1 direct message narrow, so do not do any filtering.
|
||||
return [...messages];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
We keep a set of user_ids for all people
|
||||
who have sent stream messages or who have
|
||||
been on PMs sent by the user.
|
||||
been on direct messages sent by the user.
|
||||
|
||||
We will use this in search to prevent really
|
||||
large result sets for realms that have lots
|
||||
|
|
|
@ -315,7 +315,8 @@ export function narrowed_by_topic_reply() {
|
|||
}
|
||||
|
||||
// We auto-reply under certain conditions, namely when you're narrowed
|
||||
// to a PM (or huddle), and when you're narrowed to some stream/topic pair
|
||||
// to a 1:1 or group direct message conversation, and when you're
|
||||
// narrowed to some stream/topic pair.
|
||||
export function narrowed_by_reply() {
|
||||
return narrowed_by_pm_reply() || narrowed_by_topic_reply();
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ export function update_unread_counts(counts) {
|
|||
window.electron_bridge.send_event("total_unread_count", unread_count);
|
||||
}
|
||||
|
||||
// TODO: Add a `window.electron_bridge.updatePMCount(new_pm_count);` call?
|
||||
// TODO: Add a `window.electron_bridge.updateDirectMessageCount(new_pm_count);` call?
|
||||
|
||||
redraw_title();
|
||||
}
|
||||
|
@ -376,13 +376,13 @@ export function should_send_desktop_notification(message) {
|
|||
}
|
||||
|
||||
// enable_desktop_notifications determines whether we pop up a
|
||||
// notification for PMs/mentions/alerts
|
||||
// notification for direct messages, mentions, and/or alerts.
|
||||
if (!user_settings.enable_desktop_notifications) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// And then we need to check if the message is a PM, mention,
|
||||
// wildcard mention with wildcard_mentions_notify, or alert.
|
||||
// And then we need to check if the message is a direct message,
|
||||
// mention, wildcard mention with wildcard_mentions_notify, or alert.
|
||||
if (message.type === "private") {
|
||||
return true;
|
||||
}
|
||||
|
@ -422,13 +422,14 @@ export function should_send_audible_notification(message) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// enable_sounds determines whether we ding for PMs/mentions/alerts
|
||||
// enable_sounds determines whether we ding for direct messages,
|
||||
// mentions, and/or alerts.
|
||||
if (!user_settings.enable_sounds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// And then we need to check if the message is a PM, mention,
|
||||
// wildcard mention with wildcard_mentions_notify, or alert.
|
||||
// And then we need to check if the message is a direct message,
|
||||
// mention, wildcard mention with wildcard_mentions_notify, or alert.
|
||||
if (message.type === "private" || message.type === "test-notification") {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -237,11 +237,11 @@ export function get_participants_from_user_ids_string(user_ids_string) {
|
|||
let user_ids = user_ids_string_to_ids_array(user_ids_string);
|
||||
// Convert to set to ensure there are no duplicate ids.
|
||||
user_ids = new Set(user_ids);
|
||||
// For group PMs or 1:1 private messages, the user_ids_string
|
||||
// contains just the other user, so we need to add ourselves if not
|
||||
// already present. For PM to self, the current user is already present,
|
||||
// in user_ids_string, so we don't need to add it which is take care of
|
||||
// by user_ids being a `Set`.
|
||||
// For group or 1:1 direct messages, the user_ids_string contains
|
||||
// just the other user, so we need to add ourselves if not already
|
||||
// present. For a direct message to oneself, the current user is
|
||||
// already present, in user_ids_string, so we don't need to add it
|
||||
// which is take care of by user_ids being a `Set`.
|
||||
user_ids.add(my_user_id);
|
||||
return user_ids;
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ export function get_recipients(user_ids_string) {
|
|||
const {other_ids} = _calc_user_and_other_ids(user_ids_string);
|
||||
|
||||
if (other_ids.length === 0) {
|
||||
// private message with oneself
|
||||
// direct message with oneself
|
||||
return my_full_name();
|
||||
}
|
||||
|
||||
|
@ -453,8 +453,8 @@ export function concat_huddle(user_ids, user_id) {
|
|||
export function pm_lookup_key_from_user_ids(user_ids) {
|
||||
/*
|
||||
The server will sometimes include our own user id
|
||||
in keys for PMs, but we only want our user id if
|
||||
we sent a message to ourself.
|
||||
in keys for direct messages, but we only want our
|
||||
user id if we sent a direct message to ourself.
|
||||
*/
|
||||
user_ids = sorted_other_user_ids(user_ids);
|
||||
return user_ids.join(",");
|
||||
|
@ -579,7 +579,8 @@ export function pm_with_operand_ids(operand) {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
// If your email is included in a PM group with other people, just ignore it
|
||||
// If your email is included in a group direct message with other people,
|
||||
// then ignore it.
|
||||
if (persons.length > 1) {
|
||||
const my_user = people_by_user_id_dict.get(my_user_id);
|
||||
persons = persons.filter((person) => person !== my_user);
|
||||
|
@ -616,9 +617,9 @@ export function emails_to_slug(emails_string) {
|
|||
export function slug_to_emails(slug) {
|
||||
/*
|
||||
It's not super important to be flexible about
|
||||
PM-related slugs, since you would rarely post
|
||||
them to the web, but we we do want to support
|
||||
reasonable variations:
|
||||
direct message related slugs, since you would
|
||||
rarely post them to the web, but we we do want
|
||||
to support reasonable variations:
|
||||
|
||||
99-alice@example.com
|
||||
99
|
||||
|
@ -685,7 +686,7 @@ export function user_can_direct_message(recipient_ids_string) {
|
|||
// message to the target user (or group of users) represented by a
|
||||
// user ids string.
|
||||
|
||||
// Regardless of policy, we allow sending private messages to bots.
|
||||
// Regardless of policy, we allow sending direct messages to bots.
|
||||
const recipient_ids = user_ids_string_to_ids_array(recipient_ids_string);
|
||||
if (recipient_ids.length === 1 && user_is_bot(recipient_ids[0])) {
|
||||
return true;
|
||||
|
@ -971,8 +972,8 @@ export function get_recipient_count(person) {
|
|||
For searching in the search bar, we will
|
||||
have true `person` objects with `user_id`.
|
||||
|
||||
Likewise, we'll have user_id if we
|
||||
are tab-completing a user to send a PM
|
||||
Likewise, we'll have user_id if we are
|
||||
tab-completing a user to send a direct message
|
||||
to (but we only get called if we're not
|
||||
currently in a stream view).
|
||||
|
||||
|
@ -1002,15 +1003,17 @@ export function get_message_people() {
|
|||
/*
|
||||
message_people are roughly the people who have
|
||||
actually sent messages that are currently
|
||||
showing up on your feed. These people
|
||||
showing up on your feed. These people
|
||||
are important--we give them preference
|
||||
over other users in certain search
|
||||
suggestions, since non-message-people are
|
||||
presumably either not very active or
|
||||
possibly subscribed to streams you don't
|
||||
care about. message_people also includes
|
||||
people whom you have sent PMs, but look
|
||||
at the message_store code to see the precise
|
||||
care about.
|
||||
|
||||
message_people also includes people whom
|
||||
you have sent direct messages, but look at
|
||||
the message_store code to see the precise
|
||||
semantics
|
||||
*/
|
||||
const message_people = util.try_parse_as_truthy(
|
||||
|
@ -1263,7 +1266,7 @@ export function add_cross_realm_user(person) {
|
|||
export function deactivate(person) {
|
||||
// We don't fully remove a person from all of our data
|
||||
// structures, because deactivated users can be part
|
||||
// of somebody's PM list.
|
||||
// of somebody's direct message list.
|
||||
active_user_dict.delete(person.user_id);
|
||||
non_active_user_dict.set(person.user_id, person);
|
||||
}
|
||||
|
@ -1362,7 +1365,8 @@ export function maybe_incr_recipient_count(message) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Track the number of PMs we've sent to this person to improve autocomplete
|
||||
// Track the number of direct messages we've sent to this person
|
||||
// to improve autocomplete
|
||||
for (const recip of message.display_recipient) {
|
||||
if (recip.unknown_local_echo_user) {
|
||||
continue;
|
||||
|
|
|
@ -33,7 +33,7 @@ class RecentDirectMessages {
|
|||
|
||||
insert(user_ids, message_id) {
|
||||
if (user_ids.length === 0) {
|
||||
// The server sends [] for self-PMs.
|
||||
// The server sends [] for direct messages to oneself.
|
||||
user_ids = [people.my_current_user_id()];
|
||||
}
|
||||
user_ids.sort((a, b) => a - b);
|
||||
|
|
|
@ -11,12 +11,12 @@ import * as vdom from "./vdom";
|
|||
|
||||
let prior_dom;
|
||||
|
||||
// This module manages the "Private messages" section in the upper
|
||||
// This module manages the direct messages section in the upper
|
||||
// left corner of the app. This was split out from stream_list.js.
|
||||
|
||||
let private_messages_collapsed = false;
|
||||
|
||||
// The private messages section can be zoomed in to view more messages.
|
||||
// The direct messages section can be zoomed in to view more messages.
|
||||
// This keeps track of if we're zoomed in or not.
|
||||
let zoomed = false;
|
||||
|
||||
|
@ -94,7 +94,8 @@ export function update_private_messages() {
|
|||
const new_dom = _build_private_messages_list();
|
||||
set_dom_to(new_dom);
|
||||
}
|
||||
// Make sure to update the left sidebar heights after updating PMs.
|
||||
// Make sure to update the left sidebar heights after updating
|
||||
// direct messages.
|
||||
setTimeout(resize.resize_stream_filters_container, 0);
|
||||
}
|
||||
|
||||
|
@ -115,7 +116,8 @@ export function update_dom_with_unread_counts(counts) {
|
|||
// In theory, we could support passing the counts object through
|
||||
// to pm_list_data, rather than fetching it directly there. But
|
||||
// it's not an important optimization, because it's unlikely a
|
||||
// user would have 10,000s of unread PMs where it could matter.
|
||||
// user would have 10,000s of unread direct messages where it
|
||||
// could matter.
|
||||
update_private_messages();
|
||||
// This is just the global unread count.
|
||||
set_count(counts.private_message_count);
|
||||
|
@ -180,7 +182,8 @@ export function is_private_messages_collapsed() {
|
|||
}
|
||||
|
||||
export function toggle_private_messages_section() {
|
||||
// change the state of PM section depending on the previous state.
|
||||
// change the state of direct message section depending on
|
||||
// the previous state.
|
||||
if (private_messages_collapsed) {
|
||||
expand();
|
||||
} else {
|
||||
|
|
|
@ -148,7 +148,7 @@ function get_row_type(row) {
|
|||
}
|
||||
|
||||
function get_max_selectable_cols(row) {
|
||||
// returns maximum number of columns in stream message or private message row.
|
||||
// returns maximum number of columns in stream message or direct message row.
|
||||
const type = get_row_type(row);
|
||||
if (type === "private") {
|
||||
return MAX_SELECTABLE_DIRECT_MESSAGE_COLS;
|
||||
|
@ -411,7 +411,7 @@ function format_conversation(conversation_data) {
|
|||
extra_sender_ids = all_senders.slice(0, -MAX_AVATAR);
|
||||
displayed_other_senders = extra_sender_ids.slice(-MAX_EXTRA_SENDERS);
|
||||
} else if (type === "private") {
|
||||
// Private message info
|
||||
// Direct message info
|
||||
context.user_ids_string = last_msg.to_user_ids;
|
||||
context.rendered_pm_with = last_msg.display_recipient
|
||||
.filter(
|
||||
|
@ -446,8 +446,9 @@ function format_conversation(conversation_data) {
|
|||
// Display in most recent sender first order.
|
||||
// To match the behavior for streams, we display the set of users who've actually
|
||||
// participated, with the most recent participants first. It could make sense to
|
||||
// display the other recipients on the PM conversation with different styling,
|
||||
// but it's important to not destroy the information of "who's actually talked".
|
||||
// display the other recipients on the direct message conversation with different
|
||||
// styling, but it's important to not destroy the information of "who's actually
|
||||
// talked".
|
||||
all_senders = recent_senders
|
||||
.get_pm_recent_senders(context.user_ids_string)
|
||||
.participants.reverse();
|
||||
|
@ -1051,7 +1052,7 @@ function page_down_navigation() {
|
|||
|
||||
function check_row_type_transition(row, col) {
|
||||
// This function checks if the row is transitioning
|
||||
// from type "Private messages" to "Stream" or vice versa.
|
||||
// from type "Direct messages" to "Stream" or vice versa.
|
||||
// This helps in setting the col_focus as maximum column
|
||||
// of both the type are different.
|
||||
if (row < 0) {
|
||||
|
@ -1312,7 +1313,7 @@ export function initialize() {
|
|||
focus_clicked_element(topic_row_index, COLUMNS.read);
|
||||
const user_ids_string = $elt.attr("data-user-ids-string");
|
||||
if (user_ids_string) {
|
||||
// PM row
|
||||
// direct message row
|
||||
unread_ops.mark_pm_as_read(user_ids_string);
|
||||
} else {
|
||||
// Stream row
|
||||
|
|
|
@ -32,7 +32,7 @@ export function get_topic_key(stream_id, topic) {
|
|||
|
||||
export function get_key_from_message(msg) {
|
||||
if (msg.type === "private") {
|
||||
// The to_user_ids field on a private message object is a
|
||||
// The to_user_ids field on a direct message object is a
|
||||
// string containing the user IDs involved in the message in
|
||||
// sorted order.
|
||||
return msg.to_user_ids;
|
||||
|
|
|
@ -23,7 +23,7 @@ export function update_scheduled_messages_row() {
|
|||
}
|
||||
|
||||
export function update_dom_with_unread_counts(counts, skip_animations) {
|
||||
// Note that "Private messages" counts are handled in pm_list.js.
|
||||
// Note that direct message counts are handled in pm_list.js.
|
||||
|
||||
// mentioned/home have simple integer counts
|
||||
const $mentioned_li = $(".top_left_mentions");
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as stream_list_sort from "./stream_list_sort";
|
|||
import * as user_groups from "./user_groups";
|
||||
import * as user_status from "./user_status";
|
||||
import * as util from "./util";
|
||||
// Returns an array of private message recipients, removing empty elements.
|
||||
// Returns an array of direct message recipients, removing empty elements.
|
||||
// For example, "a,,b, " => ["a", "b"]
|
||||
export function get_cleaned_pm_recipients(query_string) {
|
||||
let recipients = util.extract_pm_recipients(query_string);
|
||||
|
@ -220,7 +220,7 @@ export function compare_people_for_relevance(
|
|||
}
|
||||
}
|
||||
|
||||
// give preference to pm partners if both (are)/(are not) subscribers
|
||||
// give preference to direct message partners if both (are)/(are not) subscribers
|
||||
const a_is_partner = pm_conversations.is_partner(person_a.user_id);
|
||||
const b_is_partner = pm_conversations.is_partner(person_b.user_id);
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ export function initialize_everything() {
|
|||
- tracking all streams
|
||||
- tracking presence data
|
||||
- tracking user groups and bots
|
||||
- tracking recent PMs
|
||||
- tracking recent direct messages
|
||||
|
||||
Using stream data as an example, we use a
|
||||
module called `stream_data` to actually track
|
||||
|
|
|
@ -414,7 +414,7 @@ class UnreadTopicCounter {
|
|||
for (const message_id of unread_mentions_counter) {
|
||||
const stream_id = this.bucketer.reverse_lookup.get(message_id);
|
||||
if (stream_id === undefined) {
|
||||
// This is a private message containing a mention.
|
||||
// This is a direct message containing a mention.
|
||||
continue;
|
||||
}
|
||||
streams_with_mentions.add(stream_id);
|
||||
|
@ -431,7 +431,7 @@ class UnreadTopicCounter {
|
|||
for (const message_id of unread_mentions_counter) {
|
||||
const stream_id = this.bucketer.reverse_lookup.get(message_id);
|
||||
if (stream_id === undefined) {
|
||||
// This is a private message containing a mention.
|
||||
// This is a direct message containing a mention.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ function add_message_to_unread_mention_topics(message_id) {
|
|||
function remove_message_from_unread_mention_topics(message_id) {
|
||||
const stream_id = unread_topic_counter.bucketer.reverse_lookup.get(message_id);
|
||||
if (!stream_id) {
|
||||
// Private messages and messages that were already not unread
|
||||
// Direct messages and messages that were already not unread
|
||||
// exit here.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,9 @@ export function update_unread_counts(skip_animations = false) {
|
|||
// Set the unread counts that we show in the buttons that
|
||||
// toggle open the sidebar menus when we have a thin window.
|
||||
set_count_toggle_button($("#streamlist-toggle-unreadcount"), res.home_unread_messages);
|
||||
// Bots and group PMs do not appear in the right sidebar user list, so
|
||||
// we show unread count for only non bot 1:1 private messages there.
|
||||
// Bots and group direct messages do not appear in the right
|
||||
// sidebar user list, so we show unread counts for only non-bot,
|
||||
// 1:1 direct messages there.
|
||||
set_count_toggle_button(
|
||||
$("#userlist-toggle-unreadcount"),
|
||||
res.right_sidebar_private_message_count,
|
||||
|
|
|
@ -4,8 +4,8 @@ import {page_params} from "./page_params";
|
|||
import * as people from "./people";
|
||||
import * as user_status from "./user_status";
|
||||
|
||||
// This will be used for pills for things like composing PMs
|
||||
// or adding users to a stream/group.
|
||||
// This will be used for pills for things like composing
|
||||
// direct messages or adding users to a stream/group.
|
||||
|
||||
export function create_item_from_email(email, current_items) {
|
||||
// For normal Zulip use, we need to validate the email for our realm.
|
||||
|
|
|
@ -69,8 +69,8 @@ export function extract_pm_recipients(recipients: string): string[] {
|
|||
return recipients.split(/\s*[,;]\s*/).filter((recipient) => recipient.trim() !== "");
|
||||
}
|
||||
|
||||
// When the type is "private", properties from PMRecipient, namely to_user_ids might be
|
||||
// undefined. See https://github.com/zulip/zulip/pull/23032#discussion_r1038480596.
|
||||
// When the type is "private", properties from to_user_ids might be undefined.
|
||||
// See https://github.com/zulip/zulip/pull/23032#discussion_r1038480596.
|
||||
type Recipient = {to_user_ids?: string; type: "private"} | (StreamTopic & {type: "stream"});
|
||||
|
||||
export const same_recipient = function util_same_recipient(a?: Recipient, b?: Recipient): boolean {
|
||||
|
|
Loading…
Reference in New Issue