From 924ebee421b7965a206940211e9cf03fca4f7b28 Mon Sep 17 00:00:00 2001 From: evykassirer Date: Sun, 3 Nov 2024 11:26:12 -0800 Subject: [PATCH] stream_edit: Remove unecessary checks for invalid stream id. None of these have showed up in Sentry in the last 90 days, and it will be easier to type this file if we can assume we always get a valid stream id and a valid sub for that stream id. --- web/src/stream_edit.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/web/src/stream_edit.js b/web/src/stream_edit.js index a2f10f21f2..a69e94545c 100644 --- a/web/src/stream_edit.js +++ b/web/src/stream_edit.js @@ -83,17 +83,7 @@ function get_stream_id(target) { function get_sub_for_target(target) { const stream_id = get_stream_id(target); - if (!stream_id) { - blueslip.error("Cannot find stream id for target"); - return undefined; - } - - const sub = sub_store.get(stream_id); - if (!sub) { - blueslip.error("get_sub_for_target() failed id lookup", {stream_id}); - return undefined; - } - return sub; + return sub_store.get(stream_id); } export function open_edit_panel_for_row(stream_row) { @@ -339,10 +329,6 @@ function stream_setting_changed(e) { const sub = get_sub_for_target(e.target); const $status_element = $(e.target).closest(".subsection-parent").find(".alert-notification"); const setting = e.target.name; - if (!sub) { - blueslip.error("undefined sub in stream_setting_changed()"); - return; - } if (has_global_notification_setting(setting) && sub[setting] === null) { sub[setting] = user_settings[settings_config.generalize_stream_notification_setting[setting]]; @@ -608,23 +594,9 @@ export function initialize() { e.stopPropagation(); const stream_id = get_stream_id(e.target); - if (!stream_id) { - ui_report.client_error( - $t_html({defaultMessage: "Invalid channel ID"}), - $(".stream_change_property_info"), - ); - return; - } function do_archive_stream() { const stream_id = Number($(".dialog_submit_button").attr("data-stream-id")); - if (!stream_id) { - ui_report.client_error( - $t_html({defaultMessage: "Invalid channel ID"}), - $(".stream_change_property_info"), - ); - return; - } const $row = $(".stream-row.active"); archive_stream(stream_id, $(".stream_change_property_info"), $row); }