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.

left-sidebar: Add the new topic button in stream popover.

Signior-X86eccfd20f6c
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index 7dbb7d9f499..f0a864b5425 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -965,7 +965,9 @@ export function initialize() {
if (compose_state.composing()) {
if ($(e.target).closest("a").length > 0) {
- // Refocus compose message text box if link is clicked
+ // Refocus compose message text box if one clicks an external
+ // link/url to view something else while composing a message
+ // See issue #4331 for more details
$("#compose-textarea").trigger("focus");
return;
} else if (
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 6af5a95dee3..a8f5ee8017e 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -10,6 +10,7 @@ import render_topic_sidebar_actions from "../templates/topic_sidebar_actions.hbs
import * as blueslip from "./blueslip";
import * as browser_history from "./browser_history";
import * as channel from "./channel";
+import * as compose_actions from "./compose_actions";
import * as hash_util from "./hash_util";
import * as message_edit from "./message_edit";
import * as muting from "./muting";
@@ -471,6 +472,16 @@ export function register_stream_handlers() {
e.stopPropagation();
});
+ // New topic in stream menu
+ $("body").on("click", ".popover_new_topic_button", (e) => {
+ const sub = stream_popover_sub(e);
+ hide_stream_popover();
+
+ compose_actions.start("stream", {trigger: "popover new topic button", stream: sub.name});
+ e.preventDefault();
+ e.stopPropagation();
+ });
+
// Unsubscribe
$("body").on("click", ".popover_sub_unsub_button", function (e) {
$(this).toggleClass("unsub");
diff --git a/static/templates/stream_sidebar_actions.hbs b/static/templates/stream_sidebar_actions.hbs
index d1587e9450c..ccc51769ba3 100644
--- a/static/templates/stream_sidebar_actions.hbs
+++ b/static/templates/stream_sidebar_actions.hbs
@@ -47,6 +47,12 @@
{{/if}}
</a>
</li>
+ <li>
+ <a tabindex="0" class="popover_new_topic_button">
+ <i class="fa fa-plus" aria-hidden="true"></i>
+ {{t "New topic" }}
+ </a>
+ </li>
<li>
<a tabindex="0" class="popover_sub_unsub_button" data-name="{{stream.name}}">
<i class='fa fa-envelope' aria-hidden="true"></i>