What is Nostr?
prs / Damus PRs
npub1ahc…7v97
2023-06-11 18:21:44

prs on Nostr: fix: Show DM error rather than editing event content (#1277) When a DM event cannot ...

fix: Show DM error rather than editing event content (#1277)

When a DM event cannot be decrypted Damus currently edits the content of the DM to say `*failed to decrypt content*`. This is problematic for two reasons:

1. We shouldn't edit the content of an event to display an error to avoid actually dealing with that error
2. Damus no longer renders Markdown for events so `*failed to decrypt content*` is no longer correctly italicized.

To fix this I added a `decryptable` variable to the NostrEvent type that defaults to true but is set to false when a DM cannot be decrypted. This value is only read and used when displaying DMs and allows Damus to show a styled text event rather than broken Markdown plaintext so the user has more of a hint that the text is coming from Damus rather than a strange message by another user.

I also added the `too_big` variable into the `should_show_event` since they were already the same thing.

dm_error, 2 commits

https://github.com/damus-io/damus/pull/1277
Author Public Key
npub1ahckk8wkr64n2w5r4arsesf42upfhlmgy76vhxmlex7mvv4zhrnqry7v97