Skip to content

Commit

Permalink
topics: Rename "(no topic)" to "general chat".
Browse files Browse the repository at this point in the history
Messages sent without a topic is now displayed as going
to "general chat".

Fixes zulip#23291.
  • Loading branch information
sofbe committed Oct 20, 2022
1 parent 550a32b commit 1941a5c
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion static/js/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function abort_video_callbacks(edit_message_id = "") {
}

export function empty_topic_placeholder() {
return $t({defaultMessage: "(no topic)"});
return $t({defaultMessage: "general chat"});
}

export function create_message_object() {
Expand Down
2 changes: 1 addition & 1 deletion static/js/compose_validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ function validate_stream_message() {
const topic = compose_state.topic();
// TODO: We plan to migrate the empty topic to only using the
// `""` representation for i18n reasons, but have not yet done so.
if (topic === "" || topic === "(no topic)") {
if (topic === "" || topic === "general chat") {
compose_error.show(
$t_html({defaultMessage: "Topics are required in this organization"}),
$("#stream_message_recipient_topic"),
Expand Down
2 changes: 1 addition & 1 deletion templates/zerver/help/configure-who-can-edit-topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ learning how to use topics effectively. However, you can restrict the ability to
edit the topic of any message to specific [roles](/help/roles-and-permissions).

Note that users may still be able to edit the topic of messages with
**(no topic)**; see the full article on [message and topic
**general chat**; see the full article on [message and topic
editing](/help/configure-message-editing-and-deletion) for details.

Also, only administrators and moderators can edit the topics of
Expand Down
2 changes: 1 addition & 1 deletion templates/zerver/help/require-topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ specified topic.
## Stream messages without a topic

If a user sends a message without a topic, the message's topic is
displayed as **(no topic)**.
displayed as **general chat**.

When [message editing](/help/configure-message-editing-and-deletion)
is enabled, any user can [add a topic](/help/rename-a-topic)
Expand Down
4 changes: 2 additions & 2 deletions zerver/actions/message_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def can_edit_topic(
if message.sender_id == user_profile.id:
return True

# We allow anyone to edit (no topic) messages to help tend them.
# We allow anyone to edit general chat messages to help tend them.
if is_no_topic_msg:
return True

Expand Down Expand Up @@ -937,7 +937,7 @@ def check_update_message(
if message.sender_id != user_profile.id:
raise JsonableError(_("You don't have permission to edit this message"))

is_no_topic_msg = message.topic_name() == "(no topic)"
is_no_topic_msg = message.topic_name() == "general chat"

if topic_name is not None and not can_edit_topic(message, user_profile, is_no_topic_msg):
raise JsonableError(_("You don't have permission to edit this message"))
Expand Down
2 changes: 1 addition & 1 deletion zerver/actions/message_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ def check_message(
# else can sneak past the access check.
assert sender.bot_type == sender.OUTGOING_WEBHOOK_BOT

if realm.mandatory_topics and topic_name == "(no topic)":
if realm.mandatory_topics and topic_name == "general chat":
raise JsonableError(_("Topics are required in this organization"))

elif addressee.is_private():
Expand Down
4 changes: 2 additions & 2 deletions zerver/lib/email_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,11 @@ def is_forwarded(subject: str) -> bool:

def process_stream_message(to: str, message: EmailMessage) -> None:
subject_header = message.get("Subject", "")
subject = strip_from_subject(subject_header) or "(no topic)"
subject = strip_from_subject(subject_header) or "general chat"

# We don't want to reject email messages with disallowed characters in the Subject,
# so we just remove them to make it a valid Zulip topic name.
subject = "".join([char for char in subject if is_character_printable(char)]) or "(no topic)"
subject = "".join([char for char in subject if is_character_printable(char)]) or "general chat"

stream, options = decode_stream_email_address(to)
# Don't remove quotations if message is forwarded, unless otherwise specified:
Expand Down
4 changes: 2 additions & 2 deletions zerver/migrations/0371_invalid_characters_in_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def fix_topics(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None
continue

# We don't want empty topics for stream messages, so we
# use (no topic) if the above clean-up leaves us with an empty string.
# use general chat if the above clean-up leaves us with an empty string.
if fixed_topic == "":
fixed_topic = "(no topic)"
fixed_topic = "general chat"

cursor.execute(
"UPDATE zerver_message SET subject = %s WHERE subject = %s AND id > %s AND id <= %s",
Expand Down
8 changes: 4 additions & 4 deletions zerver/tests/test_email_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def test_receive_stream_email_messages_blank_subject_success(self) -> None:

self.assertEqual(message.content, "TestStreamEmailMessages body")
self.assertEqual(get_display_recipient(message.recipient), stream.name)
self.assertEqual(message.topic_name(), "(no topic)")
self.assertEqual(message.topic_name(), "general chat")

def test_receive_stream_email_messages_subject_with_nonprintable_chars(self) -> None:
user_profile = self.example_user("hamlet")
Expand Down Expand Up @@ -362,7 +362,7 @@ def test_receive_stream_email_messages_subject_with_nonprintable_chars(self) ->
process_message(incoming_valid_message)
message = most_recent_message(user_profile)

self.assertEqual(message.topic_name(), "(no topic)")
self.assertEqual(message.topic_name(), "general chat")

def test_receive_private_stream_email_messages_success(self) -> None:
user_profile = self.example_user("hamlet")
Expand Down Expand Up @@ -1532,12 +1532,12 @@ def test_process_message_strips_subject(self) -> None:
message = most_recent_message(user_profile)
self.assertEqual("Test", message.topic_name())

# If after stripping we get an empty subject, it should get set to (no topic)
# If after stripping we get an empty subject, it should get set to general chat
del incoming_valid_message["Subject"]
incoming_valid_message["Subject"] = "Re: Fwd: Re: "
process_message(incoming_valid_message)
message = most_recent_message(user_profile)
self.assertEqual("(no topic)", message.topic_name())
self.assertEqual("general chat", message.topic_name())

def test_strip_from_subject(self) -> None:
subject_list = orjson.loads(self.fixture_data("subjects.json", type="email"))
Expand Down
4 changes: 2 additions & 2 deletions zerver/tests/test_message_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,8 @@ def do_edit_message_assert_error(
id_, "G", "The time limit for editing this message's topic has passed", "cordelia"
)

# anyone should be able to edit "no topic" indefinitely
message.set_topic_name("(no topic)")
# anyone should be able to edit "general chat" indefinitely
message.set_topic_name("general chat")
message.save()
do_edit_message_assert_success(id_, "D", "cordelia")

Expand Down
2 changes: 1 addition & 1 deletion zerver/tests/test_message_send.py
Original file line number Diff line number Diff line change
Expand Up @@ -2704,7 +2704,7 @@ def test_no_topic_message(self) -> None:
sender = self.example_user("iago")
client = make_client(name="test suite")
stream = get_stream("Denmark", realm)
topic_name = "(no topic)"
topic_name = "general chat"
message_content = "whatever"
addressee = Addressee.for_stream(stream, topic_name)

Expand Down
26 changes: 13 additions & 13 deletions zerver/webhooks/slack_incoming/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class SlackIncomingHookTests(WebhookTestCase):
WEBHOOK_DIR_NAME = "slack_incoming"

def test_message(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
Hello, world.
""".strip()
Expand Down Expand Up @@ -59,7 +59,7 @@ def test_message_with_actions(self) -> None:
)

def test_message_with_blocks(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
Danny Torrence left the following review for your property:
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_complicated(self) -> None:
# Paste the JSON into
# https://api.slack.com/tools/block-kit-builder to see how it
# is rendered in Slack
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## Hello from TaskBot
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_complicated(self) -> None:
def test_attachment_blocks(self) -> None:
# On https://api.slack.com/tools/block-kit-builder choose
# "Attachment preview" and paste the JSON in.
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
This is a section block with an accessory image.
Expand All @@ -160,7 +160,7 @@ def test_attachment_blocks(self) -> None:
)

def test_attachment_fields(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
Build bla bla succeeded
Expand All @@ -178,7 +178,7 @@ def test_attachment_fields(self) -> None:
)

def test_attachment_pieces(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## Test
Expand All @@ -201,7 +201,7 @@ def get_body(self, fixture_name: str) -> str:
return self.webhook_fixture_data("slack_incoming", fixture_name, file_type=file_type)

def test_attachment_pieces_title_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
Sample pretext.
Expand All @@ -221,7 +221,7 @@ def test_attachment_pieces_title_null(self) -> None:
)

def test_attachment_pieces_image_url_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## [Sample title.](https://www.google.com)
Expand All @@ -241,7 +241,7 @@ def test_attachment_pieces_image_url_null(self) -> None:
)

def test_attachment_pieces_ts_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## [Sample title.](https://www.google.com)
Expand All @@ -261,7 +261,7 @@ def test_attachment_pieces_ts_null(self) -> None:
)

def test_attachment_pieces_text_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## [Sample title.](https://www.google.com)
Expand All @@ -281,7 +281,7 @@ def test_attachment_pieces_text_null(self) -> None:
)

def test_attachment_pieces_pretext_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## [Sample title.](https://www.google.com)
Expand All @@ -301,7 +301,7 @@ def test_attachment_pieces_pretext_null(self) -> None:
)

def test_attachment_pieces_footer_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## [Sample title.](https://www.google.com)
Expand All @@ -321,7 +321,7 @@ def test_attachment_pieces_footer_null(self) -> None:
)

def test_attachment_pieces_title_link_null(self) -> None:
expected_topic = "(no topic)"
expected_topic = "general chat"
expected_message = """
## Sample title.
Expand Down
2 changes: 1 addition & 1 deletion zerver/webhooks/slack_incoming/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def api_slack_incoming_webhook(
user_specified_topic = re.sub("^[@#]", "", channel)

if user_specified_topic is None:
user_specified_topic = "(no topic)"
user_specified_topic = "general chat"

pieces = []
if "blocks" in payload and payload["blocks"]:
Expand Down

0 comments on commit 1941a5c

Please sign in to comment.