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.

stream_settings: Use view-only styling for the channel description.

PieterCKd33b738e6092
diff --git a/web/e2e-tests/stream_create.test.ts b/web/e2e-tests/stream_create.test.ts
index 90b6ba7c4ed..45ac65f236b 100644
--- a/web/e2e-tests/stream_create.test.ts
+++ b/web/e2e-tests/stream_create.test.ts
@@ -108,7 +108,7 @@ async function create_stream(page: Page): Promise<void> {
);
const stream_name = await common.get_text_from_selector(
page,
- ".stream-header .stream-name .sub-stream-name",
+ ".selected-stream-title .stream-name-title",
);
const stream_description = await common.get_text_from_selector(
page,
diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts
index d69e9a21bc1..abe5e1b7406 100644
--- a/web/src/stream_edit.ts
+++ b/web/src/stream_edit.ts
@@ -741,6 +741,16 @@ export function initialize(): void {
},
);
+ $("body").on("click", "#channel_title_open_channel_info_modal", (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const $target = $(e.currentTarget).parents(".stream-title-buttons");
+ const stream_id = Number.parseInt($target.attr("data-stream-id")!, 10);
+
+ dialog_widget.close();
+ open_stream_edit_modal(stream_id);
+ });
+
$("body").on("click", "#change_stream_info_modal #archived_stream_rename", (e) => {
e.preventDefault();
e.stopPropagation();
diff --git a/web/src/stream_settings_components.ts b/web/src/stream_settings_components.ts
index acd617ca6b5..65b89105d7e 100644
--- a/web/src/stream_settings_components.ts
+++ b/web/src/stream_settings_components.ts
@@ -46,9 +46,14 @@ function set_visibility_for_stream_title_buttons(sub: StreamSubscription): void
`.stream-title-buttons[data-stream-id='${CSS.escape(sub.stream_id.toString())}'] .reactivate`,
);
+ const $edit_stream_button = $(
+ `.stream-title-buttons[data-stream-id='${CSS.escape(sub.stream_id.toString())}'] #channel_title_open_channel_info_modal`,
+ );
+
if (!stream_data.can_administer_channel(sub)) {
$archive_button.hide();
$unarchive_button.hide();
+ $edit_stream_button.hide();
return;
}
@@ -117,6 +122,7 @@ export const show_subs_pane = {
name: "",
invite_only: false,
is_web_public: false,
+ can_change_name_description: false,
},
}),
)
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index 3adcd060b70..41aab9a06ca 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -1215,15 +1215,13 @@ h4.user_group_setting_subsection_title {
}
}
- .group-header,
- .stream-header {
+ .group-header {
white-space: nowrap;
padding-top: 5px;
display: flex;
align-items: center;
- .group-name-wrapper,
- .stream-name {
+ .group-name-wrapper {
position: relative;
font-size: 1.5em;
font-weight: 600;
@@ -1234,8 +1232,7 @@ h4.user_group_setting_subsection_title {
overflow-x: clip;
text-overflow: ellipsis;
- .group-name,
- .sub-stream-name {
+ .group-name {
display: block;
width: 100%;
overflow: hidden;
@@ -1246,27 +1243,34 @@ h4.user_group_setting_subsection_title {
.button-group {
margin-left: auto;
}
+ }
- .large-icon {
- display: flex;
- margin-right: 5px;
+ .channel-description-field {
+ display: flex;
+ flex-wrap: wrap;
+ /* 10px at 16px */
+ margin: 0 0 0.625em;
- &.hash::after {
- top: -1px;
- font-size: 1.09em;
- font-weight: 700;
- }
+ /* Subtract the total horizontal padding and border width from the input width
+ so that this matches other setting elements using box-sizing: border-box. */
+ .settings-view-only-textarea {
+ width: calc(
+ var(--modal-input-width) - 2 *
+ var(--view-only-field-horizontal-padding) - 2 *
+ var(--input-border-width)
+ );
+ }
- .zulip-icon {
- font-size: 1.2857em; /* 18px at 14px/em */
- }
+ .icon-button {
+ align-items: baseline;
}
}
.group-description-wrapper,
.stream-description {
hyphens: auto;
- margin-bottom: 10px;
+ display: flex;
+ align-items: center;
.no-description {
font-style: italic;
@@ -1575,8 +1579,7 @@ h4.user_group_setting_subsection_title {
margin-top: 10px;
}
- .group-header,
- .stream-header {
+ .group-header {
.button-group {
margin-top: -5px;
}
diff --git a/web/templates/stream_settings/selected_stream_title.hbs b/web/templates/stream_settings/selected_stream_title.hbs
index 5849ee8231c..53dd236603a 100644
--- a/web/templates/stream_settings/selected_stream_title.hbs
+++ b/web/templates/stream_settings/selected_stream_title.hbs
@@ -20,6 +20,14 @@
{{#with sub}}
<div class="button-group stream-title-buttons" data-stream-id="{{stream_id}}">
<div class="left-end button-group">
+ {{> ../components/icon_button
+ icon="edit"
+ intent="neutral"
+ custom_classes="tippy-zulip-delayed-tooltip"
+ id="channel_title_open_channel_info_modal"
+ data-tippy-content=(t 'Edit channel name and description')
+ hidden=(not can_change_name_description)
+ }}
</div>
<div class="right-end button-group">
<div class="large-window-alert-notification-container">
diff --git a/web/templates/stream_settings/stream_description.hbs b/web/templates/stream_settings/stream_description.hbs
index 25b3c5af018..8faf49aabe9 100644
--- a/web/templates/stream_settings/stream_description.hbs
+++ b/web/templates/stream_settings/stream_description.hbs
@@ -1,7 +1,7 @@
{{#if rendered_description}}
-<span class="sub-stream-description rendered_markdown">
+<div class="sub-stream-description settings-view-only-textarea rendered_markdown">
{{rendered_markdown rendered_description}}
-</span>
+</div>
{{else}}
<span class="sub-stream-description no-description">
{{t "No description." }}
diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbs
index 4ab38a30263..f109ac60169 100644
--- a/web/templates/stream_settings/stream_settings.hbs
+++ b/web/templates/stream_settings/stream_settings.hbs
@@ -12,29 +12,27 @@
<div class="stream-settings-tip-container">
{{> stream_settings_tip .}}
</div>
- <div class="stream-header">
- {{> stream_privacy_icon
- invite_only=invite_only
- is_web_public=is_web_public
- is_archived=is_archived }}
- <div class="stream-name">
- <span class="sub-stream-name" data-tippy-content="{{name}}">{{name}}</span>
- </div>
- <div class="button-group" {{#unless can_change_name_description}}style="display:none"{{/unless}}>
+ <div class="channel-description-box">
+ <label class="settings-field-label">
+ {{t "Description" }}
+ {{> ../help_link_widget link="/help/change-the-channel-description" }}
+ </label>
+ <div class="channel-description-field">
+ <div class="stream-description">
+ {{> stream_description
+ rendered_description=rendered_description
+ }}
+ </div>
{{> ../components/icon_button
icon="edit"
intent="neutral"
custom_classes="tippy-zulip-delayed-tooltip"
id="open_stream_info_modal"
data-tippy-content=(t 'Edit channel name and description' )
+ hidden=(not can_change_name_description)
}}
</div>
</div>
- <div class="stream-description">
- {{> stream_description
- rendered_description=rendered_description
- }}
- </div>
<div class="creator_details stream_details_box">
{{> ../creator_details .}}
</div>