Skip to content

Commit 750a233

Browse files
committed
WIP compose: Omit "(no topic)" from hint when not allowed to send there; TODO fix tests, add tests
1 parent 940aeaf commit 750a233

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/widgets/compose_box.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,15 @@ class _StreamContentInputState extends State<_StreamContentInput> {
579579
super.dispose();
580580
}
581581

582-
/// The topic name to use in the hint text.
583-
TopicName _hintTopic() {
582+
/// The topic name to show in the hint text, or null to show no topic.
583+
TopicName? _hintTopic() {
584+
if (widget.controller.topic.isTopicVacuous) {
585+
if (widget.controller.topic.mandatory) {
586+
// The chosen topic can't be sent to, so don't show it.
587+
return null;
588+
}
589+
}
590+
584591
return TopicName(widget.controller.topic.textNormalized);
585592
}
586593

@@ -591,12 +598,13 @@ class _StreamContentInputState extends State<_StreamContentInput> {
591598

592599
final streamName = store.streams[widget.narrow.streamId]?.name
593600
?? zulipLocalizations.unknownChannelName;
594-
final hintDestination =
601+
final hintTopic = _hintTopic();
602+
final hintDestination = hintTopic == null ?
595603
// No i18n of this use of "#" and ">" string; those are part of how
596604
// Zulip expresses channels and topics, not any normal English punctuation,
597605
// so don't make sense to translate. See:
598606
// https://github.com/zulip/zulip-flutter/pull/1148#discussion_r1941990585
599-
'#$streamName > ${_hintTopic().displayName}';
607+
'#$streamName' : '#$streamName > ${hintTopic.displayName}';
600608

601609
return _ContentInput(
602610
narrow: widget.narrow,

0 commit comments

Comments
 (0)