Skip to content

[GH-108]: Added the setting in the system console for plugin settings#126

Open
Kshitij-Katiyar wants to merge 5 commits into
masterfrom
MM-108
Open

[GH-108]: Added the setting in the system console for plugin settings#126
Kshitij-Katiyar wants to merge 5 commits into
masterfrom
MM-108

Conversation

@Kshitij-Katiyar

@Kshitij-Katiyar Kshitij-Katiyar commented Apr 3, 2024

Copy link
Copy Markdown
Contributor

Summary

This PR has been created using the PR #92. It adds a long text field for the plugin configuration settings.

Ticket Link

Fixes #108
Fixes #56

@Kshitij-Katiyar

Copy link
Copy Markdown
Contributor Author

@mickmister Regarding the QA comment #92 (review), I tried making the build from the master branch and deploying it on MM v5.37+ which is its minimum supported version. I am getting the error

"error":"unable to start plugin: com. mattermost.welcomebot: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol."

But the above builds are working fine on MMv7.8.0+, So here we can do 2 things I can each commit in this plugin and check for which we are actually getting the error and try to debug and fix that or we can just update the minimum supported version for this plugin. But in any case, this error is not related to this PR.
cc: @AayushChaudhary0001

Comment thread README.md
]
```

If you see `[Object object]` in the text field, that's because the configuration was configured as JSON directly in your `config.json` instead of as a string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead JSON.stringify the data if it's not originally a string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mickmister Can you elaborate a bit on this, I am not really able to understand it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the other review comments, I am not able to push the code, as we don't have access to push the code. Will fix it afterwards

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, if it's the case that the setting is an object (and not a JSON string), then the frontend can call JSON.stringify to make it into a string to put into the text box. This would require the plugin setting to be custom I think. Otherwise the admin cannot go and edit the current configuration if it just says [Object object]

Ideally we can just keep it as an object in the config file too, and not have a JSON string in the config.json file. Which would also require it to be a custom admin console setting

@mickmister mickmister left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments here, otherwise LGTM 👍

Comment thread README.md

In the UI, go to **System Console -> Plugins -> Welcome Bot** and edit the **Welcome Messages** text field to include the JSON array for messages you want to send. Use the following format:

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```json

Comment thread plugin.json
Comment on lines +21 to +27
{
"key": "WelcomeMessages",
"type": "longtext",
"display_name": "Welcome Messages:",
"help_text": "JSON formatted configuration for the welcome messages. See [usage here](https://github.com/mattermost/mattermost-plugin-welcomebot#usage)."
}
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation seems off here

Suggested change
{
"key": "WelcomeMessages",
"type": "longtext",
"display_name": "Welcome Messages:",
"help_text": "JSON formatted configuration for the welcome messages. See [usage here](https://github.com/mattermost/mattermost-plugin-welcomebot#usage)."
}
]
{
"key": "WelcomeMessages",
"type": "longtext",
"display_name": "Welcome Messages:",
"help_text": "JSON formatted configuration for the welcome messages. See [usage here](https://github.com/mattermost/mattermost-plugin-welcomebot#usage)."
}
]

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has been tested for the below conditions:-

  • User getting a welcome message
  • User gets the action button in a post.
  • User is added to a channel by completing the action as asked in action button.

The PR works fine for all the conditions above, LGTM. Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement plugin settings in admin console How to add welcome message in k8s environment

5 participants