Skip to content

Conversation

@chungwwei
Copy link
Contributor

A follow up to #1956. Marking it as draft for now, will need to rebase on top of #1956.

Screenshot
Before After
light_before light_after
Before After
dark_before dark_after

Fixes: #1843

@chungwwei chungwwei marked this pull request as draft November 11, 2025 16:11
@chungwwei chungwwei force-pushed the hide-topic-input branch 2 times, most recently from d6f17cd to a938e0c Compare December 11, 2025 02:43
@chungwwei chungwwei marked this pull request as ready for review December 11, 2025 03:04
@chungwwei
Copy link
Contributor Author

chungwwei commented Dec 11, 2025

two things I noticed while working on this pr.

  • when in channel narrow view, the top-right Topics icon can probably be hidden, since there is only one topic.
  • web treat the topic Input as read-only with text General Chat, so we should match that instead of hiding the topic input?

@rajveermalviya rajveermalviya added the maintainer review PR ready for review by Zulip maintainers label Dec 12, 2025
@rajveermalviya rajveermalviya self-assigned this Dec 12, 2025
Copy link
Member

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @chungwwei! Initial comments below.

two things I noticed while working on this pr.

  • when in channel narrow view, the top-right Topics icon can probably be hidden, since there is only one topic.

  • web treat the topic Input as read-only with text General Chat, so we should match that instead of hiding the topic input?

These are great questions for the #mobile-design channel, so please open a discussion and ask them there.

streamId: narrow.streamId,
controller: controller,
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick manual test and noticed that ComposeBoxController.requestFocusIfUnfocused doesn't work correctly with this implementation. So when selecting the general-chat-only channel from Share-to-Zulip page, the content box doesn't get focused automatically and presumably the non-existent topic box is being focused instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what the correct implementation here would be. @gnprice @chrisbobbe Should this type of channel use the FixedDestinationComposeBoxController/_FixedDestinationComposeBoxBody directly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Yeah, I think the fixed-destination compose box is a good solution for preventing the sort of problem you spotted.

In principle that leaves a case which is a bit tricky, which is when the channel changes from single-topic to normal or vice versa while the compose box is open. I think it's fine if the compose box just doesn't react to that, and carries on as if the channel still had the old setting. That's going to be a rare case, and if the user eventually hits send at the end of it then they should get a coherent error message from the server, and have the opportunity to copy their attempted message text so they can try again.

Comment on lines +2364 to +2386
group('compose box inputs visibility by topic policy', () {
void testComposeBoxWidgetVisibility({required TopicsPolicy topicsPolicy, required bool shouldShowTopicInput}) {
final description = shouldShowTopicInput ?
'show topic input when topic policy is $topicsPolicy':
'hide topic input when topic policy is $topicsPolicy';

testWidgets(description, (tester) async {
final channel = eg.stream(topicsPolicy: topicsPolicy);

await prepareComposeBox(tester, narrow: ChannelNarrow(channel.streamId), streams: [channel]);

check(contentInputFinder).findsOne();
shouldShowTopicInput ?
check(topicInputFinder).findsOne():
check(topicInputFinder).findsNothing();
});
}

testComposeBoxWidgetVisibility(topicsPolicy: TopicsPolicy.inherit, shouldShowTopicInput: true);
testComposeBoxWidgetVisibility(topicsPolicy: TopicsPolicy.allowEmptyTopic, shouldShowTopicInput: true);
testComposeBoxWidgetVisibility(topicsPolicy: TopicsPolicy.disableEmptyTopic, shouldShowTopicInput: true);
testComposeBoxWidgetVisibility(topicsPolicy: TopicsPolicy.emptyTopicOnly, shouldShowTopicInput: false);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line too long, please limit lines to 80 characters.

@chungwwei
Copy link
Contributor Author

Thanks for reviewing @rajveermalviya!

Apologies, I underestimated the time commitment and haven't been able to keep up due to other commitments. I maybe able to revisit this after the new year if the issue isn't resolved by someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer review PR ready for review by Zulip maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide topic field on channels restricted to "general chat" only

3 participants