scheduled_messages: Use scheduled_message_id instead of message_id.

Using `message_id` can be confusing for API users since it can be
mistaken for the ID of the message that will be sent.
This commit is contained in:
Aman Agrawal 2023-04-21 10:48:29 +00:00 committed by Tim Abbott
parent 7bf0793c94
commit 963fe566d7
5 changed files with 12 additions and 9 deletions

View File

@ -19,7 +19,7 @@ export function override_scheduled_messages_data(data) {
export function edit_scheduled_message(scheduled_msg_id) {
const scheduled_msg = scheduled_messages_data.find(
(msg) => msg.message_id === scheduled_msg_id,
(msg) => msg.scheduled_message_id === scheduled_msg_id,
);
let compose_args;

View File

@ -1,5 +1,5 @@
{{#each scheduled_messages_data}}
<div class="scheduled-message-row overlay-message-row" data-message-id="{{message_id}}">
<div class="scheduled-message-row overlay-message-row" data-message-id="{{scheduled_message_id}}">
<div class="overlay-message-info-box" tabindex="0">
{{#if is_stream}}
<div class="message_header message_header_stream">

View File

@ -5032,7 +5032,7 @@ paths:
"scheduled_messages":
[
{
"message_id": 27,
"scheduled_message_id": 27,
"to": [14],
"type": "stream",
"content": "Hi",
@ -17342,11 +17342,12 @@ components:
description: |
A dictionary for representing a scheduled message.
properties:
message_id:
scheduled_message_id:
type: integer
description: |
The unique ID of the scheduled message. It can be used to modify and
delete the scheduled message.
delete the scheduled message. This ID is different than the ID of the
message that will actually be sent.
type:
type: string
description: |
@ -17388,7 +17389,7 @@ components:
example: 1595479019
additionalProperties: false
required:
- message_id
- scheduled_message_id
- type
- to
- topic

View File

@ -217,7 +217,9 @@ class ScheduledMessageTest(ZulipTestCase):
scheduled_messages = orjson.loads(result.content)["scheduled_messages"]
self.assert_length(scheduled_messages, 1)
self.assertEqual(scheduled_messages[0]["message_id"], self.last_scheduled_message().id)
self.assertEqual(
scheduled_messages[0]["scheduled_message_id"], self.last_scheduled_message().id
)
self.assertEqual(scheduled_messages[0]["content"], content)
self.assertEqual(scheduled_messages[0]["to"], [self.get_stream_id("Verona")])
self.assertEqual(scheduled_messages[0]["type"], "stream")

View File

@ -9,7 +9,7 @@ from zerver.models import ScheduledMessage, UserProfile, get_recipient_ids
class ScheduledMessageDict(TypedDict):
message_id: int
scheduled_message_id: int
to: List[int]
type: str
content: str
@ -31,7 +31,7 @@ def fetch_scheduled_messages(request: HttpRequest, user_profile: UserProfile) ->
)
msg_to_dict: ScheduledMessageDict = {
"message_id": scheduled_message.id,
"scheduled_message_id": scheduled_message.id,
"to": recipient,
"type": recipient_type_str,
"content": scheduled_message.content,