mattermost-plugin-autolink
mattermost-plugin-autolink copied to clipboard
Update links during rendering rather than before save to database
As mentioned at https://mattermost.uservoice.com/forums/306457-general/suggestions/13380846-add-auto-link-functionality-e-g-to-create-links links may change over time
From #66:
This plugin creates regular expression (regexp) patterns that are reformatted into a Markdown link before the message is saved into the database.
There are real issues with this happening before being saved, rather than happening before rendering, as it means it is a lossy conversion that cannot be updated to fix e.g. bad configuration or URL changes.
It also means that anyone editing a post will not see what they typed, but some modified version, breaking the principal of least surprise and potentially causing confusion and errors.
The plugin should be modified so that the transformation takes place when the post is rendered, rather than when it is saved. If the current behaviour is useful to some people then this could be an additional setting in the config array (e.g.
"pre-save": true).Mattermost may need an extra hook to allow a pre-render transformation.
There is also a possibility of implementing client-side hooks and substitutions that should be researched.