mirror of
https://github.com/zulip/zulip.git
synced 2026-06-27 21:01:32 +08:00
compose: Update textarea placeholder with general chat.
This commit is contained in:
parent
cae48d3faa
commit
29fb5ff934
@ -25,7 +25,7 @@ import * as people from "./people.ts";
|
||||
import {postprocess_content} from "./postprocess_content.ts";
|
||||
import * as rendered_markdown from "./rendered_markdown.ts";
|
||||
import * as rtl from "./rtl.ts";
|
||||
import {current_user} from "./state_data.ts";
|
||||
import {current_user, realm} from "./state_data.ts";
|
||||
import * as stream_data from "./stream_data.ts";
|
||||
import * as user_status from "./user_status.ts";
|
||||
import * as util from "./util.ts";
|
||||
@ -426,10 +426,20 @@ export function compute_placeholder_text(opts: ComposePlaceholderOptions): strin
|
||||
}
|
||||
}
|
||||
|
||||
if (stream_name && opts.topic) {
|
||||
let topic_display_name: string | undefined;
|
||||
if (opts.topic !== "") {
|
||||
topic_display_name = opts.topic;
|
||||
} else if (
|
||||
!realm.realm_mandatory_topics &&
|
||||
!$("input#stream_message_recipient_topic").is(":focus")
|
||||
) {
|
||||
topic_display_name = util.get_final_topic_display_name(opts.topic);
|
||||
}
|
||||
|
||||
if (stream_name && topic_display_name !== undefined) {
|
||||
return $t(
|
||||
{defaultMessage: "Message #{channel_name} > {topic_name}"},
|
||||
{channel_name: stream_name, topic_name: opts.topic},
|
||||
{channel_name: stream_name, topic_name: topic_display_name},
|
||||
);
|
||||
} else if (stream_name) {
|
||||
return $t({defaultMessage: "Message #{channel_name}"}, {channel_name: stream_name});
|
||||
|
||||
@ -283,6 +283,10 @@ export function dispatch_normal_event(event) {
|
||||
"can_create_web_public_channel_group",
|
||||
);
|
||||
}
|
||||
|
||||
if (event.property === "mandatory_topics") {
|
||||
compose_recipient.update_compose_area_placeholder_text();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "update_dict":
|
||||
|
||||
@ -524,6 +524,9 @@ run_test("realm settings", ({override}) => {
|
||||
});
|
||||
assert_same(realm.realm_name, "new_realm_name");
|
||||
|
||||
event = event_fixtures.realm__update__mandatory_topics;
|
||||
test_realm_boolean(event, "realm_mandatory_topics");
|
||||
|
||||
event = event_fixtures.realm__update__org_type;
|
||||
dispatch(event);
|
||||
assert_same(realm.realm_org_type, 50);
|
||||
|
||||
@ -347,6 +347,13 @@ exports.fixtures = {
|
||||
value: false,
|
||||
},
|
||||
|
||||
realm__update__mandatory_topics: {
|
||||
type: "realm",
|
||||
op: "update",
|
||||
property: "mandatory_topics",
|
||||
value: false,
|
||||
},
|
||||
|
||||
realm__update__name: {
|
||||
type: "realm",
|
||||
op: "update",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user