mirror of https://github.com/zulip/zulip.git
Track what user action triggered a compose
(imported from commit 3e23dd1f7e9e3a742b0c3b9e1b0eeb85cfa4c736)
This commit is contained in:
parent
a4bda36ab4
commit
c60a500a8f
|
@ -183,7 +183,8 @@ exports.start = function (msg_type, opts) {
|
||||||
message_type: msg_type,
|
message_type: msg_type,
|
||||||
stream: '',
|
stream: '',
|
||||||
subject: '',
|
subject: '',
|
||||||
private_message_recipient: ''
|
private_message_recipient: '',
|
||||||
|
trigger: 'unknown'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set default parameters based on the current narrowed view.
|
// Set default parameters based on the current narrowed view.
|
||||||
|
|
|
@ -183,13 +183,13 @@ function process_hotkey(e) {
|
||||||
compose.set_mode('private');
|
compose.set_mode('private');
|
||||||
return true;
|
return true;
|
||||||
case 13: // Enter: respond to message (unless we need to do something else)
|
case 13: // Enter: respond to message (unless we need to do something else)
|
||||||
respond_to_message();
|
respond_to_message({trigger: 'hotkey enter'});
|
||||||
return true;
|
return true;
|
||||||
case 114: // 'r': respond to message
|
case 114: // 'r': respond to message
|
||||||
respond_to_message();
|
respond_to_message({trigger: 'hotkey'});
|
||||||
return true;
|
return true;
|
||||||
case 82: // 'R': respond to author
|
case 82: // 'R': respond to author
|
||||||
respond_to_message("personal");
|
respond_to_message({reply_type: "personal", trigger: 'hotkey pm'});
|
||||||
return true;
|
return true;
|
||||||
case 47: // '/': initiate search
|
case 47: // '/': initiate search
|
||||||
search.initiate_search();
|
search.initiate_search();
|
||||||
|
|
|
@ -1052,7 +1052,7 @@ $(function () {
|
||||||
// Was a click (not a click-and-drag).
|
// Was a click (not a click-and-drag).
|
||||||
var row = $(this).closest(".message_row");
|
var row = $(this).closest(".message_row");
|
||||||
current_msg_list.select_id(rows.id(row));
|
current_msg_list.select_id(rows.id(row));
|
||||||
respond_to_message();
|
respond_to_message({trigger: 'message click'});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
mouse_moved = false;
|
mouse_moved = false;
|
||||||
|
@ -1214,7 +1214,8 @@ $(function () {
|
||||||
|
|
||||||
$('#user_presences').on('click', 'a', function (e) {
|
$('#user_presences').on('click', 'a', function (e) {
|
||||||
var email = $(e.target).attr('data-email');
|
var email = $(e.target).attr('data-email');
|
||||||
compose.start('private', {private_message_recipient: email});
|
compose.start('private', {private_message_recipient: email,
|
||||||
|
trigger: 'presence list'});
|
||||||
// The preventDefault is necessary so that clicking the
|
// The preventDefault is necessary so that clicking the
|
||||||
// link doesn't jump us to the top of the page.
|
// link doesn't jump us to the top of the page.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -1286,11 +1287,11 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.empty_feed_compose_stream').click(function (e) {
|
$('.empty_feed_compose_stream').click(function (e) {
|
||||||
compose.start('stream');
|
compose.start('stream', {trigger: 'empty feed message'});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('.empty_feed_compose_private').click(function (e) {
|
$('.empty_feed_compose_private').click(function (e) {
|
||||||
compose.start('private');
|
compose.start('private', {trigger: 'empty feed message'});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('.empty_feed_join').click(function (e) {
|
$('.empty_feed_join').click(function (e) {
|
||||||
|
@ -1301,12 +1302,14 @@ $(function () {
|
||||||
// Keep these 2 feedback bot triggers separate because they have to
|
// Keep these 2 feedback bot triggers separate because they have to
|
||||||
// propagate the event differently.
|
// propagate the event differently.
|
||||||
$('.feedback').click(function (e) {
|
$('.feedback').click(function (e) {
|
||||||
compose.start('private', { 'private_message_recipient': 'feedback@humbughq.com' });
|
compose.start('private', { 'private_message_recipient': 'feedback@humbughq.com',
|
||||||
|
trigger: 'feedback menu item' });
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#feedback_button').click(function (e) {
|
$('#feedback_button').click(function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
compose.start('private', { 'private_message_recipient': 'feedback@humbughq.com' });
|
compose.start('private', { 'private_message_recipient': 'feedback@humbughq.com',
|
||||||
|
trigger: 'feedback button' });
|
||||||
|
|
||||||
});
|
});
|
||||||
$('.logout_button').click(function (e) {
|
$('.logout_button').click(function (e) {
|
||||||
|
@ -1328,12 +1331,12 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.respond_button', function (e) {
|
$('body').on('click', '.respond_button', function (e) {
|
||||||
respond_to_message();
|
respond_to_message({trigger: 'popover respond'});
|
||||||
ui.hide_actions_popover();
|
ui.hide_actions_popover();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
$('body').on('click', '.respond_personal_button', function (e) {
|
$('body').on('click', '.respond_personal_button', function (e) {
|
||||||
respond_to_message('personal');
|
respond_to_message({reply_type: 'personal', trigger: 'popover respond pm'});
|
||||||
ui.hide_actions_popover();
|
ui.hide_actions_popover();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
@ -1419,7 +1422,7 @@ $(function () {
|
||||||
$('body').on('click', '.compose_to_stream', function (e) {
|
$('body').on('click', '.compose_to_stream', function (e) {
|
||||||
var stream = $(e.currentTarget).parents('ul').attr('data-name');
|
var stream = $(e.currentTarget).parents('ul').attr('data-name');
|
||||||
ui.hide_sidebar_popover();
|
ui.hide_sidebar_popover();
|
||||||
compose.start('stream', {"stream": stream});
|
compose.start('stream', {"stream": stream, trigger: 'sidebar stream actions'});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ function get_private_message_recipient(message, attr) {
|
||||||
return recipient;
|
return recipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
function respond_to_message(reply_type) {
|
function respond_to_message(opts) {
|
||||||
var message, msg_type;
|
var message, msg_type;
|
||||||
// Before initiating a reply to a message, if there's an
|
// Before initiating a reply to a message, if there's an
|
||||||
// in-progress composition, snapshot it.
|
// in-progress composition, snapshot it.
|
||||||
|
@ -190,20 +190,21 @@ function respond_to_message(reply_type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pm_recipient = message.reply_to;
|
var pm_recipient = message.reply_to;
|
||||||
if (reply_type === "personal" && message.type === "private") {
|
if (opts.reply_type === "personal" && message.type === "private") {
|
||||||
// reply_to for private messages is everyone involved, so for
|
// reply_to for private messages is everyone involved, so for
|
||||||
// personals replies we need to set the the private message
|
// personals replies we need to set the the private message
|
||||||
// recipient to just the sender
|
// recipient to just the sender
|
||||||
pm_recipient = message.sender_email;
|
pm_recipient = message.sender_email;
|
||||||
}
|
}
|
||||||
if (reply_type === 'personal' || message.type === 'private') {
|
if (opts.reply_type === 'personal' || message.type === 'private') {
|
||||||
msg_type = 'private';
|
msg_type = 'private';
|
||||||
} else {
|
} else {
|
||||||
msg_type = message.type;
|
msg_type = message.type;
|
||||||
}
|
}
|
||||||
compose.start(msg_type, {'stream': stream, 'subject': subject,
|
compose.start(msg_type, {'stream': stream, 'subject': subject,
|
||||||
'private_message_recipient': pm_recipient,
|
'private_message_recipient': pm_recipient,
|
||||||
'replying_to_message': message});
|
'replying_to_message': message,
|
||||||
|
'trigger': opts.trigger});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns messages from the given message list in the specified range, inclusive
|
// Returns messages from the given message list in the specified range, inclusive
|
||||||
|
|
Loading…
Reference in New Issue