mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Move respond_to_message to compose.js.
This commit is contained in:
		@@ -598,6 +598,46 @@ function send_message(request) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.respond_to_message = function (opts) {
 | 
			
		||||
    var message, msg_type;
 | 
			
		||||
    // Before initiating a reply to a message, if there's an
 | 
			
		||||
    // in-progress composition, snapshot it.
 | 
			
		||||
    compose.snapshot_message();
 | 
			
		||||
 | 
			
		||||
    message = current_msg_list.selected_message();
 | 
			
		||||
 | 
			
		||||
    if (message === undefined) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    unread.mark_message_as_read(message);
 | 
			
		||||
 | 
			
		||||
    var stream = '';
 | 
			
		||||
    var subject = '';
 | 
			
		||||
    if (message.type === "stream") {
 | 
			
		||||
        stream = message.stream;
 | 
			
		||||
        subject = message.subject;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var pm_recipient = message.reply_to;
 | 
			
		||||
    if (opts.reply_type === "personal" && message.type === "private") {
 | 
			
		||||
        // reply_to for private messages is everyone involved, so for
 | 
			
		||||
        // personals replies we need to set the the private message
 | 
			
		||||
        // recipient to just the sender
 | 
			
		||||
        pm_recipient = message.sender_email;
 | 
			
		||||
    }
 | 
			
		||||
    if (opts.reply_type === 'personal' || message.type === 'private') {
 | 
			
		||||
        msg_type = 'private';
 | 
			
		||||
    } else {
 | 
			
		||||
        msg_type = message.type;
 | 
			
		||||
    }
 | 
			
		||||
    compose.start(msg_type, {'stream': stream, 'subject': subject,
 | 
			
		||||
                             'private_message_recipient': pm_recipient,
 | 
			
		||||
                             'replying_to_message': message,
 | 
			
		||||
                             'trigger': opts.trigger});
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// This function is for debugging / data collection only.  Arguably it
 | 
			
		||||
// should live in debug.js, but then it wouldn't be able to call
 | 
			
		||||
// send_message() directly below.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user