Skip to content

Commit 8abff79

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 550a32b commit 8abff79

14 files changed

+33
-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(),

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
@@ -438,7 +438,7 @@ function validate_stream_message() {
438438
const topic = compose_state.topic();
439439
// TODO: We plan to migrate the empty topic to only using the
440440
// `""` representation for i18n reasons, but have not yet done so.
441-
if (topic === "" || topic === "(no topic)") {
441+
if (topic === "" || topic === "general chat") {
442442
compose_error.show(
443443
$t_html({defaultMessage: "Topics are required in this organization"}),
444444
$("#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)

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
@@ -1409,7 +1409,7 @@ def check_message(
14091409
# else can sneak past the access check.
14101410
assert sender.bot_type == sender.OUTGOING_WEBHOOK_BOT
14111411

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

14151415
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ 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 general chat if the above clean-up leaves us with an empty string.
5353
if fixed_topic == "":
54-
fixed_topic = "(no topic)"
54+
fixed_topic = "general chat"
5555

5656
cursor.execute(
5757
"UPDATE zerver_message SET subject = %s WHERE subject = %s AND id > %s AND id <= %s",

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
@@ -1160,8 +1160,8 @@ def do_edit_message_assert_error(
11601160
id_, "G", "The time limit for editing this message's topic has passed", "cordelia"
11611161
)
11621162

1163-
# anyone should be able to edit "no topic" indefinitely
1164-
message.set_topic_name("(no topic)")
1163+
# anyone should be able to edit "general chat" indefinitely
1164+
message.set_topic_name("general chat")
11651165
message.save()
11661166
do_edit_message_assert_success(id_, "D", "cordelia")
11671167

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()
@@ -59,7 +59,7 @@ def test_message_with_actions(self) -> None:
5959
)
6060

6161
def test_message_with_blocks(self) -> None:
62-
expected_topic = "(no topic)"
62+
expected_topic = "general chat"
6363
expected_message = """
6464
Danny Torrence left the following review for your property:
6565
@@ -109,7 +109,7 @@ def test_complicated(self) -> None:
109109
# Paste the JSON into
110110
# https://api.slack.com/tools/block-kit-builder to see how it
111111
# is rendered in Slack
112-
expected_topic = "(no topic)"
112+
expected_topic = "general chat"
113113
expected_message = """
114114
## Hello from TaskBot
115115
@@ -144,7 +144,7 @@ def test_complicated(self) -> None:
144144
def test_attachment_blocks(self) -> None:
145145
# On https://api.slack.com/tools/block-kit-builder choose
146146
# "Attachment preview" and paste the JSON in.
147-
expected_topic = "(no topic)"
147+
expected_topic = "general chat"
148148
expected_message = """
149149
This is a section block with an accessory image.
150150
@@ -160,7 +160,7 @@ def test_attachment_blocks(self) -> None:
160160
)
161161

162162
def test_attachment_fields(self) -> None:
163-
expected_topic = "(no topic)"
163+
expected_topic = "general chat"
164164
expected_message = """
165165
Build bla bla succeeded
166166
@@ -178,7 +178,7 @@ def test_attachment_fields(self) -> None:
178178
)
179179

180180
def test_attachment_pieces(self) -> None:
181-
expected_topic = "(no topic)"
181+
expected_topic = "general chat"
182182
expected_message = """
183183
## Test
184184
@@ -201,7 +201,7 @@ def get_body(self, fixture_name: str) -> str:
201201
return self.webhook_fixture_data("slack_incoming", fixture_name, file_type=file_type)
202202

203203
def test_attachment_pieces_title_null(self) -> None:
204-
expected_topic = "(no topic)"
204+
expected_topic = "general chat"
205205
expected_message = """
206206
Sample pretext.
207207
@@ -221,7 +221,7 @@ def test_attachment_pieces_title_null(self) -> None:
221221
)
222222

223223
def test_attachment_pieces_image_url_null(self) -> None:
224-
expected_topic = "(no topic)"
224+
expected_topic = "general chat"
225225
expected_message = """
226226
## [Sample title.](https://www.google.com)
227227
@@ -241,7 +241,7 @@ def test_attachment_pieces_image_url_null(self) -> None:
241241
)
242242

243243
def test_attachment_pieces_ts_null(self) -> None:
244-
expected_topic = "(no topic)"
244+
expected_topic = "general chat"
245245
expected_message = """
246246
## [Sample title.](https://www.google.com)
247247
@@ -261,7 +261,7 @@ def test_attachment_pieces_ts_null(self) -> None:
261261
)
262262

263263
def test_attachment_pieces_text_null(self) -> None:
264-
expected_topic = "(no topic)"
264+
expected_topic = "general chat"
265265
expected_message = """
266266
## [Sample title.](https://www.google.com)
267267
@@ -281,7 +281,7 @@ def test_attachment_pieces_text_null(self) -> None:
281281
)
282282

283283
def test_attachment_pieces_pretext_null(self) -> None:
284-
expected_topic = "(no topic)"
284+
expected_topic = "general chat"
285285
expected_message = """
286286
## [Sample title.](https://www.google.com)
287287
@@ -301,7 +301,7 @@ def test_attachment_pieces_pretext_null(self) -> None:
301301
)
302302

303303
def test_attachment_pieces_footer_null(self) -> None:
304-
expected_topic = "(no topic)"
304+
expected_topic = "general chat"
305305
expected_message = """
306306
## [Sample title.](https://www.google.com)
307307
@@ -321,7 +321,7 @@ def test_attachment_pieces_footer_null(self) -> None:
321321
)
322322

323323
def test_attachment_pieces_title_link_null(self) -> None:
324-
expected_topic = "(no topic)"
324+
expected_topic = "general chat"
325325
expected_message = """
326326
## Sample title.
327327

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)