eslint: Fix @typescript-eslint/prefer-optional-chain.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-12-21 17:01:35 -08:00 committed by Tim Abbott
parent 3d55e7ef10
commit c943dc5035
4 changed files with 6 additions and 14 deletions

View File

@ -76,10 +76,7 @@ export function compute_active_status(): ActivityState {
//
// The check for `get_idle_on_system === undefined` is feature
// detection; older desktop app releases never set that property.
if (
window.electron_bridge !== undefined &&
window.electron_bridge.get_idle_on_system !== undefined
) {
if (window.electron_bridge?.get_idle_on_system !== undefined) {
if (window.electron_bridge.get_idle_on_system()) {
return ActivityState.IDLE;
}

View File

@ -42,8 +42,7 @@ void (async () => {
// key and a promise; as soon as something encrypted to that key is copied
// to the clipboard, the app decrypts it and resolves the promise to the
// plaintext. This lets us skip the manual paste step.
const {key, pasted} =
window.electron_bridge && window.electron_bridge.decrypt_clipboard
const {key, pasted} = window.electron_bridge?.decrypt_clipboard
? window.electron_bridge.decrypt_clipboard(1)
: await decrypt_manual();

View File

@ -271,7 +271,7 @@ export function update_info_for_small_realm(): void {
export function last_active_date(user_id: number): Date | undefined {
const info = presence_info.get(user_id);
if (!info || !info.last_active) {
if (!info?.last_active) {
return undefined;
}

View File

@ -73,11 +73,7 @@ export function get_topic_visibility_policy(stream_id: number, topic: string): n
return false;
}
const sub_dict = all_user_topics.get(stream_id);
if (sub_dict && sub_dict.get(topic)) {
return sub_dict.get(topic)!.visibility_policy;
}
return all_visibility_policies.INHERIT;
return sub_dict?.get(topic)?.visibility_policy ?? all_visibility_policies.INHERIT;
}
export function is_topic_followed(stream_id: number, topic: string): boolean {