message_controls: Remove view message source icon.

With this commit, if a user cannot edit or move his own message,
we no longer show the view message source icon.
This commit is contained in:
Sayam Samal 2024-04-02 12:17:55 +05:30 committed by Tim Abbott
parent 7744c8b264
commit 27c85af6d9
6 changed files with 4 additions and 18 deletions

View File

@ -132,11 +132,6 @@ Copyright: 2013-2023 Cole Bemis (https://feathericons.com)
License: Expat License: Expat
Comment: Icon has been modified by Vlad Koborov Comment: Icon has been modified by Vlad Koborov
Files: web/shared/icons/source-alt.svg
Copyright: 2013-2023 Cole Bemis (https://feathericons.com)
License: Expat
Comment: Icon has been modified by Vlad Koborov
Files: web/shared/icons/star.svg Files: web/shared/icons/star.svg
Copyright: 2013-2023 Cole Bemis (https://feathericons.com) Copyright: 2013-2023 Cole Bemis (https://feathericons.com)
License: Expat License: Expat

View File

@ -291,7 +291,7 @@ export function initialize() {
// MESSAGE EDITING // MESSAGE EDITING
$("body").on("click", ".edit_content_button, .view_source_button", function (e) { $("body").on("click", ".edit_content_button", function (e) {
assert(message_lists.current !== undefined); assert(message_lists.current !== undefined);
const $row = message_lists.current.get_row(rows.id($(this).closest(".message_row"))); const $row = message_lists.current.get_row(rows.id($(this).closest(".message_row")));
message_lists.current.select_id(rows.id($row)); message_lists.current.select_id(rows.id($row));

View File

@ -42,18 +42,15 @@ export function message_hover($message_row) {
const args = { const args = {
is_content_editable: is_content_editable && !message.status_message, is_content_editable: is_content_editable && !message.status_message,
can_move_message, can_move_message,
msg_id: id,
}; };
const $edit_content = $message_row.find(".edit_content"); const $edit_content = $message_row.find(".edit_content");
$edit_content.html(render_edit_content_button(args)); $edit_content.html(render_edit_content_button(args));
let data_template_id = "view-source-tooltip-template";
if (args.is_content_editable) { if (args.is_content_editable) {
data_template_id = "edit-content-tooltip-template"; $edit_content.attr("data-tooltip-template-id", "edit-content-tooltip-template");
} else if (args.can_move_message) { } else if (args.can_move_message) {
data_template_id = "move-message-tooltip-template"; $edit_content.attr("data-tooltip-template-id", "move-message-tooltip-template");
} }
$edit_content.attr("data-tooltip-template-id", data_template_id);
} }
export function initialize() { export function initialize() {

View File

@ -2,6 +2,4 @@
<i class="zulip-icon zulip-icon-edit edit_content_button edit_message_button" role="button" tabindex="0" aria-label="{{t 'Edit message' }} (e)"></i> <i class="zulip-icon zulip-icon-edit edit_content_button edit_message_button" role="button" tabindex="0" aria-label="{{t 'Edit message' }} (e)"></i>
{{else if can_move_message}} {{else if can_move_message}}
<i class="zulip-icon zulip-icon-move-alt move_message_button edit_message_button" role="button" tabindex="0" aria-label="{{t 'Move message' }} (m)"></i> <i class="zulip-icon zulip-icon-move-alt move_message_button edit_message_button" role="button" tabindex="0" aria-label="{{t 'Move message' }} (m)"></i>
{{else}}
<i class="zulip-icon zulip-icon-source-alt view_source_button edit_message_button" role="button" tabindex="0" aria-label="{{t 'View message source' }} (e)" data-message-id="{{msg_id}}"></i>
{{/if}} {{/if}}

View File

@ -1,6 +1,6 @@
<div class="message_controls no-select"> <div class="message_controls no-select">
{{#if msg/sent_by_me}} {{#if msg/sent_by_me}}
<div class="edit_content message_control_button" data-tooltip-template-id="view-source-tooltip-template"></div> <div class="edit_content message_control_button"></div>
{{/if}} {{/if}}
{{#unless msg/sent_by_me}} {{#unless msg/sent_by_me}}

View File

@ -146,10 +146,6 @@
{{t "Move message" }} {{t "Move message" }}
{{tooltip_hotkey_hints "M"}} {{tooltip_hotkey_hints "M"}}
</template> </template>
<template id="view-source-tooltip-template">
{{t "View message source" }}
{{tooltip_hotkey_hints "E"}}
</template>
<template id="add-emoji-tooltip-template"> <template id="add-emoji-tooltip-template">
{{t "Add emoji reaction" }} {{t "Add emoji reaction" }}
{{tooltip_hotkey_hints ":"}} {{tooltip_hotkey_hints ":"}}