message_feed_errors: Convert to handlebars.

This commit is contained in:
Aman Agrawal 2022-01-19 10:03:00 +00:00 committed by Tim Abbott
parent 8f2e973ab2
commit f00db27b64
5 changed files with 37 additions and 25 deletions

View File

@ -8,6 +8,7 @@ import * as fenced_code from "../shared/js/fenced_code";
import render_compose from "../templates/compose.hbs"; import render_compose from "../templates/compose.hbs";
import render_edit_content_button from "../templates/edit_content_button.hbs"; import render_edit_content_button from "../templates/edit_content_button.hbs";
import render_left_sidebar from "../templates/left_sidebar.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_navbar from "../templates/navbar.hbs";
import render_right_sidebar from "../templates/right_sidebar.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"); 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() { export function initialize_kitchen_sink_stuff() {
// TODO: // TODO:
// This function is a historical dumping ground // This function is a historical dumping ground
@ -571,6 +576,7 @@ export function initialize_everything() {
initialize_compose_box(); initialize_compose_box();
settings.initialize(); settings.initialize();
initialize_navbar(); initialize_navbar();
initialize_message_feed_errors();
realm_logo.render(); realm_logo.render();
message_lists.initialize(); message_lists.initialize();

View File

@ -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>

View File

@ -163,7 +163,7 @@
</div> </div>
<div id="loading_older_messages_indicator"></div> <div id="loading_older_messages_indicator"></div>
<div id="page_loading_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 class="message_table focused_table" id="zhome" role="list" aria-live="polite" aria-label="{{ _('Messages') }}">
</div> </div>
<div class="message_table" id="zfilt" role="list" aria-live="polite" aria-label="{{ _('Messages') }}"> <div class="message_table" id="zfilt" role="list" aria-live="polite" aria-label="{{ _('Messages') }}">

View File

@ -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>

View File

@ -219,7 +219,7 @@ class HomeTest(ZulipTestCase):
def test_home(self) -> None: def test_home(self) -> None:
# Keep this list sorted!!! # Keep this list sorted!!!
html_bits = [ html_bits = [
"empty_feed_notice_main", "message_feed_errors_container",
"Loading...", "Loading...",
# Verify that the app styles get included # Verify that the app styles get included
"app-stubentry.js", "app-stubentry.js",
@ -447,7 +447,7 @@ class HomeTest(ZulipTestCase):
which still want the home page to load properly. which still want the home page to load properly.
""" """
html = result.content.decode() 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.") raise AssertionError("Home page probably did not load.")
def test_terms_of_service(self) -> None: def test_terms_of_service(self) -> None: