Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_report_modal: Use `server_report_message_types`.
PieterCKc11cc6d5eaa0
diff --git a/web/src/message_report.ts b/web/src/message_report.tsindex 71f6cc8ecbf..d0e5820f123 100644--- a/web/src/message_report.ts+++ b/web/src/message_report.ts@@ -10,27 +10,9 @@ import type {Option} from "./dropdown_widget.ts";import * as dropdown_widget from "./dropdown_widget.ts";import {$t_html} from "./i18n.ts";import type {Message} from "./message_store.ts";+import {realm} from "./state_data.ts";import * as ui_report from "./ui_report.ts";-export const message_report_type_options: Option[] = [- {- unique_id: "spam",- name: $t_html({defaultMessage: "Spam"}),- },- {- unique_id: "harassment",- name: $t_html({defaultMessage: "Harassment"}),- },- {- unique_id: "inappropriate",- name: $t_html({defaultMessage: "Inappropriate"}),- },- {- unique_id: "norms",- name: $t_html({defaultMessage: "Violates community norms"}),- },-];-export function show_message_report_modal(message: Message): void {const html_body = render_report_message_modal({});let report_type_dropdown_widget: dropdown_widget.DropdownWidget;@@ -51,14 +33,10 @@ export function show_message_report_modal(message: Message): void {}function get_message_report_types(): Option[] {- // Keep this in sync with zerver/models/realms/Realm.REPORT_MESSAGE_REASONS- return [- ...message_report_type_options,- {- unique_id: "other",- name: $t_html({defaultMessage: "Other reason"}),- },- ];+ return realm.server_report_message_types.map((report_type) => ({+ unique_id: report_type.key,+ name: report_type.name,+ }));}$message_report_description.on("input", check_toggle_submit_button);diff --git a/zerver/models/realms.py b/zerver/models/realms.pyindex cce49ef2ace..0af67a78a43 100644--- a/zerver/models/realms.py+++ b/zerver/models/realms.py@@ -444,8 +444,6 @@ class Realm(models.Model):ZULIP_SANDBOX_CHANNEL_NAME = gettext_lazy("sandbox")DEFAULT_NOTIFICATION_STREAM_NAME = gettext_lazy("general")STREAM_EVENTS_NOTIFICATION_TOPIC_NAME = gettext_lazy("channel events")- # Keep this in sync with the dropdown options in the message report- # modal (web/src/message_report.ts)REPORT_MESSAGE_REASONS = {"spam": gettext_lazy("Spam"),"harassment": gettext_lazy("Harassment"),