mattermost-plugin-autolink icon indicating copy to clipboard operation
mattermost-plugin-autolink copied to clipboard

Update links during rendering rather than before save to database

Open bbodenmiller opened this issue 6 years ago • 2 comments

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

bbodenmiller avatar Nov 30 '18 16:11 bbodenmiller

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.

hanzei avatar Jul 03 '19 04:07 hanzei

There is also a possibility of implementing client-side hooks and substitutions that should be researched.

levb avatar Jan 20 '20 16:01 levb