Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GH-618]: Added slack attachment for webhook posts, in order to comment, edit, and close issues. #636

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cbb804e
[MI-2502]:Added custom type for webhook post in order to comment, edi…
Nityanand13 Jan 31, 2023
4378034
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Nityanand13 Jan 31, 2023
20ab25d
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Nityanand13 Feb 8, 2023
70ae885
[MI-2736]: Done the review fixes of a github PR #636 (#20)
Nityanand13 Feb 9, 2023
3cecd5d
[MI-2736]: Done the review fixes of a github PR #636 (#21)
Nityanand13 Feb 16, 2023
779f10f
[MI-2814] Done the review fixes of github PR #636 (#22)
Nityanand13 Mar 13, 2023
67c370b
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Nityanand13 Mar 13, 2023
2de4435
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
ayusht2810 Apr 9, 2024
0f40aba
[MM-618] Update validations, modal title, styling, post messages, con…
ayusht2810 Apr 10, 2024
f4f5057
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
ayusht2810 Apr 24, 2024
9f7af14
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
ayusht2810 May 1, 2024
d0e7abd
[MM-618] Remove constants and serializers package
ayusht2810 May 1, 2024
1a279e8
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
ayusht2810 Jun 21, 2024
39fe3cf
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
raghavaggarwal2308 Jul 2, 2024
c5a8d29
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
raghavaggarwal2308 Jul 5, 2024
136221f
[MM-556] Review fixes
raghavaggarwal2308 Jul 5, 2024
482fcf9
[MM-617]: converted the custom post to slack attachment for issue cre…
Kshitij-Katiyar Aug 6, 2024
79c266e
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Kshitij-Katiyar Aug 6, 2024
28300d5
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Kshitij-Katiyar Aug 30, 2024
b413828
[MM-618]: Fixed the lint
Kshitij-Katiyar Aug 30, 2024
64655a0
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
Kshitij-Katiyar Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gith…
…ub into MM-618
  • Loading branch information
Nityanand13 committed Mar 13, 2023
commit 67c370ba5b362bf8abe68c35dbef0b070679969a
8 changes: 4 additions & 4 deletions server/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ func (p *Plugin) ReactionHasBeenAdded(c *plugin.Context, reaction *model.Reactio

info, appErr := p.getGitHubUserInfo(reaction.UserId)
if appErr != nil {
if appErr.ID != apiErrorIDNotConnected {
if appErr.ID != constants.APIErrorIDNotConnected {
p.API.LogDebug("Error in getting user info", "error", appErr.Error())
}
return
}

ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
ctx, cancel := context.WithTimeout(context.Background(), constants.RequestTimeout)
defer cancel()
ghClient := p.githubConnectUser(ctx, info)
switch objectType {
Expand Down Expand Up @@ -375,13 +375,13 @@ func (p *Plugin) ReactionHasBeenRemoved(c *plugin.Context, reaction *model.React

info, appErr := p.getGitHubUserInfo(reaction.UserId)
if appErr != nil {
if appErr.ID != apiErrorIDNotConnected {
if appErr.ID != constants.APIErrorIDNotConnected {
p.API.LogDebug("Error in getting user info", "error", appErr.Error())
}
return
}

ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
ctx, cancel := context.WithTimeout(context.Background(), constants.RequestTimeout)
defer cancel()
ghClient := p.githubConnectUser(ctx, info)
switch objectType {
Expand Down
16 changes: 16 additions & 0 deletions server/plugin/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ import (
"github.com/microcosm-cc/bluemonday"
)

const (
postPropGithubRepo = "gh_repo"
postPropGithubObjectID = "gh_object_id"
postPropGithubObjectType = "gh_object_type"

githubObjectTypeIssue = "issue"
githubObjectTypeIssueComment = "issue_comment"
githubObjectTypePRReviewComment = "pr_review_comment"
)

// RenderConfig holds various configuration options to be used in a template
// for redering an event.
type RenderConfig struct {
Expand Down Expand Up @@ -574,6 +584,12 @@ func (p *Plugin) postIssueEvent(event *github.IssuesEvent) {
constants.IssueStatus: constants.Close,
}
}
repoName := strings.ToLower(repo.GetFullName())
issueNumber := issue.Number

post.AddProp(postPropGithubRepo, repoName)
post.AddProp(postPropGithubObjectID, issueNumber)
post.AddProp(postPropGithubObjectType, githubObjectTypeIssue)

label := sub.Label()

Expand Down
20 changes: 10 additions & 10 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

You are viewing a condensed version of this merge commit. You can view the full changes here.