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.

settings: Highlight empty organization description.

badassscoder976829104565
diff --git a/web/src/settings_org.ts b/web/src/settings_org.ts
index 35ad9937387..f706d76b78c 100644
--- a/web/src/settings_org.ts
+++ b/web/src/settings_org.ts
@@ -488,6 +488,19 @@ export function populate_realm_domains_label(
$("#allowed_domains_label").text($t({defaultMessage: "Allowed domains: {domains}"}, {domains}));
}
+// Show yellow outline when organization description is empty.
+// We use a class-based approach because :empty doesn't work for textareas.
+export function update_description_empty_state(): void {
+ // We do not show any indicator for non-admins.
+ if (!current_user.is_admin) {
+ return;
+ }
+ const $textarea = $<HTMLTextAreaElement>("#id_realm_description");
+ const description_text = $textarea.val()!;
+ const is_empty = description_text.trim() === "";
+ $textarea.toggleClass("empty-description", is_empty);
+}
+
export function populate_auth_methods(auth_method_to_bool_map: Record<string, boolean>): void {
if (!meta.loaded) {
return;
@@ -1482,6 +1495,9 @@ export function build_page(): void {
register_save_discard_widget_handlers($(".admin-realm-form"), "/json/realm", false);
maybe_restore_unsaved_welcome_message_custom_text();
+ update_description_empty_state();
+ $("#id_realm_description").on("input", update_description_empty_state);
+
$(".org-permissions-form").on(
"input change",
".time-limit-custom-input",
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 1d2ee04ea69..73c112f0807 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -163,6 +163,13 @@ h3,
margin-bottom: 0;
}
}
+/* Show yellow outline when organization description is empty,
+ matching the compose box "approaching limit" warning style. */
+.admin-realm-description.empty-description:not(:disabled) {
+ border-color: var(
+ --color-message-content-container-border-approaching-limit
+ );
+}
.admin-realm-welcome-message-custom-text {
margin-bottom: 10px;