mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	compose: Add privacy icons to the stream dropdown menu.
These were previously used in the input form field and this commit removes the code that supported that and replaces it by using existing dropdown_widget functionality to display the icons in the compose dropdown.
This commit is contained in:
		@@ -1,37 +1,13 @@
 | 
			
		||||
import $ from "jquery";
 | 
			
		||||
 | 
			
		||||
import * as stream_data from "./stream_data";
 | 
			
		||||
 | 
			
		||||
function update_compose_stream_icon(stream_name) {
 | 
			
		||||
    const $streamfield = $("#compose_select_stream_name");
 | 
			
		||||
    const $globe_icon = $("#compose-globe-icon");
 | 
			
		||||
    const $lock_icon = $("#compose-lock-icon");
 | 
			
		||||
 | 
			
		||||
    // Reset state
 | 
			
		||||
    $globe_icon.hide();
 | 
			
		||||
    $lock_icon.hide();
 | 
			
		||||
    $streamfield.removeClass("lock-padding");
 | 
			
		||||
 | 
			
		||||
    if (stream_data.is_invite_only_by_stream_name(stream_name)) {
 | 
			
		||||
        $lock_icon.show();
 | 
			
		||||
        $streamfield.addClass("lock-padding");
 | 
			
		||||
    } else if (stream_data.is_web_public_by_stream_name(stream_name)) {
 | 
			
		||||
        $globe_icon.show();
 | 
			
		||||
        $streamfield.addClass("lock-padding");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// In an attempt to decrease mixing, set stream bar
 | 
			
		||||
// color look like the stream being used.
 | 
			
		||||
// (In particular, if there's a color associated with it,
 | 
			
		||||
//  have that color be reflected here too.)
 | 
			
		||||
export function decorate(stream_name, $element, is_compose) {
 | 
			
		||||
export function decorate(stream_name, $element) {
 | 
			
		||||
    if (stream_name === undefined) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    const color = stream_data.get_color(stream_name);
 | 
			
		||||
    if (is_compose) {
 | 
			
		||||
        update_compose_stream_icon(stream_name);
 | 
			
		||||
    }
 | 
			
		||||
    $element.css("background-color", color);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user