mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
page_params: Split out state data for realm.
For spectators, the chunk of page_params that originates from do_events_register isn’t assigned until ui_init.js. That means the TypeScript type of page_params is mostly a lie during module load time: reading a parameter too early silently results in undefined rather than the declared type, with unpredictable results later on. We want to make such an early read into an immediate runtime error, for both users and spectators consistently, and pave the way for runtime validation of the page_params type. As a second step, split out the subset of fields that pertain to the entire realm. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
e96ede0ef6
commit
b9e62c7af8
@@ -3,9 +3,9 @@ import * as compose_fade_users from "./compose_fade_users";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {$t} from "./i18n";
|
||||
import * as muted_users from "./muted_users";
|
||||
import {page_params} from "./page_params";
|
||||
import * as people from "./people";
|
||||
import * as presence from "./presence";
|
||||
import {realm} from "./state_data";
|
||||
import * as timerender from "./timerender";
|
||||
import * as unread from "./unread";
|
||||
import {user_settings} from "./user_settings";
|
||||
@@ -113,7 +113,7 @@ export function user_last_seen_time_status(user_id: number): string {
|
||||
}
|
||||
|
||||
const last_active_date = presence.last_active_date(user_id);
|
||||
if (page_params.realm_is_zephyr_mirror_realm) {
|
||||
if (realm.realm_is_zephyr_mirror_realm) {
|
||||
// We don't send presence data to clients in Zephyr mirroring realms
|
||||
return $t({defaultMessage: "Activity unknown"});
|
||||
} else if (last_active_date === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user