You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: remove pinned_at from the updateMessage api (#1484)
## CLA
- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required).
- [ ] Code changes are tested
## Description of the changes, What, Why and How?
Whenever using the `updateMessage` API, we rely on updating the entire
message object with most of its values left unchanged and only some of
them mutating. This generally works fine as the backend does updates in
a smart way (i.e it won't update a field if its value hasn't changed).
However, since natively Javascript dates go down to milliseconds and
server-side they are stored until microseconds, there is a discrepancy
between these 2 values and the `pinned_at` value is considered
different; hence causing things to malfunction.
For example, if a user does not have pinning permissions in a specific
channel and someone else pins a message, they won't be able to update it
due to the fact that it will be considered as an update to the
`pinned_at` date as well - throwing an error. Similarly to how we handle
other dates (`created_at`, `updated_at` etc), we disregard this value
for the time being.
For a more long-term solution, it would be prudent if we:
- Store dates as strings and only convert them to dates whenever needed
(this still has some odd edge cases that we'd need to take into account)
- Possibly rely on `partialUpdateMessage` rather than `updateMessage`
for features like message editing in order to avoid broken behaviour
(however, using the vanilla API would still not work)
So, for the time being we ignore `pinned_at` from the API.
More information in [this Slack
thread](https://getstream.slack.com/archives/C04SDJ3BC6Q/p1739524298745469).
## Changelog
-
0 commit comments