Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Lauryn Menard90cc2716f0d4
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index 0383f6a867b..0afe012f382 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -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):
diff --git a/version.py b/version.py
index 414223d5d61..0ffa5611005 100644
--- a/version.py
+++ b/version.py
@@ -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
diff --git a/zerver/models.py b/zerver/models.py
index f666e2c28e3..bd52f88e04c 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -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,
)
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 3f595f01726..cdf30a810e6 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -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"