From 32b92968989711fbb255be8917b5840ffdd014d8 Mon Sep 17 00:00:00 2001 From: kshitij katiyar Date: Wed, 4 Dec 2024 14:08:51 +0530 Subject: [PATCH] [MM-860]: Added message to delete webhook after subscription deletion --- server/plugin/command.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/plugin/command.go b/server/plugin/command.go index fe0c79bb7..370cd983e 100644 --- a/server/plugin/command.go +++ b/server/plugin/command.go @@ -155,7 +155,7 @@ func (p *Plugin) getMutedUsernames(userInfo *GitHubUserInfo) []string { return mutedUsers } -func (p *Plugin) handleMuteList(args *model.CommandArgs, userInfo *GitHubUserInfo) string { +func (p *Plugin) handleMuteList(_ *model.CommandArgs, userInfo *GitHubUserInfo) string { mutedUsernames := p.getMutedUsernames(userInfo) var mutedUsers string for _, user := range mutedUsernames { @@ -176,7 +176,7 @@ func contains(s []string, e string) bool { return false } -func (p *Plugin) handleMuteAdd(args *model.CommandArgs, username string, userInfo *GitHubUserInfo) string { +func (p *Plugin) handleMuteAdd(_ *model.CommandArgs, username string, userInfo *GitHubUserInfo) string { mutedUsernames := p.getMutedUsernames(userInfo) if contains(mutedUsernames, username) { return username + " is already muted" @@ -202,7 +202,7 @@ func (p *Plugin) handleMuteAdd(args *model.CommandArgs, username string, userInf return fmt.Sprintf("`%v`", username) + " is now muted. You'll no longer receive notifications for comments in your PRs and issues." } -func (p *Plugin) handleUnmute(args *model.CommandArgs, username string, userInfo *GitHubUserInfo) string { +func (p *Plugin) handleUnmute(_ *model.CommandArgs, username string, userInfo *GitHubUserInfo) string { mutedUsernames := p.getMutedUsernames(userInfo) userToMute := []string{username} newMutedList := arrayDifference(mutedUsernames, userToMute) @@ -215,7 +215,7 @@ func (p *Plugin) handleUnmute(args *model.CommandArgs, username string, userInfo return fmt.Sprintf("`%v`", username) + " is no longer muted" } -func (p *Plugin) handleUnmuteAll(args *model.CommandArgs, userInfo *GitHubUserInfo) string { +func (p *Plugin) handleUnmuteAll(_ *model.CommandArgs, userInfo *GitHubUserInfo) string { _, err := p.store.Set(userInfo.UserID+"-muted-users", []byte("")) if err != nil { return "Error occurred unmuting users" @@ -584,7 +584,8 @@ func (p *Plugin) handleUnsubscribe(_ *plugin.Context, args *model.CommandArgs, p } repoLink := baseURL + owner + "/" + repo - unsubscribeMessage = fmt.Sprintf("@%v unsubscribed this channel from [%s/%s](%s)", user.Username, owner, repo, repoLink) + unsubscribeMessage = fmt.Sprintf("@%v Unsubscribed this channel from [%s/%s](%s)", user.Username, owner, repo, repoLink) + unsubscribeMessage += fmt.Sprintf("\n Please delete the [webhook](%s) for this subscription unless it's required for other subscriptions.", fmt.Sprintf("%s/settings/hooks", repoLink)) if err := p.createPost(args.ChannelId, p.BotUserID, unsubscribeMessage); err != nil { return fmt.Sprintf("%s error creating the public post: %s", unsubscribeMessage, err.Error())