Files
zulip/web/src/pm_list_dom.js
Anders Kaseorg c1675913a2 web: Move web app to ‘web’ directory.
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>
2023-02-23 16:04:17 -08:00

54 lines
1.3 KiB
JavaScript

import _ from "lodash";
import render_more_private_conversations from "../templates/more_pms.hbs";
import render_pm_list_item from "../templates/pm_list_item.hbs";
import * as vdom from "./vdom";
export function keyed_pm_li(conversation) {
const render = () => render_pm_list_item(conversation);
const eq = (other) => _.isEqual(conversation, other.conversation);
const key = conversation.user_ids_string;
return {
key,
render,
conversation,
eq,
};
}
export function more_private_conversations_li(more_conversations_unread_count) {
const render = () => render_more_private_conversations({more_conversations_unread_count});
// Used in vdom.js to check if an element has changed and needs to
// be updated in the DOM.
const eq = (other) =>
other.more_items &&
more_conversations_unread_count === other.more_conversations_unread_count;
// This special key must be impossible as a user_ids_string.
const key = "more_private_conversations";
return {
key,
more_items: true,
more_conversations_unread_count,
render,
eq,
};
}
export function pm_ul(nodes) {
const attrs = [
["class", "pm-list"],
["data-name", "private"],
];
return vdom.ul({
attrs,
keyed_nodes: nodes,
});
}