diff --git a/server/command.go b/server/command.go index 3dde15ce..ae994b42 100644 --- a/server/command.go +++ b/server/command.go @@ -339,7 +339,7 @@ func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (res } } -func (p *Plugin) handleSetup(c *plugin.Context, args *model.CommandArgs, parameters []string) string { +func (p *Plugin) handleSetup(_ *plugin.Context, args *model.CommandArgs, parameters []string) string { userID := args.UserId isSysAdmin, err := p.isAuthorizedSysAdmin(userID) if err != nil { @@ -590,7 +590,7 @@ func parseTriggers(triggersCsv string) *gitlab.AddWebhookOptions { } } -func (p *Plugin) subscriptionDelete(info *gitlab.UserInfo, config *configuration, fullPath, channelID string) (string, error) { +func (p *Plugin) subscriptionDelete(_ *gitlab.UserInfo, config *configuration, fullPath, channelID string) (string, error) { normalizedPath := normalizePath(fullPath, config.GitlabURL) deleted, updatedSubscriptions, err := p.Unsubscribe(channelID, normalizedPath) if err != nil { @@ -604,7 +604,15 @@ func (p *Plugin) subscriptionDelete(info *gitlab.UserInfo, config *configuration p.sendChannelSubscriptionsUpdated(updatedSubscriptions, channelID) - return fmt.Sprintf("Successfully deleted subscription for %s.", normalizedPath), nil + baseURL := config.GitlabURL + if !strings.HasSuffix(baseURL, "/") { + baseURL += "/" + } + + unsubscribeMessage := fmt.Sprintf("Successfully deleted subscription for %s.", fmt.Sprintf("[%s](%s)", normalizedPath, baseURL+normalizedPath)) + unsubscribeMessage += fmt.Sprintf("\n Please delete the [webhook](%s) for this subscription unless it's required for other subscriptions.", fmt.Sprintf("%s%s/-/hooks", baseURL, normalizedPath)) + + return unsubscribeMessage, nil } // subscriptionsListCommand list GitLab subscriptions in a channel