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.

recent_view: Skip topic actions button for achived channels.

Aman Agrawal194a6b9ffa4a
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index 2bba7151543..baf35db512b 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -283,6 +283,16 @@ function is_table_focused(): boolean {
return $current_focus_elem === "table";
}
+function row_has_mute_column(row: number, $topic_rows: JQuery): boolean {
+ const type = get_row_type(row);
+ if (type === "private") {
+ return false;
+ }
+
+ const $topic_row = $topic_rows.eq(row);
+ return !$topic_row.hasClass("recent-view-archived-channel-row");
+}
+
function get_row_type(row: number): string {
// Return "private" or "stream"
// We use CSS method for finding row type until topics_widget gets initialized.
@@ -332,13 +342,14 @@ function set_table_focus(row: number, col: number, using_keyboard = false): bool
col = COLUMNS.topic;
col_focus = COLUMNS.topic;
}
+
+ const $topic_row = $topic_rows.eq(row);
const type = get_row_type(row);
- if (col === COLUMNS.mute && type === "private") {
+ if (col === COLUMNS.mute && !row_has_mute_column(row, $topic_rows)) {
col = unread ? COLUMNS.read : COLUMNS.topic;
col_focus = col;
}
- const $topic_row = $topic_rows.eq(row);
// We need to allow table to render first before setting focus.
setTimeout(
() => $topic_row.find(".recent_view_focusable").addBack().eq(col).trigger("focus"),
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index e603a599059..12b96aa67b9 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -1,4 +1,4 @@
-<tr id="recent_conversation:{{conversation_key}}" class="{{#unless (eq unread_count 0)}}unread_topic{{/unless}} {{#if is_private}}private_conversation_row{{/if}} recent-view-body-row recent_view_focusable" data-col-index="{{ column_indexes.topic }}" tabindex="0">
+<tr id="recent_conversation:{{conversation_key}}" class="{{#unless (eq unread_count 0)}}unread_topic{{/unless}} {{#if is_private}}private_conversation_row{{/if}} recent-view-body-row recent_view_focusable {{#if is_archived}}recent-view-archived-channel-row{{/if}}" data-col-index="{{ column_indexes.topic }}" tabindex="0">
{{!-- TODO: Rename recent_topic_name to recent-view-conversation-column--}}
<td class="recent_topic_name">
<div class="recent-view-conversation-with-unread-wrapper">
@@ -74,9 +74,8 @@
<div class="last_msg_time tippy-zulip-tooltip" data-tippy-content="{{this.full_last_msg_date_time}}">
<a class="last-msg-link" href="{{last_msg_url}}" tabindex="-1">{{ last_msg_time }}</a>
</div>
- {{#unless is_private}}
+ {{#unless (or is_archived is_private)}}
<div class="recent_topic_actions hidden-for-spectators recent_view_focusable recent-view-topic-visibility" data-col-index="{{ column_indexes.mute }}" tabindex="0">
- {{#unless is_archived}}
<span class="change_visibility_policy" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}">
{{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}}
<i class="zulip-icon zulip-icon-follow recipient_bar_icon visibility-status-icon" aria-label="{{t 'Topic actions menu' }}" aria-haspopup="true" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-topic-url="{{topic_url}}" data-tippy-content="{{t 'You follow this topic.'}}" role="button"></i>
@@ -88,7 +87,6 @@
<i class="zulip-icon zulip-icon-more-vertical recent-view-row-topic-menu visibility-status-icon" aria-label="{{t 'Topic actions menu' }}" aria-haspopup="true" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}" data-topic-url="{{topic_url}}" role="button"></i>
{{/if}}
</span>
- {{/unless}}
</div>
{{/unless}}
</div>