ernestdefoe / mayfly
Disappearing messages for Flarum's Messages: a timer for each conversation, counted from sending or from reading, with a live countdown and a fade-out.
Fund package maintenance!
Requires
- php: ^8.3
- flarum/core: ^2.0
- flarum/messages: ^2.0
Requires (Dev)
- flarum/phpstan: ^2.0
- flarum/realtime: ^2.0
- flarum/testing: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
Suggests
- ernestdefoe/ai-helper: Bug reports Claude_Bot logged from an expired message are deleted with it.
- ernestdefoe/rosetta: Translations of an expired message are deleted with it.
- flarum/realtime: Messages fade out on every open screen the moment they expire, without waiting for the next check.
Provides
None
Conflicts
None
Replaces
None
README
Disappearing messages for Flarum 2's Messages. Either person in a conversation can set a timer, and new messages delete themselves for everyone when it runs out: counted from when they were sent, or (like Signal) from when each person first reads them. A small clock on each message counts down, and when time is up the message fades out of the conversation on every screen that has it open.
What it does
- A timer for each conversation: off, 5 minutes, 1 hour, 1 day, 1 week or 4 weeks. Changing it is announced in the conversation ("Ana set messages to disappear 1 day after they're read"). It applies to messages sent from then on. Messages that were already sent keep the timer they had, so nothing is ever deleted retroactively.
- Two ways to count:
- From sending: each message goes a set time after it was sent.
- From reading: each person's copy starts counting down when they first see it. The message is deleted once everyone has read it and every countdown has run out. A message nobody reads still goes when the admin's maximum has passed.
- A banner at the top of the conversation says what the timer is, with a Change link.
- A live clock on each message shows the time left. In the last minute it becomes a ring with "0:42", and before the countdown starts it says "starts when read".
- A fade-out: when time runs out, the message fades and shrinks out of the conversation. Members who have turned off animation see it removed at once.
- The conversation stays when all its messages have gone, and the conversation list says "No messages".
- Notification emails leave the message out. Once an email has left the forum it can't be pulled back, so for a disappearing message the email only says there's a message to read.
What disappearing can't do
Disappearing isn't the same as secret. A web page can't block or detect screenshots, and anyone in a conversation can copy a message. Files uploaded into a message are not deleted. Database backups and server logs keep what they kept. The settings page and the timer dialog say so too.
Settings
- Turn the feature on or off. When it's off, new messages never disappear, and messages that already have a timer still go when it runs out.
- Which groups may turn timers on (the "Turn on disappearing messages" permission, members by default).
- The longest timer members may choose. This is also the safety cap for unread messages.
- Whether "from reading" is allowed.
- A default timer for new conversations.
- A forced timer on every conversation, for a privacy-first community. Members can't change or turn off a forced timer.
Install
composer require ernestdefoe/mayfly php flarum migrate php flarum cache:clear
Expired messages are hidden the moment their time is up, and deleted by Flarum's scheduler, so it must be running
(php flarum schedule:run every minute from cron).
Update
composer update ernestdefoe/mayfly php flarum migrate php flarum cache:clear
Works with
- flarum/realtime: messages fade out on every open screen the moment they expire, and a timer change shows at once. Without it, an open conversation checks every 30 seconds.
- Rosetta: translations of a message are deleted with it.
- AI Helper: bug reports its bot logged from a message are deleted with it.
Mentions in a message, its notifications and its search entry go with it as well.
For developers
Anything that keeps its own copy of a message's text can delete it when the message expires: listen for
ErnestDefoe\Mayfly\Event\MessagesExpiring (it carries the message ids, and is fired before the delete). A message
that will disappear has a mayflyExpiry relation (a row in ephemeral_message_expiry) from the moment it is saved,
before core's Created event, so a listener can leave its text out of anything that leaves the forum.
Not yet
- Holding a reported message. A message someone reports should wait for the moderators instead of disappearing under them. Flarum can't report a private message yet (flarum/flags only knows posts), so there is nothing to hold for. When a way to report messages arrives, Mayfly will keep a reported message until the report is handled, then restart its timer (or delete it at once if its time has passed).
Thanks
To oliverbates, whose idea on Discuss this is.
MIT licensed. ☕ If you like the things I have built, consider buying me a coffee.




