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.

message_summary: Minor changes to modal.

Aman Agrawal458b5200966f
diff --git a/web/src/message_summary.ts b/web/src/message_summary.ts
index 37050555e18..6e55f032809 100644
--- a/web/src/message_summary.ts
+++ b/web/src/message_summary.ts
@@ -8,7 +8,8 @@ import * as dialog_widget from "./dialog_widget.ts";
import {Filter} from "./filter.ts";
import {$t} from "./i18n.ts";
import * as message_fetch from "./message_fetch.ts";
-import * as stream_data from "./stream_data.ts";
+import * as unread from "./unread.ts";
+import * as unread_ops from "./unread_ops.ts";
import * as util from "./util.ts";
export function get_narrow_summary(channel_id: number, topic_name: string): void {
@@ -17,21 +18,36 @@ export function get_narrow_summary(channel_id: number, topic_name: string): void
{operator: "topic", operand: topic_name},
]);
const data = {narrow: message_fetch.get_narrow_for_message_fetch(filter)};
- const channel_name = stream_data.get_stream_name_from_id(channel_id);
const display_topic_name = util.get_final_topic_display_name(topic_name);
- dialog_widget.launch({
- html_heading: $t(
- {defaultMessage: "Summary of #${channel_name} > ${topic_name}:"},
- {channel_name, topic_name: display_topic_name},
- ),
- html_body: "",
- html_submit_button: "Close",
- close_on_submit: true,
+ const unread_topic_params = {
+ html_submit_button: $t({defaultMessage: "Mark topic as read"}),
+ html_exit_button: $t({defaultMessage: "Close"}),
+ on_click() {
+ unread_ops.mark_topic_as_read(channel_id, topic_name);
+ },
+ single_footer_button: false,
+ };
+
+ let params = {
+ html_submit_button: $t({defaultMessage: "Close"}),
on_click() {
// Just close the modal, there is nothing else to do.
},
- id: "topic-summary-modal",
single_footer_button: true,
+ };
+ if (unread.topic_has_any_unread(channel_id, topic_name)) {
+ params = {
+ ...params,
+ ...unread_topic_params,
+ };
+ }
+ dialog_widget.launch({
+ text_heading: display_topic_name,
+ html_body: "",
+ close_on_submit: true,
+ id: "topic-summary-modal",
+ footer_minor_text: $t({defaultMessage: "AI summaries may have errors."}),
+ ...params,
post_render() {
const close_on_success = false;
dialog_widget.submit_api_request(
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index 7cbfb4962be..53fdc33e38f 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -2053,3 +2053,7 @@ body:not(.hide-left-sidebar) {
font-style: italic;
margin-right: auto;
}
+
+#topic-summary-modal {
+ width: 45rem;
+}