Mattermost-server: [Help Wanted] [MM-4819] Add a setting to the system console to change the minimum length of hashtags

Created on 24 Jul 2018  路  14Comments  路  Source: mattermost/mattermost-server

If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide, specifically for machine setup and for developer workflow.


Notes: Jira ticket

We require hashtags to be 3 characters or more right now because MySQL doesn't support searching for shorter strings by default. Postgres supports them by default and MySQL can be configured to support them, so we should add a setting that the user can change in those cases. This is particularly needed for CJK teams since 2 letter words are common for them.

This will need:
1) A MinimumHashtagLength setting added to the config.json. This will likely be part of the ServiceSettings section unless we come up with somewhere more appropriate (like a SearchSettings section once we get around to improving search)
2) An entry in the System Console to change that setting. This should be added under Advanced > Database Settings until somewhere better is added.

Minimum Hashtag Length [ 3 ]
Help Text: "Minimum number of characters in a hashtag. MySQL data bases must be configured to support searching strings shorter than three characters, see documentation.

3) The MIN_HASHTAG_LINK_LENGTH constant should be removed and this setting should be used in its place in text_formatting.jsx. No changes are required on the server to support the new setting.

Mattermost docs: https://docs.mattermost.com/install/requirements.html?highlight=ft_min_word_len#database-software
MySQL docs: https://dev.mysql.com/doc/refman/8.0/en/fulltext-fine-tuning.html

Medium TecGo TecReactJS

Most helpful comment

If this issue is free, I would like to take this.

All 14 comments

Hey @jasonblais! Would love to work on this issue if it hasn't been done yet 馃憤

Awesome! @santos22 it's available. Let us know if you have any questions.

Glad to see you around :)

Glad to be around! @sudheerDev do you know if this will require any Redux work? Also, I think the Go label can be removed if there will be no server changes 馃槃

The only thing that might be changed in redux would be if you added a helper function to get that setting from the config since it'd be used in both the web and mobile apps. The server changes required for this will just be to add the setting to model/config.go and ensure that it's sent to the apps.

Can the setting be retrieved from the config using the following import?

import {getConfig} from 'mattermost-redux/actions/admin';

@hmhealey on the above ^

@santos22 Sorry about the delay. Since that's in actions, it's for actually loading the config from the server which is already done by that point.

The other changes still needed for this are:

  1. As mentioned above, you'll need to add the new field to the config in config/default.json and model/config.go on the server. You'll also need to add it to GenerateClientConfig in utils/config.go so that non-admin users can see the setting's value.
  2. On both the web and mobile apps, you'll have to make the setting have an effect.

    1. For the web app, you'll have to pass the value from the config into the Markdown component and then pass that into formatText where it parses the hashtags.

    2. For the mobile app, it'll work similarly with its Markdown component, except you'll pass it into the commonmark.js Parser as an option.

If you need any help (particularly for the mobile app since it's a bit more difficult to set up a test environment for that), please let me know, and I'll try to respond quicker :)

No worries @hmhealey! I tested out the changes on the server and was able to see the value in the web app.

Does the second change replace Constants.MIN_HASHTAG_LINK_LENGTH in the web app as mentioned in the issue?

Yes, that's the value you'll have to replace on the web app. The mobile app doesn't have a constant like that, but our fork of commonmark.js still has an option that you can pass to set that length

I don't think I'll be able to get to the other two changes in the coming days. Happy to open this issue to other contributors and help out if needed.

If this issue is free, I would like to take this.

It is! It would be great, if you would take care of this! Please take note of https://github.com/mattermost/mattermost-webapp/pull/1885. It a PR from @santos22 that is a good starting point. If you want, you can branch of his branch and use his code.

Thanks @hanzei!
And thanks @santos22, your discussion helps my understanding for this issue 馃憤

I just noticed this issue was closed automatically by Github after I merged PR on the webapp. I'm reopening so we can track the remaining PR for mobile app.

Was this page helpful?
0 / 5 - 0 ratings