mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	recent_topics: Remove old rendered topic row on topic edit.
We remove all trace of the old topic and reprocess all the new messages in old and new topics. process_topic_edit function was moved since it needs to be below get_topic_row function.
This commit is contained in:
		@@ -59,18 +59,6 @@ exports.get = function () {
 | 
			
		||||
    return get_sorted_topics();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.process_topic_edit = function (old_stream_id, old_topic, new_topic, new_stream_id) {
 | 
			
		||||
    // See `recent_senders.process_topic_edit` for
 | 
			
		||||
    // logic behind this and important notes on use of this function.
 | 
			
		||||
    topics.delete(old_stream_id + ':' + old_topic);
 | 
			
		||||
 | 
			
		||||
    const old_topic_msgs = message_util.get_messages_in_topic(old_stream_id, old_topic);
 | 
			
		||||
    exports.process_messages(old_topic_msgs);
 | 
			
		||||
 | 
			
		||||
    new_stream_id = new_stream_id || old_stream_id;
 | 
			
		||||
    const new_topic_msgs = message_util.get_messages_in_topic(new_stream_id, new_topic);
 | 
			
		||||
    exports.process_messages(new_topic_msgs);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function format_topic(topic_data) {
 | 
			
		||||
    const last_msg = message_store.get(topic_data.last_msg_id);
 | 
			
		||||
@@ -128,6 +116,20 @@ function get_topic_row(topic_key) {
 | 
			
		||||
    return $("#" + $.escapeSelector("recent_topic:" + topic_key));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.process_topic_edit = function (old_stream_id, old_topic, new_topic, new_stream_id) {
 | 
			
		||||
    // See `recent_senders.process_topic_edit` for
 | 
			
		||||
    // logic behind this and important notes on use of this function.
 | 
			
		||||
    topics.delete(old_stream_id + ':' + old_topic);
 | 
			
		||||
    get_topic_row(old_stream_id + ':' + old_topic).remove();
 | 
			
		||||
 | 
			
		||||
    const old_topic_msgs = message_util.get_messages_in_topic(old_stream_id, old_topic);
 | 
			
		||||
    exports.process_messages(old_topic_msgs);
 | 
			
		||||
 | 
			
		||||
    new_stream_id = new_stream_id || old_stream_id;
 | 
			
		||||
    const new_topic_msgs = message_util.get_messages_in_topic(new_stream_id, new_topic);
 | 
			
		||||
    exports.process_messages(new_topic_msgs);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.inplace_rerender = function (topic_key) {
 | 
			
		||||
    // We remove topic from the UI and reinsert it.
 | 
			
		||||
    // This makes sure we maintain the correct order
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user