mirror of https://github.com/zulip/zulip.git
eslint: Fix @typescript-eslint/prefer-optional-chain.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
3d55e7ef10
commit
c943dc5035
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -42,10 +42,9 @@ 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
|
||||
? window.electron_bridge.decrypt_clipboard(1)
|
||||
: await decrypt_manual();
|
||||
const {key, pasted} = window.electron_bridge?.decrypt_clipboard
|
||||
? window.electron_bridge.decrypt_clipboard(1)
|
||||
: await decrypt_manual();
|
||||
|
||||
const keyHex = [...key].map((b) => b.toString(16).padStart(2, "0")).join("");
|
||||
window.open(
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue