Notably, they do have some "source-available" code that goes into the enterprise release, at https://github.com/mattermost/mattermost/tree/master/server/...
This mainly seems to relate to metrics and fuzzy search, though it's possible more will move here in the future (it looks like this is a relatively recent development). Until recently they also had experimental support for Bleve full-text search (now seemingly deprecated), but the elasticsearch enterprise feature seems to be the replacement (otherwise they use postgres's ILIKE for built-in text search)
So, all told, Mattermost was open source, and may be moving to open core. Which means now is probably the best time to create a community-maintained fork. The team edition, and almost all features, are currently still open source.
> Mattermost is an open core, self-hosted collaboration platform that offers chat, workflow automation, voice calling, screen sharing, and AI integration