scheduled-messages: Update API dicts for failed boolean field.

Adds the `failed` boolean from the ScheduledMessage to the API dict
returned by scheduled message events and register response, and by
fetching the user's scheduled messages.

`failed` will only be true when the server has tried to send the
scheduled message and failed due to an error.
This commit is contained in:
Lauryn Menard
2023-05-11 19:31:13 +02:00
committed by Tim Abbott
parent c7c67c01ce
commit 90cc2716f0
4 changed files with 34 additions and 3 deletions

View File

@@ -20,17 +20,27 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 7.0
**Feature level 181**
* [`GET /scheduled_messages`](/api/get-scheduled-messages), [`GET
/events`](/api/get-events), [`POST /register`](/api/register-queue):
Added `failed` boolean field to scheduled message objects to
indicate if the server tried to send the scheduled message and was
unsuccessful. Clients that support unscheduling and editing
scheduled messages should use this field to indicate to the user
when a scheduled message failed to send at the appointed time.
**Feature level 180**
* `POST /invites`: Added support for invitations specifying the empty
list as the user's initial stream subscriptions. Previously, this
returned an error.
**Feature level 179**:
**Feature level 179**
* [`POST /scheduled_messages`](/api/create-or-update-scheduled-message):
Added new endpoint to create and edit scheduled messages.
* [`GET /events`](/api/get-events)
* [`GET /events`](/api/get-events):
Added `scheduled_messages` events sent to clients when a user creates,
edits or deletes scheduled messages.
* [`POST /register`](/api/register-queue):

View File

@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 180
API_FEATURE_LEVEL = 181
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump

View File

@@ -4303,6 +4303,7 @@ class APIScheduledStreamMessageDict(TypedDict):
rendered_content: str
topic: str
scheduled_delivery_timestamp: int
failed: bool
class APIScheduledDirectMessageDict(TypedDict):
@@ -4312,6 +4313,7 @@ class APIScheduledDirectMessageDict(TypedDict):
content: str
rendered_content: str
scheduled_delivery_timestamp: int
failed: bool
class ScheduledMessage(models.Model):
@@ -4399,6 +4401,7 @@ class ScheduledMessage(models.Model):
content=self.content,
rendered_content=self.rendered_content,
scheduled_delivery_timestamp=datetime_to_timestamp(self.scheduled_timestamp),
failed=self.failed,
)
# The recipient for stream messages should always just be the unique stream ID.
@@ -4412,6 +4415,7 @@ class ScheduledMessage(models.Model):
rendered_content=self.rendered_content,
topic=self.topic_name(),
scheduled_delivery_timestamp=datetime_to_timestamp(self.scheduled_timestamp),
failed=self.failed,
)

View File

@@ -4469,6 +4469,7 @@ paths:
"content": "Hello there!",
"rendered_content": "<p>Hello there!</p>",
"scheduled_delivery_timestamp": 1681662420,
"failed": false,
},
],
}
@@ -4505,6 +4506,7 @@ paths:
"content": "Hello there!",
"rendered_content": "<p>Hello there!</p>",
"scheduled_delivery_timestamp": 1681662420,
"failed": false,
},
}
- type: object
@@ -5146,6 +5148,7 @@ paths:
"rendered_content": "<p>Hi</p>",
"topic": "Introduction",
"scheduled_delivery_timestamp": 1681662420,
"failed": false,
},
],
}
@@ -17648,6 +17651,19 @@ components:
The UNIX timestamp for when the message will be sent
by the server, in UTC seconds.
example: 1595479019
failed:
type: boolean
description: |
Whether the server has tried to send the scheduled message
and it failed to successfully send.
Clients that support unscheduling and editing scheduled messages
should display scheduled messages with `failed = true` with an
indicator that the server failed to send the message at the
scheduled time, so that the user is aware of the failure and can
get the content of the scheduled message.
**Changes**: New in Zulip 7.0 (feature level 181).
additionalProperties: false
required:
- scheduled_message_id
@@ -17656,6 +17672,7 @@ components:
- content
- rendered_content
- scheduled_delivery_timestamp
- failed
User:
allOf:
- $ref: "#/components/schemas/UserBase"