From f00db27b64abe3361d273b32237d70fc6f6ae6f6 Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Wed, 19 Jan 2022 10:03:00 +0000 Subject: [PATCH] message_feed_errors: Convert to handlebars. --- static/js/ui_init.js | 6 ++++ static/templates/message_feed_errors.hbs | 28 +++++++++++++++++++ templates/zerver/app/index.html | 2 +- templates/zerver/app/message_feed_errors.html | 22 --------------- zerver/tests/test_home.py | 4 +-- 5 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 static/templates/message_feed_errors.hbs delete mode 100644 templates/zerver/app/message_feed_errors.html diff --git a/static/js/ui_init.js b/static/js/ui_init.js index d620241145..d7612498b8 100644 --- a/static/js/ui_init.js +++ b/static/js/ui_init.js @@ -8,6 +8,7 @@ import * as fenced_code from "../shared/js/fenced_code"; import render_compose from "../templates/compose.hbs"; import render_edit_content_button from "../templates/edit_content_button.hbs"; import render_left_sidebar from "../templates/left_sidebar.hbs"; +import render_message_feed_errors from "../templates/message_feed_errors.hbs"; import render_navbar from "../templates/navbar.hbs"; import render_right_sidebar from "../templates/right_sidebar.hbs"; @@ -199,6 +200,10 @@ function initialize_compose_box() { common.adjust_mac_shortcuts(".enter_sends kbd"); } +function initialize_message_feed_errors() { + $("#message_feed_errors_container").html(render_message_feed_errors()); +} + export function initialize_kitchen_sink_stuff() { // TODO: // This function is a historical dumping ground @@ -571,6 +576,7 @@ export function initialize_everything() { initialize_compose_box(); settings.initialize(); initialize_navbar(); + initialize_message_feed_errors(); realm_logo.render(); message_lists.initialize(); diff --git a/static/templates/message_feed_errors.hbs b/static/templates/message_feed_errors.hbs new file mode 100644 index 0000000000..9e7911e597 --- /dev/null +++ b/static/templates/message_feed_errors.hbs @@ -0,0 +1,28 @@ +
+

+ + {{#tr}} + Some older messages are unavailable. + Upgrade your organization + to access your full message history. + {{#*inline "z-link"}}{{> @partial-block}}{{/inline}} + {{/tr}} +

+
+ +
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html index 36995bc250..a486798aa4 100644 --- a/templates/zerver/app/index.html +++ b/templates/zerver/app/index.html @@ -163,7 +163,7 @@
- {% include "zerver/app/message_feed_errors.html" %} +
diff --git a/templates/zerver/app/message_feed_errors.html b/templates/zerver/app/message_feed_errors.html deleted file mode 100644 index 129a41f4e0..0000000000 --- a/templates/zerver/app/message_feed_errors.html +++ /dev/null @@ -1,22 +0,0 @@ -
-

- - {% trans %} - Some older messages are unavailable. - Upgrade your organization - to access your full message history. - {% endtrans %} -

-
- -
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index fdf110249e..8a0e252f49 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -219,7 +219,7 @@ class HomeTest(ZulipTestCase): def test_home(self) -> None: # Keep this list sorted!!! html_bits = [ - "empty_feed_notice_main", + "message_feed_errors_container", "Loading...", # Verify that the app styles get included "app-stubentry.js", @@ -447,7 +447,7 @@ class HomeTest(ZulipTestCase): which still want the home page to load properly. """ html = result.content.decode() - if "empty_feed_notice_main" not in html: + if "message_feed_errors_container" not in html: raise AssertionError("Home page probably did not load.") def test_terms_of_service(self) -> None: