I had heard that this latest version of Mastodon (v3.5.3) has a secret edit button functionality built in to it, but I couldn’t find instructions on how to enable it anywhere online.

Anyway, someone put me on to Akkoma which has a well-built edit function enabled out of the box, so I spun up my own Akkoma instance to test it out and it worked flawlessly.

https://twitter.com/phocks/status/1576400097289842688?s=20&t=3ed9rIu-VDRSLdNJF7niGw

But then Jase pointed me in the right direction with this post “How to enable Masto's edit button”, which got me most of the way there. I had a bit of a play around, and after a few early failures, I eventually got it going! Here’s how you do it.

  1. cd into your Mastodon folder: /home/mastodon/live
  2. You need to edit 2 files:
    1. app/javascript/mastodon/components/status_action_bar.js
    2. app/javascript/mastodon/features/status/components/action_bar.js
  3. Uncomment this line: menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick }); (as you can see the menu item is there, it’s just commented out)
if (writtenByMe) {
  // menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick });
  menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
  menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick });
}
  1. We’re not finished yet though (like I first assumed). We need to build the code before it will be served up by the instance. So cd back to /home/mastodon/live again.
  2. Run yarn run build:production to build our edited JavaScript
  3. Restart your Mastodon services (may or may not be necessary)
    1. systemctl restart mastodon-sidekiq
    2. systemctl reload mastodon-web

That’s it! Reload the page and click the three dots next to one of your posts and you should hopefully see a little Edit button. 🤞

Screenshot_20221002-190220~2.png


Anyway, there you go. Here’s an edited tweet in the wild. If you found this useful, throw me a follow on bne.social or on my private instance or even on the dirty old bird site, or sponsor my open-source projects on GitHub if you’re feeling charitable.

See ya round 👋