]> cat aescling's git repositories - mastodon.git/commit
Add frontend support for inline spoiler text
authorkibigo! <go@kibi.family>
Fri, 11 Nov 2022 09:39:42 +0000 (01:39 -0800)
committerkibigo! <go@kibi.family>
Sun, 13 Nov 2022 04:50:44 +0000 (20:50 -0800)
commiteac953a2c8b0dd19a8f913b1ff02d62b9194ba73
tree340c30855abb990ad88b2f39888106fe9a3bf0ff
parent578e1e58c23194ce9ed66ac3fd8e027244f84e2e
Add frontend support for inline spoiler text

To get around the fact that React manages the contents of statuses
through HTML injection, this commit adds a Redux action/reducer for
dynamically mutating the content of a status in the store. This
approach has some flaws:

- It’s messy as fuck, and

- If the status is reloaded for whatever reason (i·e it is received
  again through the A·P·I), the contents won’t match and there will be
  *another* (unnecessary) status body update (which will close any
  open spoilers in the status).

Still, I think this is the best that can be done with Mastodon’s
current architecture.
12 files changed:
app/javascript/flavours/glitch/actions/importer/normalizer.js
app/javascript/flavours/glitch/actions/statuses.js
app/javascript/flavours/glitch/components/status.js
app/javascript/flavours/glitch/components/status_content.js
app/javascript/flavours/glitch/containers/status_container.js
app/javascript/flavours/glitch/features/status/components/detailed_status.js
app/javascript/flavours/glitch/features/status/index.js
app/javascript/flavours/glitch/locales/en.js
app/javascript/flavours/glitch/reducers/statuses.js
app/javascript/flavours/glitch/styles/components/status.scss
app/javascript/flavours/glitch/styles/variables.scss
app/javascript/flavours/glitch/utils/spoilertextify.js [new file with mode: 0644]