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.

popovers: Display move topic option to all users with permission.

Tim Abbott889e98f46776
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index f1f2f280557..ce52409c77d 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -20,6 +20,7 @@ import * as muting_ui from "./muting_ui";
import {page_params} from "./page_params";
import * as popovers from "./popovers";
import * as resize from "./resize";
+import * as settings_data from "./settings_data";
import * as starred_messages from "./starred_messages";
import * as starred_messages_ui from "./starred_messages_ui";
import * as stream_bar from "./stream_bar";
@@ -240,12 +241,16 @@ function build_topic_popover(opts) {
const topic_muted = muting.is_topic_muted(sub.stream_id, topic_name);
const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0;
+ // Arguably, we could offer the "Move topic" option even if users
+ // can only edit the name within a stream.
+ const can_move_topic = settings_data.user_can_move_messages_between_streams();
const content = render_topic_sidebar_actions({
stream_name: sub.name,
stream_id: sub.stream_id,
topic_name,
topic_muted,
+ can_move_topic,
is_realm_admin: page_params.is_admin,
color: sub.color,
has_starred_messages,
diff --git a/static/templates/topic_sidebar_actions.hbs b/static/templates/topic_sidebar_actions.hbs
index 46c0cfe7a7d..f6e461c6064 100644
--- a/static/templates/topic_sidebar_actions.hbs
+++ b/static/templates/topic_sidebar_actions.hbs
@@ -40,25 +40,23 @@
</a>
</li>
- {{#if is_realm_admin}}
-
- <div class="admin-separator">{{#tr}}ADMIN ACTIONS{{/tr}}</div>
+ {{#if can_move_topic}}
+ <hr />
<li>
- <a tabindex="0" class="sidebar-popover-delete-topic-messages" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
- <i class="fa fa-trash" aria-hidden="true"></i>
- {{t "Delete topic"}}
+ <a tabindex="0" class="sidebar-popover-move-topic-messages" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
+ <i class="fa fa-arrows" aria-hidden="true"></i>
+ {{t "Move topic"}}
</a>
</li>
{{/if}}
{{#if is_realm_admin}}
<li>
- <a tabindex="0" class="sidebar-popover-move-topic-messages" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
- <i class="fa fa-arrows" aria-hidden="true"></i>
- {{t "Move topic"}}
+ <a tabindex="0" class="sidebar-popover-delete-topic-messages" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
+ <i class="fa fa-trash" aria-hidden="true"></i>
+ {{t "Delete topic"}}
</a>
</li>
{{/if}}
-
</ul>