mirror of https://github.com/zulip/zulip.git
popover_menus_data: Hide actions user can't take for archived channels.
This commit is contained in:
parent
e8bb9e2de1
commit
5dfa8ac9fe
|
@ -102,6 +102,10 @@ export function is_topic_editable(message: Message, edit_limit_seconds_buffer =
|
|||
return false;
|
||||
}
|
||||
|
||||
if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!settings_data.user_can_move_messages_to_another_topic()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -206,6 +210,10 @@ export function is_message_sent_by_my_bot(message: Message): boolean {
|
|||
}
|
||||
|
||||
export function get_deletability(message: Message): boolean {
|
||||
if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (settings_data.user_can_delete_any_message()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -243,6 +251,10 @@ export function is_stream_editable(message: Message, edit_limit_seconds_buffer =
|
|||
return false;
|
||||
}
|
||||
|
||||
if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!settings_data.user_can_move_messages_between_streams()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,10 @@ export function get_actions_popover_content_context(message_id: number): ActionP
|
|||
// `media_breakpoints.sm_min`, we need to include the reaction button in the
|
||||
// popover if it is not displayed.
|
||||
const should_display_add_reaction_option =
|
||||
!message.is_me_message && !is_add_reaction_icon_visible() && not_spectator;
|
||||
!message.is_me_message &&
|
||||
!is_add_reaction_icon_visible() &&
|
||||
not_spectator &&
|
||||
!(stream_id && stream_data.is_stream_archived(stream_id));
|
||||
|
||||
return {
|
||||
message_id: message.id,
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
margin-bottom: var(--message-box-markdown-aligned-vertical-space);
|
||||
}
|
||||
|
||||
.message_reaction_container {
|
||||
&.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.message_reaction {
|
||||
display: flex;
|
||||
/* Set a pixel and half padding to maintain
|
||||
|
@ -39,6 +45,10 @@
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-message-reaction-background-hover);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
{{#if msg/sent_by_me}}
|
||||
<div class="edit_content message_control_button"></div>
|
||||
{{/if}}
|
||||
{{#unless is_archived}}
|
||||
{{#if msg/sent_by_me}}
|
||||
<div class="edit_content message_control_button"></div>
|
||||
{{/if}}
|
||||
|
||||
{{#unless msg/sent_by_me}}
|
||||
<div class="reaction_button message_control_button" data-tooltip-template-id="add-emoji-tooltip-template">
|
||||
<div class="emoji-message-control-button-container">
|
||||
<i class="message-controls-icon zulip-icon zulip-icon-smile" aria-label="{{t 'Add emoji reaction' }} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
|
||||
{{#unless msg/sent_by_me}}
|
||||
<div class="reaction_button message_control_button" data-tooltip-template-id="add-emoji-tooltip-template">
|
||||
<div class="emoji-message-control-button-container">
|
||||
<i class="message-controls-icon zulip-icon zulip-icon-smile" aria-label="{{t 'Add emoji reaction' }} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/unless}}
|
||||
|
||||
<div class="actions_hover message_control_button" data-tooltip-template-id="message-actions-tooltip-template" >
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{> recipient_row use_match_properties=../use_match_properties}}
|
||||
{{#each message_containers}}
|
||||
{{#with this}}
|
||||
{{> single_message use_match_properties=../../use_match_properties message_list_id=../../message_list_id}}
|
||||
{{> single_message use_match_properties=../../use_match_properties message_list_id=../../message_list_id is_archived=../is_archived}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<div class="{{this.class}}" aria-label="{{this.label}}" data-reaction-id="{{this.local_id}}">
|
||||
{{#if this.emoji_alt_code}}
|
||||
<div class="emoji_alt_code"> :{{this.emoji_name}}:</div>
|
||||
{{else if this.is_realm_emoji}}
|
||||
<img src="{{this.url}}" class="emoji" />
|
||||
{{else}}
|
||||
<div class="emoji emoji-{{this.emoji_code}}"></div>
|
||||
{{/if}}
|
||||
<div class="message_reaction_count">{{this.vote_text}}</div>
|
||||
<div class="message_reaction_container {{#if is_archived}}disabled{{/if}}">
|
||||
<div class="{{this.class}} {{#if is_archived}}disabled{{/if}}" aria-label="{{this.label}}" data-reaction-id="{{this.local_id}}">
|
||||
{{#if this.emoji_alt_code}}
|
||||
<div class="emoji_alt_code"> :{{this.emoji_name}}:</div>
|
||||
{{else if this.is_realm_emoji}}
|
||||
<img src="{{this.url}}" class="emoji" />
|
||||
{{else}}
|
||||
<div class="emoji emoji-{{this.emoji_code}}"></div>
|
||||
{{/if}}
|
||||
<div class="message_reaction_count">{{this.vote_text}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<div class="message_reactions">
|
||||
{{#each this/msg/message_reactions}}
|
||||
{{> message_reaction}}
|
||||
{{> message_reaction is_archived=../is_archived}}
|
||||
{{/each}}
|
||||
<div class="reaction_button" role="button" aria-haspopup="true" data-tooltip-template-id="add-emoji-tooltip-template" aria-label="{{t 'Add emoji reaction' }} (:)">
|
||||
<div class="emoji-message-control-button-container">
|
||||
<i class="zulip-icon zulip-icon-smile" tabindex="0"></i>
|
||||
<div class="message_reaction_count">+</div>
|
||||
{{#unless is_archived}}
|
||||
<div class="reaction_button" role="button" aria-haspopup="true" data-tooltip-template-id="add-emoji-tooltip-template" aria-label="{{t 'Add emoji reaction' }} (:)">
|
||||
<div class="emoji-message-control-button-container">
|
||||
<i class="zulip-icon zulip-icon-smile" tabindex="0"></i>
|
||||
<div class="message_reaction_count">+</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</div>
|
||||
|
|
|
@ -46,6 +46,7 @@ mock_esm("../src/hash_util", {
|
|||
});
|
||||
mock_esm("../src/stream_data", {
|
||||
is_subscribed: () => true,
|
||||
is_stream_archived: () => false,
|
||||
});
|
||||
mock_esm("../src/group_permission_settings", {
|
||||
get_group_permission_setting_config() {
|
||||
|
|
Loading…
Reference in New Issue