Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_feed_errors: Convert to handlebars.

Aman Agrawalf00db27b64ab
diff --git a/static/js/ui_init.js b/static/js/ui_init.js
index d6202411451..d7612498b8d 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 00000000000..9e7911e5975
--- /dev/null
+++ b/static/templates/message_feed_errors.hbs
@@ -0,0 +1,28 @@
+<div class="history-limited-box">
+ <p>
+ <i class="fa fa-exclamation-circle" aria-hidden="true"></i>
+ {{#tr}}
+ Some older messages are unavailable.
+ <z-link>Upgrade your organization</z-link>
+ to access your full message history.
+ {{#*inline "z-link"}}<a href="/plans/" target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
+ {{/tr}}
+ </p>
+</div>
+<div class="all-messages-search-caution" hidden>
+ <p>
+ <i class="fa fa-exclamation-circle" aria-hidden="true"></i>
+ {{#tr}}
+ End of results from your
+ <z-link>history</z-link>.
+ {{#*inline "z-link"}}<a href="/help/search-for-messages#searching-shared-history"
+ target="_blank" rel="noopener noreferrer">{{> @partial-block}}</a>{{/inline}}
+ {{/tr}}
+ &nbsp;
+ {{#tr}}
+ Consider <z-link>searching all public streams</z-link>.
+ {{#*inline "z-link"}}<a class="search-shared-history" href="">{{> @partial-block}}</a>{{/inline}}
+ {{/tr}}
+ </p>
+</div>
+<div class="empty_feed_notice_main"></div>
diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html
index 36995bc250d..a486798aa4a 100644
--- a/templates/zerver/app/index.html
+++ b/templates/zerver/app/index.html
@@ -163,7 +163,7 @@
</div>
<div id="loading_older_messages_indicator"></div>
<div id="page_loading_indicator"></div>
- {% include "zerver/app/message_feed_errors.html" %}
+ <div id="message_feed_errors_container"></div>
<div class="message_table focused_table" id="zhome" role="list" aria-live="polite" aria-label="{{ _('Messages') }}">
</div>
<div class="message_table" id="zfilt" role="list" aria-live="polite" aria-label="{{ _('Messages') }}">
diff --git a/templates/zerver/app/message_feed_errors.html b/templates/zerver/app/message_feed_errors.html
deleted file mode 100644
index 129a41f4e05..00000000000
--- a/templates/zerver/app/message_feed_errors.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<div class="history-limited-box">
- <p>
- <i class="fa fa-exclamation-circle" aria-hidden="true"></i>
- {% trans %}
- Some older messages are unavailable.
- <a href="/plans/" target="_blank" rel="noopener noreferrer">Upgrade your organization</a>
- to access your full message history.
- {% endtrans %}
- </p>
-</div>
-<div class="all-messages-search-caution" hidden>
- <p>
- <i class="fa fa-exclamation-circle" aria-hidden="true"></i>
- {% trans %}
- End of results from your
- <a href="/help/search-for-messages#searching-shared-history"
- target="_blank" rel="noopener noreferrer">history</a>.
- Consider <a class="search-shared-history" href="">searching all public streams</a>.
- {% endtrans %}
- </p>
-</div>
-<div class="empty_feed_notice_main"></div>
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index fdf110249e9..8a0e252f491 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: