Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

general chat #2: support sending to empty topic from channel narrow, hide resolve/unresolve conditionally #1364

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Feb 19, 2025

Similar to #1297, this PR focuses on part of the general chat feature, with some final "do not merge" commits to make it testable.

This includes the following commits:

  • a5a2518 compose: Support sending to empty topic
  • 2a2a17b compose: Change content input hint text if topic is vacuous and mandatory
  • e584b97 compose [nfc]: Handle empty topics for fixed destination input hint text
  • 89291a0 compose test [nfc]: Extract ChannelNarrow variable
  • 0f44e10 action_sheet [nfc]: Hide resolve/unresolve button for empty topic

The remaining commits should be reviewed in #1297, but neither PR blocks each other, as they each focuses on a specific part of the feature.

Screenshots
mandatory topics non-empty topic content is focused content isn't focused
true mandatory-channel-non-empty mandatory-channel-empty-focused mandatory-channel-empty-non-focused
false non-mandatory-channel-non-empty non-mandatory-channel-empty-focused non-mandatory-channel-empty-non-focused
false (legacy, FL<334) / non-mandatory-channel-empty-focused-legacy non-mandatory-channel-empty-non-focused-legacy
hide resolve resolve

@PIG208 PIG208 marked this pull request as ready for review February 22, 2025 00:16
@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Feb 22, 2025
@PIG208 PIG208 requested a review from chrisbobbe February 22, 2025 00:35
@PIG208 PIG208 changed the title general chat #2: support sending to empty topic, hide resolve/unresolve conditionally general chat #2: support sending to empty topic from channel narrow, hide resolve/unresolve conditionally Feb 22, 2025
@PIG208 PIG208 removed the request for review from chrisbobbe February 26, 2025 02:40
@PIG208 PIG208 removed the maintainer review PR ready for review by Zulip maintainers label Feb 26, 2025
@PIG208

This comment was marked as resolved.

A test is skipped because the server does not send empty topics to the
client without "empty_topic_name" client capability.

Signed-off-by: Zixuan James Li <[email protected]>
@PIG208 PIG208 requested a review from chrisbobbe February 26, 2025 22:31
@PIG208 PIG208 added the maintainer review PR ready for review by Zulip maintainers label Feb 26, 2025
This helper will become more relevant within the context of
`ComposeTopicController`.

Signed-off-by: Zixuan James Li <[email protected]>
Previously, "Message #stream > (no topic)" would appear as the hint text
when the topic input is empty but mandatory.

The control flow of `getDestinationString` can be simplified. However,
it is structured this way to prepare for a later change to support
showing "general chat" in the hint text, that adds some more advanced
checks.

Signed-off-by: Zixuan James Li <[email protected]>
This does not rely on TopicName.displayName being non-nullable or
"empty_topic_name" client capability, so it is not an NFC change.

The key change that allows sending to empty topic is that
`textNormalized` can now be actually empty, instead of being
converted to "(no topic)" with `_computeTextNormalized`.

---

This is accompanied with a content input hint text change, so that
either "Message #stream > (no topic)" or
"Message #stream > general chat" appears appropriately.

Previously, "Message #stream > (no topic)" was the hint text for
content input as long as the topic input is empty and topics are not
mandatory.  Showing the default topic does not help create incentive
for the user to pick a topic first.  So only show it when they intend
to leave the topic empty.

See discussion:
  https://chat.zulip.org/#narrow/channel/530-mobile-design/topic/general.20chat.20design.20.23F1297/near/2088870

---

This does not aim to implement hint text changes to the topic input,
which is always "Topic".  We will handle that as a follow-up.

Signed-off-by: Zixuan James Li <[email protected]>
Look for `allow_empty_topic_name` and `empty_topic_name` under "Feature
level 334" in the API Changelog to verify the affected routes:
  https://zulip.com/api/changelog

To keep the API bindings thin, instead of setting
`allow_empty_topic_name` for the callers, we require the callers to pass
the appropriate values instead.

Instead of making this parameter a `bool` that defaults to `false`
(and have the bindings remove the field when it's `false`), we type it
as `bool?` and only drop it when it is `null`.  This is also for making
the API binding thin.

Fixes: zulip#1250

Signed-off-by: Zixuan James Li <[email protected]>
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.

2 participants