serokell / tzbot

Timezone bot for Slack
Mozilla Public License 2.0
7 stars 2 forks source link

[#93] Handle edited events when old message is not in cache #98

Closed dcastro closed 1 year ago

dcastro commented 1 year ago

Description

Problem: At the moment, when we receive a "message edited" event, and if the old message is not in our cache or it did not contain time references, we ignore the event:

-- if not found or expired, just ignore this message 
-- it's too old or just didn't contain any time refs

However, it's important to handle these events even when a message is not in the cache. For example:

  1. A user types "let's meet at 7" and then amends "7" to "7am". The old message did not contain time refs, but the new one does, so we should handle that.
  2. The server is restarted, we'll lose our cache. When the server is back up, we should still react when messages that were sent before the restart are edited.

Solution: If the old message's time refs are not found in the cache, inspect the previous_message field from the event JSON, and parse its time refs again.

Related issue(s)

Fixed #93

:white_check_mark: Checklist for your Pull Request

Related changes (conditional)

Stylistic guide (mandatory)