compose: Update mobile message buttons popover logic.

Instead of displaying contextual options in the message buttons popover
based on the message type, we instead abstract the logic behind the
scenes and instead just show the "Start new conversation" with the
relevant hotkey hint.

This also removes the `is_in_private_narrow` parameter which now serves
no purpose in the popover template, as we display the
"New direct message" option in all cases.
This commit is contained in:
Sayam Samal
2024-06-27 21:05:39 +05:30
committed by Tim Abbott
parent a62337d08f
commit 2165fe7e3c
2 changed files with 4 additions and 17 deletions

View File

@@ -6,7 +6,6 @@ import render_mobile_message_buttons_popover from "../templates/popovers/mobile_
import * as compose_actions from "./compose_actions";
import * as giphy_state from "./giphy_state";
import * as narrow_state from "./narrow_state";
import * as popover_menus from "./popover_menus";
import * as popovers from "./popovers";
import * as rows from "./rows";
@@ -29,13 +28,7 @@ export function initialize() {
onShow(instance) {
popover_menus.popover_instances.compose_mobile_button = instance;
popover_menus.on_show_prep(instance);
instance.setContent(
parse_html(
render_mobile_message_buttons_popover({
is_in_private_narrow: narrow_state.narrowed_to_pms(),
}),
),
);
instance.setContent(parse_html(render_mobile_message_buttons_popover()));
},
onMount(instance) {
const $popper = $(instance.popper);

View File

@@ -3,21 +3,15 @@
<li role="none" class="link-item popover-menu-list-item">
<a role="menuitem" class="compose_mobile_stream_button popover-menu-link" tabindex="0">
<i class="popover-menu-icon zulip-icon zulip-icon-square-plus" aria-hidden="true"></i>
{{#if is_in_private_narrow }}
<span class="popover-menu-label">{{t "New channel message" }}</span>
{{else}}
<span class="popover-menu-label">{{t "New topic" }}</span>
{{/if}}
<span class="popover-menu-label">{{t "Start new conversation" }}</span>
{{popover_hotkey_hints "C"}}
</a>
</li>
<li role="none" class="link-item popover-menu-list-item">
<a role="menuitem" class="compose_mobile_direct_message_button popover-menu-link" tabindex="0">
<i class="popover-menu-icon zulip-icon zulip-icon-mail" aria-hidden="true"></i>
{{#if is_in_private_narrow }}
<span class="popover-menu-label">{{t "New direct message" }}</span>
{{else}}
<span class="popover-menu-label">{{t "New direct message" }}</span>
{{/if}}
{{popover_hotkey_hints "X"}}
</a>
</li>
</ul>