mirror of https://github.com/zulip/zulip.git
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:
parent
7bf0793c94
commit
963fe566d7
|
@ -19,7 +19,7 @@ export function override_scheduled_messages_data(data) {
|
||||||
|
|
||||||
export function edit_scheduled_message(scheduled_msg_id) {
|
export function edit_scheduled_message(scheduled_msg_id) {
|
||||||
const scheduled_msg = scheduled_messages_data.find(
|
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;
|
let compose_args;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{#each scheduled_messages_data}}
|
{{#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">
|
<div class="overlay-message-info-box" tabindex="0">
|
||||||
{{#if is_stream}}
|
{{#if is_stream}}
|
||||||
<div class="message_header message_header_stream">
|
<div class="message_header message_header_stream">
|
||||||
|
|
|
@ -5032,7 +5032,7 @@ paths:
|
||||||
"scheduled_messages":
|
"scheduled_messages":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"message_id": 27,
|
"scheduled_message_id": 27,
|
||||||
"to": [14],
|
"to": [14],
|
||||||
"type": "stream",
|
"type": "stream",
|
||||||
"content": "Hi",
|
"content": "Hi",
|
||||||
|
@ -17342,11 +17342,12 @@ components:
|
||||||
description: |
|
description: |
|
||||||
A dictionary for representing a scheduled message.
|
A dictionary for representing a scheduled message.
|
||||||
properties:
|
properties:
|
||||||
message_id:
|
scheduled_message_id:
|
||||||
type: integer
|
type: integer
|
||||||
description: |
|
description: |
|
||||||
The unique ID of the scheduled message. It can be used to modify and
|
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:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
|
@ -17388,7 +17389,7 @@ components:
|
||||||
example: 1595479019
|
example: 1595479019
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
required:
|
required:
|
||||||
- message_id
|
- scheduled_message_id
|
||||||
- type
|
- type
|
||||||
- to
|
- to
|
||||||
- topic
|
- topic
|
||||||
|
|
|
@ -217,7 +217,9 @@ class ScheduledMessageTest(ZulipTestCase):
|
||||||
scheduled_messages = orjson.loads(result.content)["scheduled_messages"]
|
scheduled_messages = orjson.loads(result.content)["scheduled_messages"]
|
||||||
|
|
||||||
self.assert_length(scheduled_messages, 1)
|
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]["content"], content)
|
||||||
self.assertEqual(scheduled_messages[0]["to"], [self.get_stream_id("Verona")])
|
self.assertEqual(scheduled_messages[0]["to"], [self.get_stream_id("Verona")])
|
||||||
self.assertEqual(scheduled_messages[0]["type"], "stream")
|
self.assertEqual(scheduled_messages[0]["type"], "stream")
|
||||||
|
|
|
@ -9,7 +9,7 @@ from zerver.models import ScheduledMessage, UserProfile, get_recipient_ids
|
||||||
|
|
||||||
|
|
||||||
class ScheduledMessageDict(TypedDict):
|
class ScheduledMessageDict(TypedDict):
|
||||||
message_id: int
|
scheduled_message_id: int
|
||||||
to: List[int]
|
to: List[int]
|
||||||
type: str
|
type: str
|
||||||
content: str
|
content: str
|
||||||
|
@ -31,7 +31,7 @@ def fetch_scheduled_messages(request: HttpRequest, user_profile: UserProfile) ->
|
||||||
)
|
)
|
||||||
|
|
||||||
msg_to_dict: ScheduledMessageDict = {
|
msg_to_dict: ScheduledMessageDict = {
|
||||||
"message_id": scheduled_message.id,
|
"scheduled_message_id": scheduled_message.id,
|
||||||
"to": recipient,
|
"to": recipient,
|
||||||
"type": recipient_type_str,
|
"type": recipient_type_str,
|
||||||
"content": scheduled_message.content,
|
"content": scheduled_message.content,
|
||||||
|
|
Loading…
Reference in New Issue