mirror of https://github.com/zulip/zulip.git
presence: Rename hbs templates to not have the word "user".
This is a prep commit for enabling a two section layout in the buddy_list. The sections will be for "users" and "others". Hence, this commit performs a simple rename of: - `user_presence_row.hbs` -> `presence_row.hbs` - `user_presence_rows.hbs` -> `presence_rows.hbs` And then a search and replace of `user_presence_row` to `presence_row` (which also handles the second rename). It also makes one modification in buddy_list.js where it changes a template variable we're passing from "users" to "row_members".
This commit is contained in:
parent
900a776293
commit
20f36431ec
|
@ -212,10 +212,9 @@ test("huddle_data.process_loaded_messages", () => {
|
|||
|
||||
test("presence_list_full_update", ({override, mock_template}) => {
|
||||
override(padded_widget, "update_padding", () => {});
|
||||
|
||||
mock_template("user_presence_rows.hbs", false, (data) => {
|
||||
assert.equal(data.users.length, 7);
|
||||
assert.equal(data.users[0].user_id, me.user_id);
|
||||
mock_template("presence_rows.hbs", false, (data) => {
|
||||
assert.equal(data.presence_rows.length, 7);
|
||||
assert.equal(data.presence_rows[0].user_id, me.user_id);
|
||||
});
|
||||
|
||||
$(".user-list-filter").trigger("focus");
|
||||
|
@ -275,7 +274,7 @@ test("PM_update_dom_counts", () => {
|
|||
test("handlers", ({override, override_rewire, mock_template}) => {
|
||||
let filter_key_handlers;
|
||||
|
||||
mock_template("user_presence_rows.hbs", false, () => {});
|
||||
mock_template("presence_rows.hbs", false, () => {});
|
||||
|
||||
override(keydown_util, "handle", (opts) => {
|
||||
filter_key_handlers = opts.handlers;
|
||||
|
@ -380,7 +379,7 @@ test("first/prev/next", ({override, mock_template}) => {
|
|||
let rendered_alice;
|
||||
let rendered_fred;
|
||||
|
||||
mock_template("user_presence_row.hbs", false, (data) => {
|
||||
mock_template("presence_row.hbs", false, (data) => {
|
||||
switch (data.user_id) {
|
||||
case alice.user_id:
|
||||
rendered_alice = true;
|
||||
|
@ -441,7 +440,7 @@ test("first/prev/next", ({override, mock_template}) => {
|
|||
});
|
||||
|
||||
test("insert_one_user_into_empty_list", ({override, mock_template}) => {
|
||||
mock_template("user_presence_row.hbs", true, (data, html) => {
|
||||
mock_template("presence_row.hbs", true, (data, html) => {
|
||||
assert.deepEqual(data, {
|
||||
href: "#narrow/pm-with/1-alice",
|
||||
name: "Alice Smith",
|
||||
|
@ -471,7 +470,7 @@ test("insert_one_user_into_empty_list", ({override, mock_template}) => {
|
|||
});
|
||||
|
||||
test("insert_alice_then_fred", ({override, mock_template}) => {
|
||||
mock_template("user_presence_row.hbs", true, (data, html) => html);
|
||||
mock_template("presence_row.hbs", true, (data, html) => html);
|
||||
|
||||
let appended_html;
|
||||
override(buddy_list.$container, "append", (html) => {
|
||||
|
@ -489,7 +488,7 @@ test("insert_alice_then_fred", ({override, mock_template}) => {
|
|||
});
|
||||
|
||||
test("insert_fred_then_alice_then_rename", ({override, mock_template}) => {
|
||||
mock_template("user_presence_row.hbs", true, (data, html) => html);
|
||||
mock_template("presence_row.hbs", true, (data, html) => html);
|
||||
|
||||
let appended_html;
|
||||
override(buddy_list.$container, "append", (html) => {
|
||||
|
@ -600,7 +599,7 @@ test("update_presence_info", ({override, override_rewire}) => {
|
|||
});
|
||||
|
||||
test("initialize", ({override, mock_template}) => {
|
||||
mock_template("user_presence_rows.hbs", false, () => {});
|
||||
mock_template("presence_rows.hbs", false, () => {});
|
||||
override(padded_widget, "update_padding", () => {});
|
||||
override(pm_list, "update_private_messages", () => {});
|
||||
override(watchdog, "check_for_unsuspend", () => {});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import $ from "jquery";
|
||||
|
||||
import render_user_presence_row from "../templates/user_presence_row.hbs";
|
||||
import render_user_presence_rows from "../templates/user_presence_rows.hbs";
|
||||
import render_presence_row from "../templates/presence_row.hbs";
|
||||
import render_presence_rows from "../templates/presence_rows.hbs";
|
||||
|
||||
import * as blueslip from "./blueslip";
|
||||
import * as buddy_data from "./buddy_data";
|
||||
|
@ -16,13 +16,12 @@ class BuddyListConf {
|
|||
padding_sel = "#buddy_list_wrapper_padding";
|
||||
|
||||
items_to_html(opts) {
|
||||
const user_info = opts.items;
|
||||
const html = render_user_presence_rows({users: user_info});
|
||||
const html = render_presence_rows({presence_rows: opts.items});
|
||||
return html;
|
||||
}
|
||||
|
||||
item_to_html(opts) {
|
||||
const html = render_user_presence_row(opts.item);
|
||||
const html = render_presence_row(opts.item);
|
||||
return html;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{{#each presence_rows}}
|
||||
{{> presence_row}}
|
||||
{{/each}}
|
|
@ -1,4 +0,0 @@
|
|||
{{! User presence rows }}
|
||||
{{#each users}}
|
||||
{{> user_presence_row}}
|
||||
{{/each}}
|
Loading…
Reference in New Issue