Skip to content

Commit b0d93f2

Browse files
committed
topics: Rename (no topic) to "general chat".
As plans to make it easier for new users to pick a topic and help with the onboarding process, we want to rename the default topic "(no topic)" to "general chat" for the messages sent without a topic. Previously, when topics are required to send a message for an organization, (no topic) was no longer an option as a topic name. With the rename, this restriction has been removed. Fixes: zulip#23291.
1 parent ea1357b commit b0d93f2

12 files changed

+32
-37
lines changed

help/require-topics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Require topics in stream messages
22

3-
If a user sends a message without a topic, the message's topic is displayed as
4-
**(no topic)**. Administrators can configure whether stream messages must have a
3+
If a user sends a message without a topic, the message's topic is set to
4+
**"general chat"**. Administrators can configure whether stream messages must have a
55
specified topic.
66

77
## Require topics in stream messages

web/src/compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function abort_video_callbacks(edit_message_id = "") {
115115
}
116116

117117
export function empty_topic_placeholder() {
118-
return $t({defaultMessage: "(no topic)"});
118+
return $t({defaultMessage: "general chat"});
119119
}
120120

121121
export function create_message_object() {

web/src/compose_validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ function validate_stream_message(scheduling_message) {
500500
const topic = compose_state.topic();
501501
// TODO: We plan to migrate the empty topic to only using the
502502
// `""` representation for i18n reasons, but have not yet done so.
503-
if (topic === "" || topic === "(no topic)") {
503+
if (topic === "") {
504504
compose_banner.show_error_message(
505505
$t({defaultMessage: "Topics are required in this organization."}),
506506
compose_banner.CLASSNAMES.topic_missing,

web/tests/compose_validate.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ test_ui("validate", ({override_rewire, mock_template}) => {
275275
name: "Denmark",
276276
};
277277
stream_data.add_sub(denmark);
278+
stream_data.subscribe_myself(denmark);
278279
compose_state.set_stream_name("Denmark");
279280
page_params.realm_mandatory_topics = true;
280281
compose_state.topic("");
@@ -291,9 +292,9 @@ test_ui("validate", ({override_rewire, mock_template}) => {
291292
assert.ok(missing_topic_error_rendered);
292293

293294
missing_topic_error_rendered = false;
294-
compose_state.topic("(no topic)");
295-
assert.ok(!compose_validate.validate());
296-
assert.ok(missing_topic_error_rendered);
295+
compose_state.topic("general chat");
296+
assert.ok(compose_validate.validate());
297+
assert.ok(!missing_topic_error_rendered);
297298
});
298299

299300
test_ui("get_invalid_recipient_emails", ({override_rewire}) => {

web/tests/message_edit.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ run_test("is_topic_editable", ({override}) => {
111111
page_params.is_admin = false;
112112
assert.equal(message_edit.is_topic_editable(message), false);
113113

114-
message.topic = "translated: (no topic)";
114+
message.topic = "translated: general chat";
115115
assert.equal(message_edit.is_topic_editable(message), false);
116116

117117
message.topic = "test topic";

zerver/actions/message_send.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,9 +1338,6 @@ def check_message(
13381338
# else can sneak past the access check.
13391339
assert sender.bot_type == sender.OUTGOING_WEBHOOK_BOT
13401340

1341-
if realm.mandatory_topics and topic_name == "(no topic)":
1342-
raise JsonableError(_("Topics are required in this organization"))
1343-
13441341
elif addressee.is_private():
13451342
user_profiles = addressee.user_profiles()
13461343
mirror_message = client.name in [

zerver/lib/email_mirror.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ def is_forwarded(subject: str) -> bool:
401401

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

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

410410
stream, options = decode_stream_email_address(to)
411411
# Don't remove quotations if message is forwarded, unless otherwise specified:

zerver/tests/test_email_mirror.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def test_receive_stream_email_messages_blank_subject_success(self) -> None:
331331

332332
self.assertEqual(message.content, "TestStreamEmailMessages body")
333333
self.assertEqual(get_display_recipient(message.recipient), stream.name)
334-
self.assertEqual(message.topic_name(), "(no topic)")
334+
self.assertEqual(message.topic_name(), "general chat")
335335

336336
def test_receive_stream_email_messages_subject_with_nonprintable_chars(
337337
self,
@@ -363,7 +363,7 @@ def test_receive_stream_email_messages_subject_with_nonprintable_chars(
363363
process_message(incoming_valid_message)
364364
message = most_recent_message(user_profile)
365365

366-
self.assertEqual(message.topic_name(), "(no topic)")
366+
self.assertEqual(message.topic_name(), "general chat")
367367

368368
def test_receive_private_stream_email_messages_success(self) -> None:
369369
user_profile = self.example_user("hamlet")
@@ -1614,12 +1614,12 @@ def test_process_message_strips_subject(self) -> None:
16141614
message = most_recent_message(user_profile)
16151615
self.assertEqual("Test", message.topic_name())
16161616

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

16241624
def test_strip_from_subject(self) -> None:
16251625
subject_list = orjson.loads(self.fixture_data("subjects.json", type="email"))

zerver/tests/test_message_edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ def do_edit_message_assert_error(
12081208
)
12091209

12101210
# topic edit permissions apply on "no topic" messages as well
1211-
message.set_topic_name("(no topic)")
1211+
message.set_topic_name("general chat")
12121212
message.save()
12131213
do_edit_message_assert_error(
12141214
id_, "G", "The time limit for editing this message's topic has passed.", "cordelia"

zerver/tests/test_message_send.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,16 +2555,13 @@ def test_no_topic_message(self) -> None:
25552555
sender = self.example_user("iago")
25562556
client = make_client(name="test suite")
25572557
stream = get_stream("Denmark", realm)
2558-
topic_name = "(no topic)"
2558+
topic_name = "general chat"
25592559
message_content = "whatever"
25602560
addressee = Addressee.for_stream(stream, topic_name)
25612561

25622562
do_set_realm_property(realm, "mandatory_topics", True, acting_user=None)
25632563
realm.refresh_from_db()
25642564

2565-
with self.assertRaisesRegex(JsonableError, "Topics are required in this organization"):
2566-
check_message(sender, client, addressee, message_content, realm)
2567-
25682565
do_set_realm_property(realm, "mandatory_topics", False, acting_user=None)
25692566
realm.refresh_from_db()
25702567
ret = check_message(sender, client, addressee, message_content, realm)

zerver/webhooks/slack_incoming/tests.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class SlackIncomingHookTests(WebhookTestCase):
77
WEBHOOK_DIR_NAME = "slack_incoming"
88

99
def test_message(self) -> None:
10-
expected_topic = "(no topic)"
10+
expected_topic = "general chat"
1111
expected_message = """
1212
Hello, world.
1313
""".strip()
@@ -38,7 +38,7 @@ def test_message_formatting(self) -> None:
3838
self.assert_stream_message(
3939
message=msg,
4040
stream_name=self.STREAM_NAME,
41-
topic_name="(no topic)",
41+
topic_name="general chat",
4242
content=output_value,
4343
)
4444

@@ -86,7 +86,7 @@ def test_message_with_actions(self) -> None:
8686
)
8787

8888
def test_message_with_blocks(self) -> None:
89-
expected_topic = "(no topic)"
89+
expected_topic = "general chat"
9090
expected_message = """
9191
Danny Torrence left the following review for your property:
9292
@@ -139,7 +139,7 @@ def test_complicated(self) -> None:
139139
# Paste the JSON into
140140
# https://api.slack.com/tools/block-kit-builder to see how it
141141
# is rendered in Slack
142-
expected_topic = "(no topic)"
142+
expected_topic = "general chat"
143143
expected_message = """
144144
## Hello from TaskBot
145145
@@ -174,7 +174,7 @@ def test_complicated(self) -> None:
174174
def test_attachment_blocks(self) -> None:
175175
# On https://api.slack.com/tools/block-kit-builder choose
176176
# "Attachment preview" and paste the JSON in.
177-
expected_topic = "(no topic)"
177+
expected_topic = "general chat"
178178
expected_message = """
179179
This is a section block with an accessory image.
180180
@@ -196,7 +196,7 @@ def test_attachment_blocks(self) -> None:
196196
)
197197

198198
def test_attachment_fields(self) -> None:
199-
expected_topic = "(no topic)"
199+
expected_topic = "general chat"
200200
expected_message = """
201201
Build bla bla succeeded
202202
@@ -216,7 +216,7 @@ def test_attachment_fields(self) -> None:
216216
)
217217

218218
def test_attachment_pieces(self) -> None:
219-
expected_topic = "(no topic)"
219+
expected_topic = "general chat"
220220
expected_message = """
221221
## Test
222222
@@ -239,7 +239,7 @@ def get_body(self, fixture_name: str) -> str:
239239
return self.webhook_fixture_data("slack_incoming", fixture_name, file_type=file_type)
240240

241241
def test_attachment_pieces_title_null(self) -> None:
242-
expected_topic = "(no topic)"
242+
expected_topic = "general chat"
243243
expected_message = """
244244
Sample pretext.
245245
@@ -259,7 +259,7 @@ def test_attachment_pieces_title_null(self) -> None:
259259
)
260260

261261
def test_attachment_pieces_image_url_null(self) -> None:
262-
expected_topic = "(no topic)"
262+
expected_topic = "general chat"
263263
expected_message = """
264264
## [Sample title.](https://www.google.com)
265265
@@ -279,7 +279,7 @@ def test_attachment_pieces_image_url_null(self) -> None:
279279
)
280280

281281
def test_attachment_pieces_ts_null(self) -> None:
282-
expected_topic = "(no topic)"
282+
expected_topic = "general chat"
283283
expected_message = """
284284
## [Sample title.](https://www.google.com)
285285
@@ -299,7 +299,7 @@ def test_attachment_pieces_ts_null(self) -> None:
299299
)
300300

301301
def test_attachment_pieces_text_null(self) -> None:
302-
expected_topic = "(no topic)"
302+
expected_topic = "general chat"
303303
expected_message = """
304304
## [Sample title.](https://www.google.com)
305305
@@ -319,7 +319,7 @@ def test_attachment_pieces_text_null(self) -> None:
319319
)
320320

321321
def test_attachment_pieces_pretext_null(self) -> None:
322-
expected_topic = "(no topic)"
322+
expected_topic = "general chat"
323323
expected_message = """
324324
## [Sample title.](https://www.google.com)
325325
@@ -339,7 +339,7 @@ def test_attachment_pieces_pretext_null(self) -> None:
339339
)
340340

341341
def test_attachment_pieces_footer_null(self) -> None:
342-
expected_topic = "(no topic)"
342+
expected_topic = "general chat"
343343
expected_message = """
344344
## [Sample title.](https://www.google.com)
345345
@@ -359,7 +359,7 @@ def test_attachment_pieces_footer_null(self) -> None:
359359
)
360360

361361
def test_attachment_pieces_title_link_null(self) -> None:
362-
expected_topic = "(no topic)"
362+
expected_topic = "general chat"
363363
expected_message = """
364364
## Sample title.
365365

zerver/webhooks/slack_incoming/view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def api_slack_incoming_webhook(
5656
user_specified_topic = re.sub("^[@#]", "", channel)
5757

5858
if user_specified_topic is None:
59-
user_specified_topic = "(no topic)"
59+
user_specified_topic = "general chat"
6060

6161
pieces = []
6262
if "blocks" in payload and payload["blocks"]:

0 commit comments

Comments
 (0)