mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	frontend: Change 'reply' button label to reflect selected message.
The 'reply' button shows the stream>topic or recipient(s) of the selected message, for better UX. It also expands to fill the remaining horizontal space in the button bar -- this should help make it easier for new users to figure out how to reply. Finally, it uses "Message" instead of "Reply", to better match the compose box. Fixes #17940.
This commit is contained in:
		
							
								
								
									
										25
									
								
								static/js/compose_closed_ui.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								static/js/compose_closed_ui.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import $ from "jquery";
 | 
			
		||||
 | 
			
		||||
import * as message_lists from "./message_lists";
 | 
			
		||||
 | 
			
		||||
function update_reply_recipient_label() {
 | 
			
		||||
    const message = message_lists.current.selected_message();
 | 
			
		||||
    let recipient_label = "";
 | 
			
		||||
    if (message) {
 | 
			
		||||
        if (message.stream && message.topic) {
 | 
			
		||||
            recipient_label = "#" + message.stream + " > " + message.topic;
 | 
			
		||||
        } else if (message.display_reply_to) {
 | 
			
		||||
            recipient_label = message.display_reply_to;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    $(".compose_reply_button_recipient_label").text(recipient_label);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO: Move the closed-compose buttons click handlers here, probably.
 | 
			
		||||
 | 
			
		||||
export function initialize() {
 | 
			
		||||
    // When the message selection changes, change the label on the Reply button.
 | 
			
		||||
    $(document).on("message_selected.zulip", () => {
 | 
			
		||||
        update_reply_recipient_label();
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@@ -13,6 +13,7 @@ import * as blueslip from "./blueslip";
 | 
			
		||||
import * as bot_data from "./bot_data";
 | 
			
		||||
import * as click_handlers from "./click_handlers";
 | 
			
		||||
import * as compose from "./compose";
 | 
			
		||||
import * as compose_closed_ui from "./compose_closed_ui";
 | 
			
		||||
import * as compose_pm_pill from "./compose_pm_pill";
 | 
			
		||||
import * as composebox_typeahead from "./composebox_typeahead";
 | 
			
		||||
import * as condense from "./condense";
 | 
			
		||||
@@ -470,6 +471,7 @@ export function initialize_everything() {
 | 
			
		||||
    scroll_bar.initialize();
 | 
			
		||||
    message_viewport.initialize();
 | 
			
		||||
    panels.initialize();
 | 
			
		||||
    compose_closed_ui.initialize();
 | 
			
		||||
    initialize_kitchen_sink_stuff();
 | 
			
		||||
    echo.initialize();
 | 
			
		||||
    stream_edit.initialize();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user