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-61]: Adding "Create Issue" and "Attach Comment to Issue" modals #306

Merged
merged 81 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
23015c1
[MI-1847] Created new branch for create-issue-modal
raghavaggarwal2308 Jun 16, 2022
10d90d9
[MI-1847] fixed error while running make check-style
raghavaggarwal2308 Jun 16, 2022
f6172d2
[MI-1847]Review fixes
raghavaggarwal2308 Jun 17, 2022
114774c
[MI-1847]Fixed initial srtate of milestone in create_issue.tsx
raghavaggarwal2308 Jun 17, 2022
a054a7d
[MI-1860]Added attach comment to gitlab issue button
raghavaggarwal2308 Jun 9, 2022
cc7f9cc
[MI-1860]Added "Attach to gilab issue" modal
raghavaggarwal2308 Jun 9, 2022
f7e864f
[MI-1860]Attach comment endpoint
raghavaggarwal2308 Jun 10, 2022
7f193d0
[MI-1860]Added post message
raghavaggarwal2308 Jun 11, 2022
af71d4e
[MI-1860]Handled error
raghavaggarwal2308 Jun 12, 2022
e3ca566
Code formatting
raghavaggarwal2308 Jun 12, 2022
bcaea3f
Merge branch 'MI-1847' of github.com:Brightscout/mattermost-plugin-gi…
raghavaggarwal2308 Jun 14, 2022
a753160
[MI-1860]Pull from MI-1847
raghavaggarwal2308 Jun 14, 2022
b5b12b1
removed //eslint-diable...
raghavaggarwal2308 Jun 14, 2022
6fd1907
[MI-1860]Review fixes
raghavaggarwal2308 Jun 15, 2022
a324c0a
Merge branch 'MI-1847' of github.com:Brightscout/mattermost-plugin-gi…
raghavaggarwal2308 Jun 16, 2022
b04d319
[MI-1860]Review Fixes
raghavaggarwal2308 Jun 17, 2022
08318e6
[MI-1860]Fixes
raghavaggarwal2308 Jun 17, 2022
1511295
[MI-1847] Review fixes
raghavaggarwal2308 Jun 20, 2022
395ead8
[MI-1847]Review Fixes
raghavaggarwal2308 Jun 20, 2022
78e2fe4
Merge pull request #9 from Brightscout/new-MI-1847
raghavaggarwal2308 Jun 20, 2022
be79e99
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jun 21, 2022
f63ed27
Fixed CI error
raghavaggarwal2308 Jun 21, 2022
7280b93
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jun 21, 2022
f444757
[MI-1847]Fixes
raghavaggarwal2308 Jun 21, 2022
612dae9
[MI-1847]Review FIxes
raghavaggarwal2308 Jun 23, 2022
53c2fc0
Merge branch 'MI-1847-component-fix' of github.com:Brightscout/matter…
raghavaggarwal2308 Jun 23, 2022
505ef61
[MI-1860]Review fixes
raghavaggarwal2308 Jun 24, 2022
e121b66
[MI-1847]Review fixes
raghavaggarwal2308 Jun 29, 2022
b514add
[MI-1847]Converted remaining class components to functional components
raghavaggarwal2308 Jun 29, 2022
71ba323
[MI-1860]Fixed variable names
raghavaggarwal2308 Jun 29, 2022
5891151
[MI-1847]Review fixes
raghavaggarwal2308 Jun 30, 2022
b311a0f
[MI-1847]Review fixes
raghavaggarwal2308 Jun 30, 2022
c441278
[MI-1847]Review fixes
raghavaggarwal2308 Jul 1, 2022
f98f996
Merge pull request #12 from Brightscout/MI-1847-component-fix
raghavaggarwal2308 Jul 1, 2022
b11a35e
Merge branch 'create_issue_modal' of github.com:Brightscout/mattermos…
raghavaggarwal2308 Jul 1, 2022
51ddddd
[MI-1860]Review fixes
raghavaggarwal2308 Jul 1, 2022
286de6f
[MI-1860]Review fixes
raghavaggarwal2308 Jul 5, 2022
d61b49b
[MI-1860]Review Fixes
raghavaggarwal2308 Jul 6, 2022
7e3bb1d
Merge pull request #10 from Brightscout/new-MI-1860
raghavaggarwal2308 Jul 6, 2022
1debe45
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 13, 2022
77bd128
[MI-2221] Review fixes (#22)
raghavaggarwal2308 Oct 6, 2022
53f914c
[MI-2245] Fix failing "Code scanning / CodeQL" in gitlab create issue…
raghavaggarwal2308 Oct 12, 2022
79e82ae
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 25, 2022
dd36a6f
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 15, 2022
f88ea7a
Fix lint errors
raghavaggarwal2308 Dec 15, 2022
d869175
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 13, 2023
e5b9082
[MI-2701]: Done the review fixes of a PR: Adding create issue modal #…
Nityanand13 Feb 3, 2023
aaf36e3
[MI-2947]: Did the review fixes of a gitlab PR #306 (#31)
Nityanand13 Mar 30, 2023
4da3919
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Mar 30, 2023
736c0ac
[MI-2967]: Did the review fixes of gitlab PR #306 (#33)
Nityanand13 Apr 4, 2023
bef1f23
[MI-2959] Review fixes on Gitlab PR #306(Add create issue modal)
raghavaggarwal2308 May 1, 2023
4cf4448
Merge pull request #36 from Brightscout/MI-2959
raghavaggarwal2308 May 1, 2023
17a962b
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 May 10, 2023
c43dbe9
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 28, 2023
cf26366
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Nov 29, 2023
a926c2c
[MI-3787] Fix reported issue:
raghavaggarwal2308 Nov 29, 2023
a264673
[MM-3] Removed "ussCallback" and "useMemo" hooks
raghavaggarwal2308 Dec 7, 2023
cf43d8e
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 13, 2023
2666781
[MM-3] Removed useMemo/useCallabck and fixed lint error.
raghavaggarwal2308 Dec 14, 2023
ce8d613
[MM-3] Separated out form components for create issue modal
raghavaggarwal2308 Dec 14, 2023
0e35472
[MM-3] Seperate out form component for attach comment to issue modal
raghavaggarwal2308 Dec 14, 2023
c1bbf7e
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Dec 20, 2023
d5b52ff
Fix lint errors
raghavaggarwal2308 Dec 20, 2023
33dab04
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 22, 2024
8e48d31
[MM-158] Review fixes
raghavaggarwal2308 Jan 22, 2024
96c60cd
[MM-158] Review fixes:
raghavaggarwal2308 Jan 22, 2024
2783352
[MM-158] Review fixes:
raghavaggarwal2308 Jan 22, 2024
3fd2c21
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jan 31, 2024
1ae302f
[MM-146] Fixed lint errors
raghavaggarwal2308 Jan 31, 2024
ea29b31
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Feb 2, 2024
082a192
Merge branch 'master' into create_issue_modal
raghavaggarwal2308 Mar 18, 2024
e0e2765
[MM-289] Fix ci error
raghavaggarwal2308 Mar 18, 2024
fe33b33
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Apr 23, 2024
f01c791
Review fixes: Add new types, error state and some refactoring
ayusht2810 Jun 27, 2024
1f9fbc3
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
ayusht2810 Jun 27, 2024
c09c256
Fix package-lock.json file
ayusht2810 Jun 27, 2024
7216af6
[MM-527] Review fixes
raghavaggarwal2308 Jun 28, 2024
6758220
Create a new type
ayusht2810 Jul 1, 2024
625e227
Merge branch 'master' of github.com:mattermost/mattermost-plugin-gitl…
raghavaggarwal2308 Jul 9, 2024
dbe16e3
Update package-lock.json file due to ci errors
ayusht2810 Jul 9, 2024
90a50a3
Fix type errors
ayusht2810 Jul 9, 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
274 changes: 273 additions & 1 deletion server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/mattermost/mattermost/server/public/plugin"
"github.com/mattermost/mattermost/server/public/pluginapi/experimental/bot/logger"
"github.com/mattermost/mattermost/server/public/pluginapi/experimental/flow"
internGitlab "github.com/xanzy/go-gitlab"

"github.com/mattermost/mattermost-plugin-gitlab/server/gitlab"
"github.com/mattermost/mattermost-plugin-gitlab/server/subscription"
Expand All @@ -28,7 +29,9 @@ import (
const (
APIErrorIDNotConnected = "not_connected"

requestTimeout = 30 * time.Second
queryParamSearch = "search"
queryParamProjectID = "projectID"
requestTimeout = 30 * time.Second
)

func (p *Plugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
Expand All @@ -54,6 +57,13 @@ func (p *Plugin) initializeAPI() {

apiRouter.HandleFunc("/user", p.checkAuth(p.attachContext(p.getGitlabUser), ResponseTypeJSON)).Methods(http.MethodPost)
apiRouter.HandleFunc("/todo", p.checkAuth(p.attachUserContext(p.postToDo), ResponseTypeJSON)).Methods(http.MethodPost)
apiRouter.HandleFunc("/issue", p.checkAuth(p.attachUserContext(p.createIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/attachcommenttoissue", p.checkAuth(p.attachUserContext(p.attachCommentToIssue), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/projects", p.checkAuth(p.attachUserContext(p.getYourProjects), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/labels", p.checkAuth(p.attachUserContext(p.getLabels), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/assignees", p.checkAuth(p.attachUserContext(p.getAssignees), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/milestones", p.checkAuth(p.attachUserContext(p.getMilestones), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/searchissues", p.checkAuth(p.attachUserContext(p.searchIssues), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/lhs-data", p.checkAuth(p.attachUserContext(p.getLHSData), ResponseTypePlain)).Methods(http.MethodGet)
apiRouter.HandleFunc("/prdetails", p.checkAuth(p.attachUserContext(p.getPrDetails), ResponseTypePlain)).Methods(http.MethodPost)
apiRouter.HandleFunc("/issue", p.checkAuth(p.attachUserContext(p.getIssueByNumber), ResponseTypeJSON)).Methods(http.MethodGet)
Expand Down Expand Up @@ -573,6 +583,268 @@ func (p *Plugin) getLHSData(c *UserContext, w http.ResponseWriter, r *http.Reque
p.writeAPIResponse(w, result)
}

func (p *Plugin) createIssue(c *UserContext, w http.ResponseWriter, r *http.Request) {
var issue *gitlab.IssueRequest

if err := json.NewDecoder(r.Body).Decode(&issue); err != nil {
c.Log.WithError(err).Warnf("There was an error while creating the issue")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("There was an error while creating the issue. Error: %s", err.Error()), StatusCode: http.StatusBadRequest})
return
}

var post *model.Post
var appErr *model.AppError
permalink := ""
if issue.PostID != "" {
post, appErr = p.API.GetPost(issue.PostID)
if appErr != nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to load post %s", issue.PostID), StatusCode: http.StatusInternalServerError})
return
}
if post == nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to load post %s : not found", issue.PostID), StatusCode: http.StatusNotFound})
return
}
permalink = p.getPermalink(issue.PostID)
}

var result *internGitlab.Issue
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.CreateIssue(c.Ctx, c.GitlabInfo, issue, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't create issue in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("unable to create issue in GitLab. Error: %s", err.Error()), StatusCode: http.StatusInternalServerError})
return
}

rootID := issue.PostID
channelID := issue.ChannelID
message := fmt.Sprintf("Created GitLab issue [#%v](%v)", result.IID, result.WebURL)
if post != nil {
if post.RootId != "" {
rootID = post.RootId
}
channelID = post.ChannelId
message += fmt.Sprintf(" from a [message](%s)", permalink)
}

reply := &model.Post{
Message: message,
ChannelId: channelID,
RootId: rootID,
UserId: p.BotUserID,
}

if post != nil {
spirosoik marked this conversation as resolved.
Show resolved Hide resolved
_, appErr = p.API.CreatePost(reply)
} else {
p.API.SendEphemeralPost(c.UserID, reply)
}
if appErr != nil {
c.Log.WithError(appErr).Warnf("failed to create notification post")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to create notification post, postID: %s, channelID: %s", issue.PostID, channelID), StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) attachCommentToIssue(c *UserContext, w http.ResponseWriter, r *http.Request) {
var issue *gitlab.IssueRequest

if err := json.NewDecoder(r.Body).Decode(&issue); err != nil {
c.Log.WithError(err).Warnf("There was an error while attaching a comment to the issue")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("There was an error while attaching a comment to the issue. Error: %s", err.Error()), StatusCode: http.StatusBadRequest})
return
}

if err := p.validateCommentBody(issue); err != nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: err.Error(), StatusCode: http.StatusBadRequest})
return
}

post, appErr := p.API.GetPost(issue.PostID)
if appErr != nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to load post %s", issue.PostID), StatusCode: appErr.StatusCode})
return
}
if post == nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to load post %s : not found", issue.PostID), StatusCode: http.StatusNotFound})
return
}

commentUsername, apiErr := p.getUsername(post.UserId)
if apiErr != nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to get username. Error: %s", apiErr.Message), StatusCode: apiErr.StatusCode})
return
}

permalink := p.getPermalink(issue.PostID)

var result *internGitlab.Note
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.AttachCommentToIssue(c.Ctx, c.GitlabInfo, issue, permalink, commentUsername, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't add comment to issue in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("cant't add comment to issue in GitLab. Error: %s", err.Error()), StatusCode: http.StatusInternalServerError})
return
}

rootID := issue.PostID
if post.RootId != "" {
// The original post was a reply
rootID = post.RootId
}

permalinkReplyMessage := fmt.Sprintf("[Message](%s) attached to GitLab issue [#%d](%s)", permalink, issue.IID, issue.WebURL)
reply := &model.Post{
Message: permalinkReplyMessage,
ChannelId: post.ChannelId,
RootId: rootID,
UserId: p.BotUserID,
}

_, appErr = p.API.CreatePost(reply)
if appErr != nil {
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("failed to create notification post %s", issue.PostID), StatusCode: appErr.StatusCode})
return
}
p.writeAPIResponse(w, result)
}

func (p *Plugin) validateCommentBody(issue *gitlab.IssueRequest) error {
if issue.PostID == "" {
return errors.Errorf("please provide a valid post id")
}

if issue.IID == 0 {
return errors.Errorf("please provide a valid post iid")
}

if issue.Comment == "" {
return errors.Errorf("please provide a valid non empty comment")
}
return nil
}

func (p *Plugin) getPermalink(postID string) string {
siteURL := *p.API.GetConfig().ServiceSettings.SiteURL

return fmt.Sprintf("%v/_redirect/pl/%v", siteURL, postID)
}

func (p *Plugin) searchIssues(c *UserContext, w http.ResponseWriter, r *http.Request) {
search := r.FormValue(queryParamSearch)

var result []*internGitlab.Issue
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.SearchIssues(c.Ctx, c.GitlabInfo, search, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("unable to search issues in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: fmt.Sprintf("unable to search issues in GitLab. Error: %s", err.Error()), StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) getYourProjects(c *UserContext, w http.ResponseWriter, r *http.Request) {
var result []*internGitlab.Project
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.GetYourProjects(c.Ctx, c.GitlabInfo, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't list projects in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "Unable to list projects in GitLab.", StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) getLabels(c *UserContext, w http.ResponseWriter, r *http.Request) {
projectID := r.URL.Query().Get(queryParamProjectID)
var result []*internGitlab.Label
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.GetLabels(c.Ctx, c.GitlabInfo, projectID, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't list labels of project in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "unable to list labels in GitLab.", StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) getMilestones(c *UserContext, w http.ResponseWriter, r *http.Request) {
projectID := r.URL.Query().Get(queryParamProjectID)
var result []*internGitlab.Milestone
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.GetMilestones(c.Ctx, c.GitlabInfo, projectID, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't list milestones of project in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "unable to list milestones in GitLab.", StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) getAssignees(c *UserContext, w http.ResponseWriter, r *http.Request) {
projectID := r.URL.Query().Get(queryParamProjectID)
var result []*internGitlab.ProjectMember
err := p.useGitlabClient(c.GitlabInfo, func(info *gitlab.UserInfo, token *oauth2.Token) error {
resp, err := p.GitlabClient.GetProjectMembers(c.Ctx, c.GitlabInfo, projectID, token)
if err != nil {
return err
}
result = resp
return nil
})
if err != nil {
c.Log.WithError(err).Warnf("can't list assignees of the project in GitLab")
p.writeAPIError(w, &APIErrorResponse{ID: "", Message: "unable to list assignees in GitLab.", StatusCode: http.StatusInternalServerError})
return
}

p.writeAPIResponse(w, result)
}

func (p *Plugin) postToDo(c *UserContext, w http.ResponseWriter, r *http.Request) {
_, text, err := p.GetToDo(c.Ctx, c.GitlabInfo)
if err != nil {
Expand Down
29 changes: 29 additions & 0 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (res
return p.getCommandResponse(args, "Encountered an error getting your todo items."), nil
}
return p.getCommandResponse(args, text), nil
case "issue":
message := p.handleIssue(c, args, parameters)
if message != "" {
p.postCommandResponse(args, message)
}
return &model.CommandResponse{}, nil
case "me":
var gitUser *gitlabLib.User
err := p.useGitlabClient(info, func(info *gitlab.UserInfo, token *oauth2.Token) error {
Expand Down Expand Up @@ -366,6 +372,23 @@ func (p *Plugin) handleSetup(c *plugin.Context, args *model.CommandArgs, paramet
return ""
}

func (p *Plugin) handleIssue(_ *plugin.Context, args *model.CommandArgs, parameters []string) string {
if len(parameters) == 0 {
return "Invalid issue command. Available command is 'create'."
}

command := parameters[0]
parameters = parameters[1:]

switch {
case command == "create":
p.openIssueCreateModal(args.UserId, args.ChannelId, strings.Join(parameters, " "))
return ""
default:
return fmt.Sprintf("This command is not implemented yet. Command: %v", command)
}
}

// webhookCommand processes the /gitlab webhook commands
func (p *Plugin) webhookCommand(ctx context.Context, parameters []string, info *gitlab.UserInfo, enablePrivateRepo bool) string {
if len(parameters) < 1 {
Expand Down Expand Up @@ -808,6 +831,12 @@ func getAutocompleteData(config *configuration) *model.AutocompleteData {
todo := model.NewAutocompleteData("todo", "", "Get a list of todos, assigned issues, assigned merge requests and merge requests awaiting your review")
gitlab.AddCommand(todo)

issue := model.NewAutocompleteData("issue", "[command]", "Available commands: create")
gitlab.AddCommand(issue)

issueCreate := model.NewAutocompleteData("create", "[title]", "Open a dialog to create a new issue in Gitlab, using the title if provided")
issue.AddCommand(issueCreate)

subscriptions := model.NewAutocompleteData("subscriptions", "[command]", "Available commands: Add, List, Delete")

subscriptionsList := model.NewAutocompleteData(commandList, "", "List current channel subscriptions")
Expand Down
Loading
Loading