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.

topic_name: Fix compressing of display topic names.

adnan-td4bde1586e44a
diff --git a/web/styles/drafts.css b/web/styles/drafts.css
index fd29c5adf60..4c4ea72ef19 100644
--- a/web/styles/drafts.css
+++ b/web/styles/drafts.css
@@ -60,6 +60,7 @@
font-size: 1.1em;
line-height: normal;
margin-bottom: 5px;
+ white-space: pre-wrap;
}
}
diff --git a/web/styles/inbox.css b/web/styles/inbox.css
index 8d40ec90685..fdd5b489ff9 100644
--- a/web/styles/inbox.css
+++ b/web/styles/inbox.css
@@ -363,6 +363,7 @@
& a {
padding: 1px 0;
+ white-space: pre;
}
}
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index b8f5e9969e6..dc4253a1f9b 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -910,6 +910,10 @@ li.top_left_scheduled_messages {
overflow-x: hidden;
overflow-x: clip;
text-overflow: ellipsis;
+
+ span.sidebar-topic-name-inner {
+ white-space: pre;
+ }
}
.searching-for-more-topics img {
diff --git a/web/styles/message_header.css b/web/styles/message_header.css
index 250551cef16..581aee30291 100644
--- a/web/styles/message_header.css
+++ b/web/styles/message_header.css
@@ -59,6 +59,10 @@
top: 0.5px;
overflow: hidden;
text-overflow: ellipsis;
+
+ span.stream-topic-inner {
+ white-space: pre;
+ }
}
}
diff --git a/web/styles/popovers.css b/web/styles/popovers.css
index 7c101f33a32..214b57aa2a7 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -291,6 +291,7 @@
color: var(--color-text-popover-menu);
line-height: 1.1;
margin-top: 4px;
+ white-space: pre-wrap;
}
}
diff --git a/web/styles/rendered_markdown.css b/web/styles/rendered_markdown.css
index ee7c9a21075..4166a058137 100644
--- a/web/styles/rendered_markdown.css
+++ b/web/styles/rendered_markdown.css
@@ -202,6 +202,11 @@
}
}
+ .stream-topic {
+ /* Display whitespace within topics. */
+ white-space: pre-wrap;
+ }
+
.user-group-mention {
&:hover {
background-color: var(--color-background-text-hover-group-mention);
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index 0bedd3ed1e8..81c37906ea2 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -357,6 +357,14 @@ body.has-overlay-scrollbar {
background-color: hsl(0deg 0% 0% / 70%);
}
+.white-space-preserve-wrap {
+ white-space: pre-wrap;
+}
+
+.white-space-preserve {
+ white-space: pre;
+}
+
/* Set flex display on login buttons only in the
spectator view. We want them to display none
otherwise. */
@@ -1359,6 +1367,10 @@ div.focused-message-list {
a {
color: inherit;
+
+ strong.typeahead-strong-section {
+ white-space: pre;
+ }
}
.active {
diff --git a/web/templates/compose_banner/automatic_new_visibility_policy_banner.hbs b/web/templates/compose_banner/automatic_new_visibility_policy_banner.hbs
index a82493f5cd5..236b5e30f01 100644
--- a/web/templates/compose_banner/automatic_new_visibility_policy_banner.hbs
+++ b/web/templates/compose_banner/automatic_new_visibility_policy_banner.hbs
@@ -3,12 +3,12 @@
{{#if followed}}
{{#tr}}
Now following <z-link>{channel_topic}</z-link>.
- {{#*inline "z-link"}}<a class="above_compose_banner_action_link" href="{{narrow_url}}" data-message-id="{{link_msg_id}}">{{> @partial-block}}</a>{{/inline}}
+ {{#*inline "z-link"}}<a class="above_compose_banner_action_link white-space-preserve-wrap" href="{{narrow_url}}" data-message-id="{{link_msg_id}}">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
{{else}}
{{#tr}}
Unmuted <z-link>{channel_topic}</z-link>.
- {{#*inline "z-link"}}<a class="above_compose_banner_action_link" href="{{narrow_url}}" data-message-id="{{link_msg_id}}">{{> @partial-block}}</a>{{/inline}}
+ {{#*inline "z-link"}}<a class="above_compose_banner_action_link white-space-preserve-wrap" href="{{narrow_url}}" data-message-id="{{link_msg_id}}">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
{{/if}}
</p>
diff --git a/web/templates/confirm_dialog/confirm_delete_topic.hbs b/web/templates/confirm_dialog/confirm_delete_topic.hbs
index b0a5f30330e..07263a28c9f 100644
--- a/web/templates/confirm_dialog/confirm_delete_topic.hbs
+++ b/web/templates/confirm_dialog/confirm_delete_topic.hbs
@@ -1,6 +1,4 @@
<p>
{{t "Deleting a topic will immediately remove it and its messages for everyone. Other users may find this confusing, especially if they had received an email or push notification related to the deleted messages." }}
</p>
-<p>
- {{#tr}}Are you sure you want to permanently delete <b>{topic_name}</b>?{{/tr}}
-</p>
+<p class="white-space-preserve-wrap">{{#tr}}Are you sure you want to permanently delete <b>{topic_name}</b>?{{/tr}}</p>
diff --git a/web/templates/confirm_dialog/confirm_merge_topics_with_rename.hbs b/web/templates/confirm_dialog/confirm_merge_topics_with_rename.hbs
index 5acc7389f51..a62329f9efc 100644
--- a/web/templates/confirm_dialog/confirm_merge_topics_with_rename.hbs
+++ b/web/templates/confirm_dialog/confirm_merge_topics_with_rename.hbs
@@ -1,6 +1,7 @@
<p>
{{#tr}}
- The topic <strong>{topic_name}</strong> already exists in this channel.
+ The topic <z-topic-name>{topic_name}</z-topic-name> already exists in this channel.
Are you sure you want to combine messages from these topics? This cannot be undone.
+ {{#*inline "z-topic-name"}}<strong class="white-space-preserve-wrap">{{> @partial-block}}</strong>{{/inline}}
{{/tr}}
</p>
diff --git a/web/templates/draft.hbs b/web/templates/draft.hbs
index a30785a42f7..c3c20a9d8b0 100644
--- a/web/templates/draft.hbs
+++ b/web/templates/draft.hbs
@@ -16,7 +16,7 @@
<span class="stream_topic_separator"><i class="zulip-icon zulip-icon-chevron-right"></i></span>
<span class="stream_topic">
<div class="message_label_clickable narrows_by_topic">
- {{topic}}
+ <span class="stream-topic-inner">{{topic}}</span>
</div>
</span>
<span class="recipient_bar_controls"></span>
diff --git a/web/templates/message_moved_widget_body.hbs b/web/templates/message_moved_widget_body.hbs
index e9a33f84d0c..99dab44cd5c 100644
--- a/web/templates/message_moved_widget_body.hbs
+++ b/web/templates/message_moved_widget_body.hbs
@@ -1,6 +1,6 @@
<div>
{{#tr}}
Message moved to <z-link>{stream_topic}</z-link>.
- {{#*inline "z-link"}}<a href="{{new_location_url}}">{{> @partial-block}}</a>{{/inline}}
+ {{#*inline "z-link"}}<a class="white-space-preserve-wrap" href="{{new_location_url}}">{{> @partial-block}}</a>{{/inline}}
{{/tr}}
</div>
diff --git a/web/templates/move_topic_to_stream.hbs b/web/templates/move_topic_to_stream.hbs
index 2c188ba62e4..8c89e1bed22 100644
--- a/web/templates/move_topic_to_stream.hbs
+++ b/web/templates/move_topic_to_stream.hbs
@@ -1,5 +1,5 @@
{{#unless (or from_message_actions_popover only_topic_edit)}}
-<p>{{#tr}}Move all messages in <strong>{topic_name}</strong>{{/tr}} to:</p>
+<p class="white-space-preserve-wrap">{{#tr}}Move all messages in <strong>{topic_name}</strong>{{/tr}} to:</p>
{{/unless}}
<form class="new-style" id="move_topic_form">
{{#if only_topic_edit }}
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index 1f7ebb5749c..10cfae36449 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -34,7 +34,7 @@
{{#if is_private}}
<a href="{{pm_url}}">{{{rendered_pm_with}}}</a>
{{else}}
- <a href="{{topic_url}}">{{topic}}</a>
+ <a class="white-space-preserve-wrap" href="{{topic_url}}">{{topic}}</a>
{{/if}}
</div>
<div class="right_part">
diff --git a/web/templates/recipient_row.hbs b/web/templates/recipient_row.hbs
index 48f26d5f4e6..abbc94af088 100644
--- a/web/templates/recipient_row.hbs
+++ b/web/templates/recipient_row.hbs
@@ -24,9 +24,9 @@
href="{{topic_url}}"
data-tippy-content="{{t 'Go to #{display_recipient} > {topic}' }}">
{{#if use_match_properties}}
- {{{match_topic}}}
+ <span class="stream-topic-inner">{{{match_topic}}}</span>
{{else}}
- {{topic}}
+ <span class="stream-topic-inner">{{topic}}</span>
{{/if}}
</a>
</span>
diff --git a/web/templates/scheduled_message.hbs b/web/templates/scheduled_message.hbs
index 6d32e3dada4..53fcba11c1f 100644
--- a/web/templates/scheduled_message.hbs
+++ b/web/templates/scheduled_message.hbs
@@ -13,7 +13,7 @@
<span class="stream_topic_separator"><i class="zulip-icon zulip-icon-chevron-right"></i></span>
<span class="stream_topic">
<div class="message_label_clickable narrows_by_topic">
- {{topic}}
+ <span>{{topic}}</span>
</div>
</span>
<span class="recipient_bar_controls"></span>
diff --git a/web/templates/stream_topic_widget.hbs b/web/templates/stream_topic_widget.hbs
index b612fa49059..3e3b8d94620 100644
--- a/web/templates/stream_topic_widget.hbs
+++ b/web/templates/stream_topic_widget.hbs
@@ -1,3 +1,3 @@
<strong>
- <span class="stream">{{stream_name}}</span> &gt; <span class="topic">{{topic}}</span>
+ <span class="stream">{{stream_name}}</span> &gt; <span class="topic white-space-preserve-wrap">{{topic}}</span>
</strong>
diff --git a/web/templates/topic_list_item.hbs b/web/templates/topic_list_item.hbs
index 22cc2ed1c12..9ad7a8c1f75 100644
--- a/web/templates/topic_list_item.hbs
+++ b/web/templates/topic_list_item.hbs
@@ -4,7 +4,7 @@
{{topic_resolved_prefix}}
</span>
<a href="{{url}}" class="sidebar-topic-name" title="{{topic_name}}">
- {{topic_display_name}}
+ <span class="sidebar-topic-name-inner">{{topic_display_name}}</span>
</a>
<div class="topic-markers-and-controls">
{{#if contains_unread_mention}}
diff --git a/web/templates/typeahead_list_item.hbs b/web/templates/typeahead_list_item.hbs
index 51df0ebf5be..3dda510e424 100644
--- a/web/templates/typeahead_list_item.hbs
+++ b/web/templates/typeahead_list_item.hbs
@@ -17,7 +17,7 @@
{{else if is_user_group}}
<i class="typeahead-image zulip-icon zulip-icon-triple-users no-presence-circle" aria-hidden="true"></i>
{{/if}}
-<strong>
+<strong class="typeahead-strong-section">
{{~#if stream}}
{{> inline_decorated_stream_name stream=stream }}
{{else}}
diff --git a/web/templates/user_topic_ui_row.hbs b/web/templates/user_topic_ui_row.hbs
index 61be7c41227..189cd81d874 100644
--- a/web/templates/user_topic_ui_row.hbs
+++ b/web/templates/user_topic_ui_row.hbs
@@ -1,7 +1,7 @@
{{#with user_topic}}
<tr data-stream-id="{{stream_id}}" data-stream="{{stream}}" data-topic="{{topic}}" data-date-updated="{{date_updated_str}}" data-visibility-policy="{{visibility_policy}}">
<td>{{stream}}</td>
- <td>{{topic}}</td>
+ <td class="white-space-preserve-wrap">{{topic}}</td>
<td>
<select class="settings_user_topic_visibility_policy list_select bootstrap-focus-style" data-setting-widget-type="number">
{{#each ../user_topic_visibility_policy_values}}
diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.js
index 30938554535..09edc3ee8ef 100644
--- a/web/tests/composebox_typeahead.test.js
+++ b/web/tests/composebox_typeahead.test.js
@@ -894,18 +894,18 @@ test("initialize", ({override, override_rewire, mock_template}) => {
// options.highlighter_html()
options.query = "Kro";
actual_value = options.highlighter_html("kronor");
- expected_value = "<strong>kronor</strong>";
+ expected_value = '<strong class="typeahead-strong-section">kronor</strong>';
assert.equal(actual_value, expected_value);
// Highlighted content should be escaped.
options.query = "<";
actual_value = options.highlighter_html("<&>");
- expected_value = "<strong>&lt;&amp;&gt;</strong>";
+ expected_value = '<strong class="typeahead-strong-section">&lt;&amp;&gt;</strong>';
assert.equal(actual_value, expected_value);
options.query = "even m";
actual_value = options.highlighter_html("even more ice");
- expected_value = "<strong>even more ice</strong>";
+ expected_value = '<strong class="typeahead-strong-section">even more ice</strong>';
assert.equal(actual_value, expected_value);
// options.sorter()
@@ -1129,7 +1129,7 @@ test("initialize", ({override, override_rewire, mock_template}) => {
expected_value =
` <span class="user_circle_empty user_circle"></span>\n` +
` <img class="typeahead-image" src="http://zulip.zulipdev.com/avatar/${othello.user_id}?s&#x3D;50" />\n` +
- `<strong>Othello, the Moor of Venice</strong>&nbsp;&nbsp;\n` +
+ `<strong class="typeahead-strong-section">Othello, the Moor of Venice</strong>&nbsp;&nbsp;\n` +
`<small class="autocomplete_secondary">[email protected]</small>\n`;
assert.equal(actual_value, expected_value);
// Reset the email such that this does not affect further tests.
@@ -1139,7 +1139,7 @@ test("initialize", ({override, override_rewire, mock_template}) => {
ct.get_or_set_token_for_testing("hamletcharacters");
actual_value = options.highlighter_html(hamletcharacters);
expected_value =
- ' <i class="typeahead-image zulip-icon zulip-icon-triple-users no-presence-circle" aria-hidden="true"></i>\n<strong>hamletcharacters</strong>&nbsp;&nbsp;\n<small class="autocomplete_secondary">Characters of Hamlet</small>\n';
+ ' <i class="typeahead-image zulip-icon zulip-icon-triple-users no-presence-circle" aria-hidden="true"></i>\n<strong class="typeahead-strong-section">hamletcharacters</strong>&nbsp;&nbsp;\n<small class="autocomplete_secondary">Characters of Hamlet</small>\n';
assert.equal(actual_value, expected_value);
// matching