mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 19:06:09 +00:00
Ever since we started bundling the app with webpack, there’s been less and less overlap between our ‘static’ directory (files belonging to the frontend app) and Django’s interpretation of the ‘static’ directory (files served directly to the web). Split the app out to its own ‘web’ directory outside of ‘static’, and remove all the custom collectstatic --ignore rules. This makes it much clearer what’s actually being served to the web, and what’s being bundled by webpack. It also shrinks the release tarball by 3%. Signed-off-by: Anders Kaseorg <anders@zulip.com>
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import $ from "jquery";
|
|
|
|
import * as compose_state from "./compose_state";
|
|
import * as overlays from "./overlays";
|
|
import * as popovers from "./popovers";
|
|
|
|
let is_rt_visible = false;
|
|
|
|
export function set_visible(value) {
|
|
is_rt_visible = value;
|
|
}
|
|
|
|
export function is_visible() {
|
|
return is_rt_visible;
|
|
}
|
|
|
|
export function is_in_focus() {
|
|
// Check if user is focused on
|
|
// recent topics.
|
|
return (
|
|
is_visible() &&
|
|
!compose_state.composing() &&
|
|
!popovers.any_active() &&
|
|
!overlays.is_overlay_or_modal_open() &&
|
|
!$(".home-page-input").is(":focus")
|
|
);
|
|
}
|
|
|
|
export function get_topic_key(stream_id, topic) {
|
|
return stream_id + ":" + topic.toLowerCase();
|
|
}
|
|
|
|
export function get_key_from_message(msg) {
|
|
if (msg.type === "private") {
|
|
// The to_user_ids field on a private message object is a
|
|
// string containing the user IDs involved in the message in
|
|
// sorted order.
|
|
return msg.to_user_ids;
|
|
} else if (msg.type === "stream") {
|
|
return get_topic_key(msg.stream_id, msg.topic);
|
|
}
|
|
throw new Error(`Invalid message type ${msg.type}`);
|
|
}
|