Admin API endpoint for creating/importing messages

(#1237) Feature Under consideration api migration self-hosting

Problem

Currently there's no good way outside of manually updating the database to import messages into a fluxer instance with custom dates and as other users. This makes situations like wanting to load message history from other platforms like Discord a lot more difficult.

Proposal

I propose one or two new admin endpoints that allow you to create a message in a given channel with a provided user id and created/edited dates. One endpoint for creating a single message and one for bulk message creation would be good.

1 comment

Sign in with Fluxer to comment and vote.
Comment by @LilyRose2798
RexSystem 1 vote originally by @LilyRose2798 on GitHub OP
As an additional note, one difficulty that may arise when implementing such a feature which I came across while doing manual message imports using the database is that currently channels don't seem to properly load messages that are in a bucket earlier than the bucket of the channel id. I'm not sure if there's a good way around this without somehow migrating a channel to a new ID if you try to add a message to a channel from before its creation date, or modifying the behaviour of how messages are loaded to not restrict the query to the bucket of the channel as the minimum bound (perhaps store a new field in the channel object in the db for what the minimum bucket in that channel is?).