Skip to content

Commit 3a1c788

Browse files
committed
topics: Rename "(no topic)" to "general chat".
Messages sent without a topic is now displayed as going to "general chat". Update tests to work with the renaming. Fixes zulip#23291.
1 parent 3a0620a commit 3a1c788

16 files changed

+34
-33
lines changed

frontend_tests/node_tests/compose_validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ test_ui("validate", ({override, mock_template}) => {
246246
$t_html({defaultMessage: "Topics are required in this organization"}),
247247
);
248248

249-
compose_state.topic("(no topic)");
249+
compose_state.topic("general chat");
250250
assert.ok(!compose_validate.validate());
251251
assert.equal(
252252
$("#compose-error-msg").html(),

frontend_tests/node_tests/message_edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ run_test("is_topic_editable", ({override}) => {
119119
assert.equal(message_edit.is_topic_editable(message), true);
120120

121121
page_params.is_admin = false;
122-
message.topic = "translated: (no topic)";
122+
message.topic = "translated: general chat";
123123
assert.equal(message_edit.is_topic_editable(message), true);
124124

125125
message.topic = "test topic";

static/js/compose.js

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

128128
export function empty_topic_placeholder() {
129-
return $t({defaultMessage: "(no topic)"});
129+
return $t({defaultMessage: "general chat"});
130130
}
131131

132132
export function create_message_object() {

static/js/compose_validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ function validate_stream_message() {
432432
const topic = compose_state.topic();
433433
// TODO: We plan to migrate the empty topic to only using the
434434
// `""` representation for i18n reasons, but have not yet done so.
435-
if (topic === "" || topic === "(no topic)") {
435+
if (topic === "" || topic === "general chat") {
436436
compose_error.show(
437437
$t_html({defaultMessage: "Topics are required in this organization"}),
438438
$("#stream_message_recipient_topic"),

templates/zerver/help/configure-who-can-edit-topics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ learning how to use topics effectively. However, you can restrict the ability to
88
edit the topic of any message to specific [roles](/help/roles-and-permissions).
99

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

1414
Also, only administrators and moderators can edit the topics of

templates/zerver/help/require-topics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ specified topic.
2121
## Stream messages without a topic
2222

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

2626
When [message editing](/help/configure-message-editing-and-deletion)
2727
is enabled, any user can [add a topic](/help/rename-a-topic)

tools/lib/capitalization.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
r"user",
7575
r"an unknown operating system",
7676
r"Go to Settings",
77+
r"general chat",
7778
# SPECIAL CASES
7879
# Because topics usually are lower-case, this would look weird if it were capitalized
7980
r"more topics",

zerver/actions/message_edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def can_edit_topic(
113113
if message.sender_id == user_profile.id:
114114
return True
115115

116-
# We allow anyone to edit (no topic) messages to help tend them.
116+
# We allow anyone to edit general chat messages to help tend them.
117117
if is_no_topic_msg:
118118
return True
119119

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

940-
is_no_topic_msg = message.topic_name() == "(no topic)"
940+
is_no_topic_msg = message.topic_name() == "general chat"
941941

942942
if topic_name is not None and not can_edit_topic(message, user_profile, is_no_topic_msg):
943943
raise JsonableError(_("You don't have permission to edit this message"))

zerver/actions/message_send.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ def check_message(
14101410
# else can sneak past the access check.
14111411
assert sender.bot_type == sender.OUTGOING_WEBHOOK_BOT
14121412

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

14161416
elif addressee.is_private():

zerver/lib/email_mirror.py

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

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

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

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

zerver/migrations/0371_invalid_characters_in_topics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def fix_topics(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None
4949
continue
5050

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

zerver/tests/test_email_mirror.py

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

333333
self.assertEqual(message.content, "TestStreamEmailMessages body")
334334
self.assertEqual(get_display_recipient(message.recipient), stream.name)
335-
self.assertEqual(message.topic_name(), "(no topic)")
335+
self.assertEqual(message.topic_name(), "general chat")
336336

337337
def test_receive_stream_email_messages_subject_with_nonprintable_chars(self) -> None:
338338
user_profile = self.example_user("hamlet")
@@ -362,7 +362,7 @@ def test_receive_stream_email_messages_subject_with_nonprintable_chars(self) ->
362362
process_message(incoming_valid_message)
363363
message = most_recent_message(user_profile)
364364

365-
self.assertEqual(message.topic_name(), "(no topic)")
365+
self.assertEqual(message.topic_name(), "general chat")
366366

367367
def test_receive_private_stream_email_messages_success(self) -> None:
368368
user_profile = self.example_user("hamlet")
@@ -1532,12 +1532,12 @@ def test_process_message_strips_subject(self) -> None:
15321532
message = most_recent_message(user_profile)
15331533
self.assertEqual("Test", message.topic_name())
15341534

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

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

zerver/tests/test_message_edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,8 @@ def do_edit_message_assert_error(
11691169
id_, "G", "The time limit for editing this message's topic has passed", "cordelia"
11701170
)
11711171

1172-
# anyone should be able to edit "no topic" indefinitely
1173-
message.set_topic_name("(no topic)")
1172+
# anyone should be able to edit "general chat" indefinitely
1173+
message.set_topic_name("general chat")
11741174
message.save()
11751175
do_edit_message_assert_success(id_, "D", "cordelia")
11761176

zerver/tests/test_message_send.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2704,7 +2704,7 @@ def test_no_topic_message(self) -> None:
27042704
sender = self.example_user("iago")
27052705
client = make_client(name="test suite")
27062706
stream = get_stream("Denmark", realm)
2707-
topic_name = "(no topic)"
2707+
topic_name = "general chat"
27082708
message_content = "whatever"
27092709
addressee = Addressee.for_stream(stream, topic_name)
27102710

zerver/webhooks/slack_incoming/tests.py

Lines changed: 13 additions & 13 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()
@@ -83,7 +83,7 @@ def test_message_with_actions(self) -> None:
8383
)
8484

8585
def test_message_with_blocks(self) -> None:
86-
expected_topic = "(no topic)"
86+
expected_topic = "general chat"
8787
expected_message = """
8888
Danny Torrence left the following review for your property:
8989
@@ -133,7 +133,7 @@ def test_complicated(self) -> None:
133133
# Paste the JSON into
134134
# https://api.slack.com/tools/block-kit-builder to see how it
135135
# is rendered in Slack
136-
expected_topic = "(no topic)"
136+
expected_topic = "general chat"
137137
expected_message = """
138138
## Hello from TaskBot
139139
@@ -168,7 +168,7 @@ def test_complicated(self) -> None:
168168
def test_attachment_blocks(self) -> None:
169169
# On https://api.slack.com/tools/block-kit-builder choose
170170
# "Attachment preview" and paste the JSON in.
171-
expected_topic = "(no topic)"
171+
expected_topic = "general chat"
172172
expected_message = """
173173
This is a section block with an accessory image.
174174
@@ -184,7 +184,7 @@ def test_attachment_blocks(self) -> None:
184184
)
185185

186186
def test_attachment_fields(self) -> None:
187-
expected_topic = "(no topic)"
187+
expected_topic = "general chat"
188188
expected_message = """
189189
Build bla bla succeeded
190190
@@ -204,7 +204,7 @@ def test_attachment_fields(self) -> None:
204204
)
205205

206206
def test_attachment_pieces(self) -> None:
207-
expected_topic = "(no topic)"
207+
expected_topic = "general chat"
208208
expected_message = """
209209
## Test
210210
@@ -227,7 +227,7 @@ def get_body(self, fixture_name: str) -> str:
227227
return self.webhook_fixture_data("slack_incoming", fixture_name, file_type=file_type)
228228

229229
def test_attachment_pieces_title_null(self) -> None:
230-
expected_topic = "(no topic)"
230+
expected_topic = "general chat"
231231
expected_message = """
232232
Sample pretext.
233233
@@ -247,7 +247,7 @@ def test_attachment_pieces_title_null(self) -> None:
247247
)
248248

249249
def test_attachment_pieces_image_url_null(self) -> None:
250-
expected_topic = "(no topic)"
250+
expected_topic = "general chat"
251251
expected_message = """
252252
## [Sample title.](https://www.google.com)
253253
@@ -267,7 +267,7 @@ def test_attachment_pieces_image_url_null(self) -> None:
267267
)
268268

269269
def test_attachment_pieces_ts_null(self) -> None:
270-
expected_topic = "(no topic)"
270+
expected_topic = "general chat"
271271
expected_message = """
272272
## [Sample title.](https://www.google.com)
273273
@@ -287,7 +287,7 @@ def test_attachment_pieces_ts_null(self) -> None:
287287
)
288288

289289
def test_attachment_pieces_text_null(self) -> None:
290-
expected_topic = "(no topic)"
290+
expected_topic = "general chat"
291291
expected_message = """
292292
## [Sample title.](https://www.google.com)
293293
@@ -307,7 +307,7 @@ def test_attachment_pieces_text_null(self) -> None:
307307
)
308308

309309
def test_attachment_pieces_pretext_null(self) -> None:
310-
expected_topic = "(no topic)"
310+
expected_topic = "general chat"
311311
expected_message = """
312312
## [Sample title.](https://www.google.com)
313313
@@ -327,7 +327,7 @@ def test_attachment_pieces_pretext_null(self) -> None:
327327
)
328328

329329
def test_attachment_pieces_footer_null(self) -> None:
330-
expected_topic = "(no topic)"
330+
expected_topic = "general chat"
331331
expected_message = """
332332
## [Sample title.](https://www.google.com)
333333
@@ -347,7 +347,7 @@ def test_attachment_pieces_footer_null(self) -> None:
347347
)
348348

349349
def test_attachment_pieces_title_link_null(self) -> None:
350-
expected_topic = "(no topic)"
350+
expected_topic = "general chat"
351351
expected_message = """
352352
## Sample title.
353353

zerver/webhooks/slack_incoming/view.py

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

5757
if user_specified_topic is None:
58-
user_specified_topic = "(no topic)"
58+
user_specified_topic = "general chat"
5959

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

0 commit comments

Comments
 (0)