mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
stream_color: Fix stream color not updating to default.
Previously, if the user changes any stream color and updates it back to the default color without reopening the change color popover, the second color change didn't take effect. Fix bug by destroying the colorpicker object and rebuilding it again every time a color change is triggered by the confirm button. Fixes: #21055
This commit is contained in:
@@ -99,7 +99,20 @@ export function update_stream_color(sub, color, {update_historical = false} = {}
|
||||
message_view_header.colorize_message_view_header();
|
||||
}
|
||||
|
||||
export const sidebar_popover_colorpicker_options_full = {
|
||||
clickoutFiresChange: false,
|
||||
showPalette: true,
|
||||
showInput: true,
|
||||
flat: true,
|
||||
cancelText: "",
|
||||
chooseText: $t({defaultMessage: "Confirm"}),
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
function picker_do_change_color(color) {
|
||||
$(".colorpicker").spectrum("destroy");
|
||||
$(".colorpicker").spectrum(sidebar_popover_colorpicker_options_full);
|
||||
const stream_id = Number.parseInt($(this).attr("stream_id"), 10);
|
||||
const hex_color = color.toHexString();
|
||||
stream_settings_ui.set_color(stream_id, hex_color);
|
||||
@@ -115,14 +128,3 @@ export const sidebar_popover_colorpicker_options = {
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
||||
export const sidebar_popover_colorpicker_options_full = {
|
||||
clickoutFiresChange: false,
|
||||
showPalette: true,
|
||||
showInput: true,
|
||||
flat: true,
|
||||
cancelText: "",
|
||||
chooseText: $t({defaultMessage: "Confirm"}),
|
||||
palette: stream_color_palette,
|
||||
change: picker_do_change_color,
|
||||
};
|
||||
|
Reference in New Issue
Block a user