Skip to content

Commit

Permalink
[MM-860]: Added message to delete webhook after subscription deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Kshitij-Katiyar committed Dec 4, 2024
1 parent 827e881 commit 32b9296
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/plugin/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
Expand All @@ -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)
Expand All @@ -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"
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 32b9296

Please sign in to comment.