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 4 commits
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/Masterminds/sprig/v3 v3.2.2
github.com/google/go-github/v41 v41.0.0
github.com/google/go-github/v48 v48.2.0
github.com/gorilla/mux v1.8.0
github.com/mattermost/mattermost-plugin-api v0.0.27
github.com/mattermost/mattermost-server/v6 v6.5.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,14 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg=
github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg=
github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE=
github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
Expand Down Expand Up @@ -1941,7 +1942,6 @@ golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
Expand Down
2 changes: 1 addition & 1 deletion server/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"strings"

"github.com/google/go-github/v41/github"
"github.com/google/go-github/v48/github"
"github.com/pkg/errors"
"golang.org/x/oauth2"

Expand Down
46 changes: 46 additions & 0 deletions server/constants/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package constants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://go.dev/blog/package-names

Avoid meaningless package names. Packages named util, common, or misc provide clients with no sense of what the package contains.

What value does a separate package provide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hanzei Keeping things in separate package helps us in writing unit tests and creating mocks for packages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4/5 that a constants package is not an idiomatic way to store variables, as it contradicts the above quote.


import "time"

const (
APIErrorIDNotConnected = "not_connected"
// TokenTTL is the OAuth token expiry duration in seconds
TokenTTL = 600

RequestTimeout = 30 * time.Second
OauthCompleteTimeout = 2 * time.Minute
HeaderMattermostUserID = "Mattermost-User-ID"
OwnerQueryParam = "owner"
RepoQueryParam = "repo"
NumberQueryParam = "number"
PostIDQueryParam = "postId"

IssueStatus = "status"
AssigneesForProps = "assignees"
LabelsForProps = "labels"
DescriptionForProps = "description"
TitleForProps = "title"
IssueNumberForProps = "issue_number"
IssueURLForProps = "issue_url"
RepoOwnerForProps = "repo_owner"
RepoNameForProps = "repo_name"

Close = "Close"
Reopen = "Reopen"

IssueCompleted = "completed"
IssueNotPlanned = "not_planned"
IssueClose = "closed"
IssueOpen = "open"

// Actions of webhook events
ActionOpened = "opened"
ActionClosed = "closed"
ActionReopened = "reopened"
ActionSubmitted = "submitted"
ActionLabeled = "labeled"
ActionAssigned = "assigned"
ActionCreated = "created"
ActionDeleted = "deleted"
ActionEdited = "edited"
)
Loading