message_view_header: Manage no description in message_view_header.

This commit modifies the behavior of the message view header
when a stream's description is empty. Previously, it displayed
"(no description)". With this change, if the user is an admin
or owner (i.e., has permission to update the description), it
will now display a "Add description" link to the settings. If
the user does not have these permissions, it will display nothing.

Fixes #28851

Signed-off-by: Sayyed Arib Hussain <sayyedaribhussain4321@gmail.com>
This commit is contained in:
Sayyed Arib Hussain 2024-02-08 16:18:48 +05:30 committed by Tim Abbott
parent 2a59edda53
commit 8e39123839
2 changed files with 8 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import * as peer_data from "./peer_data";
import * as recent_view_util from "./recent_view_util";
import * as rendered_markdown from "./rendered_markdown";
import * as search from "./search";
import {current_user} from "./state_data";
function get_message_view_header_context(filter) {
if (recent_view_util.is_visible()) {
@ -47,8 +48,9 @@ function get_message_view_header_context(filter) {
// involves a stream which exists and
// the current user can access.
const current_stream = filter._sub;
context.rendered_narrow_description = current_stream.rendered_description;
const sub_count = peer_data.get_subscriber_count(current_stream.stream_id);
context.is_admin = current_user.is_admin;
context.rendered_narrow_description = current_stream.rendered_description;
context.sub_count = sub_count;
context.stream = current_stream;
context.stream_settings_link =

View File

@ -16,7 +16,11 @@
{{#if rendered_narrow_description}}
{{rendered_markdown rendered_narrow_description}}
{{else}}
{{t "(no description)"}}
{{#if is_admin}}
<a href="{{stream_settings_link}}">
{{t "Add a description"}}
</a>
{{/if}}
{{/if}}
</span>
{{else}}