Skip to content

Commit

Permalink
GH-392: Let Jira Admin specify additional helptext to be shown along …
Browse files Browse the repository at this point in the history
…with the output of command (#419)
  • Loading branch information
themaverikk authored and mickmister committed Jan 4, 2020
1 parent f8f404d commit 031604c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
7 changes: 7 additions & 0 deletions plugin.json
Expand Up @@ -69,6 +69,13 @@
"type": "text",
"help_text": "Comma separated list of Group Names. List the Jira user groups who can create subscriptions. If none are specified, any Jira user can create a subscription.",
"default": ""
},
{
"key": "JiraAdminAdditionalHelpText",
"display_name": "Additional Help Text to be shown with Jira Help",
"type": "text",
"help_text": "Additional Help Text to be shown to the user along with the output of `/jira help` command",
"default": ""
}
],
"footer": "Use this webhook URL format to [configure the Jira integration.](https://about.mattermost.com/default-jira-plugin) `https://SITEURL/plugins/jira/api/v2/webhook?secret=WEBHOOKSECRET`"
Expand Down
16 changes: 13 additions & 3 deletions server/command.go
Expand Up @@ -13,8 +13,9 @@ import (
"github.com/mattermost/mattermost-plugin-jira/server/utils"
)

const commonHelpText = "###### Mattermost Jira Plugin - Slash Command Help\n" +
"* `/jira connect` - Connect your Mattermost account to your Jira account\n" +
const helpTextHeader = "###### Mattermost Jira Plugin - Slash Command Help\n"

const commonHelpText = "\n* `/jira connect` - Connect your Mattermost account to your Jira account\n" +
"* `/jira disconnect` - Disconnect your Mattermost account from your Jira account\n" +
"* `/jira assign <issue-key> <assignee>` - Change the assignee of a Jira issue\n" +
"* `/jira create <text (optional)>` - Create a new Issue with 'text' inserted into the description field\n" +
Expand Down Expand Up @@ -90,7 +91,16 @@ func commandHelp(p *Plugin, c *plugin.Context, header *model.CommandArgs, args .
func (p *Plugin) help(args *model.CommandArgs) *model.CommandResponse {
authorized, _ := authorizedSysAdmin(p, args.UserId)

helpText := commonHelpText
helpText := helpTextHeader
jiraAdminAdditionalHelpText := p.getConfig().JiraAdminAdditionalHelpText

// Check if JIRA admin has provided additional help text to be shown up along with regular output
if jiraAdminAdditionalHelpText != "" {
helpText += " " + jiraAdminAdditionalHelpText
}

helpText += commonHelpText

if authorized {
helpText += sysAdminHelpText
}
Expand Down
3 changes: 3 additions & 0 deletions server/plugin.go
Expand Up @@ -59,6 +59,9 @@ type externalConfig struct {

// Disable statistics gathering
DisableStats bool `json:"disable_stats"`

// Additional Help Text to be shown in the output of '/jira help' command
JiraAdminAdditionalHelpText string
}

const currentInstanceTTL = 1 * time.Second
Expand Down

0 comments on commit 031604c

Please sign in to comment.