-
Notifications
You must be signed in to change notification settings - Fork 3
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
[MI-2820]: Modified API endpoint to require a project to be provided #144
Changes from 184 commits
85a669a
21c0365
1f0947e
b73575d
b201a3d
0798808
b2dd84f
a46984f
5839e9a
53058ac
1f222ea
e878063
23f45e4
6b9b96e
8963751
76d49bb
731f2ee
32b6a67
4130bbf
bd96af0
b65ea80
1c7ca9a
c800d02
05caef6
6e870e8
d2c2ab9
7ae186e
b92f752
1dd3333
ef552c0
94a6312
da8182e
3431efb
7cee8d6
571882c
aa98b6d
4f41b91
38042f8
c8ba4bf
a456fc7
1d1b3f6
fd3d2d2
d9faef2
140fb59
1071ba6
af30300
f89192d
4e63614
a3cebf2
4e78400
ee378ee
8210205
a83402d
dd22e18
cdc7139
4e21f7e
4c0d702
42ac8b9
297e050
149cdfe
63f9d59
5ff8230
a29189d
8ab794f
c5de718
bdf7685
9ce501b
c2c675c
150560d
e8ff0c2
8d2b0b5
ce42d14
b8cd599
0365479
fcb63fb
43a9aa7
6249638
d025b9d
11cd816
cee0e11
5f5ec2a
aa73c82
fb343ec
a954af9
73ba08e
13727a3
13e7038
e3e3405
ffc4741
b5a01eb
37dc7bd
3c5e676
f5fad8e
768f36f
e185772
c869e67
2a17b7c
8f86195
75e787c
3f930d2
eaa4e67
99f96ca
04e59ba
c2bbe66
cc16221
c6018da
57a8c3d
45659fa
1335ef3
c08f39b
bacb265
1d2b561
89c3596
c286123
2578ff9
419dc0c
07152c0
ff3890f
799e445
25bdae1
9649927
0d477e9
94c71d0
8e179e7
85e2250
464812c
e4c31a8
1141234
da188e2
515d2b5
c58f46c
80779de
17fa4fe
1325681
8100d48
eae16f8
4426ebe
a31f509
4ebdcea
e5f6e26
0054e77
e8791b3
5826f24
b40b787
bcf9df6
b2eb70c
7fd8802
f702d48
74d534a
c344a62
44cddec
2b74225
71f3356
28ff33d
e89a2e6
615b9bc
266579e
1ac30cc
2df3a96
4c6b7e6
abf711e
6112629
9c9c68c
7433d0c
4daf4e0
72424ce
3ab28e7
968391b
84596b6
baaa567
d22a81d
46b191e
61e8f38
18ce68a
8c5b806
1e0fc5f
6d00878
b439dbc
49dad5a
0b1586b
e5950fc
6b20c52
633b076
8af9234
3e5a793
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,6 +413,26 @@ func (p *Plugin) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) | |
return | ||
} | ||
|
||
projectList, err := p.Store.GetAllProjects(mattermostUserID) | ||
if err != nil { | ||
p.API.LogError(constants.ErrorFetchProjectList, "Error", err.Error()) | ||
p.handleError(w, r, &serializers.Error{Code: http.StatusInternalServerError, Message: err.Error()}) | ||
return | ||
} | ||
|
||
organization := pathParams[constants.PathParamOrganization] | ||
project := pathParams[constants.PathParamProject] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could "return early" if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have made |
||
organizationName := strings.ToLower(organization) | ||
projectName := cases.Title(language.Und).String(project) | ||
if _, isProjectLinked := p.IsProjectLinked(projectList, serializers.ProjectDetails{ | ||
OrganizationName: organizationName, | ||
ProjectName: projectName, | ||
}); !isProjectLinked { | ||
p.API.LogWarn(fmt.Sprintf("Project %s is not linked", project)) | ||
p.handleError(w, r, &serializers.Error{Code: http.StatusBadRequest, Message: "requested project is not linked"}) | ||
return | ||
} | ||
|
||
var subscriptionList []*serializers.SubscriptionDetails | ||
var subscriptionErr error | ||
createdBy := r.URL.Query().Get(constants.QueryParamCreatedBy) | ||
|
@@ -432,7 +452,6 @@ func (p *Plugin) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) | |
channelID := r.URL.Query().Get(constants.QueryParamChannelID) | ||
serviceType := r.URL.Query().Get(constants.QueryParamServiceType) | ||
eventType := r.URL.Query().Get(constants.QueryParamEventType) | ||
project := r.URL.Query().Get(constants.QueryParamProject) | ||
if project != "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the intended functionality when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code will reach here only when the Removed this check as it's no longer needed now as we have made it required now |
||
subscriptionByProject := []*serializers.SubscriptionDetails{} | ||
for _, subscription := range subscriptionList { | ||
|
@@ -500,10 +519,8 @@ func (p *Plugin) handleGetSubscriptions(w http.ResponseWriter, r *http.Request) | |
} | ||
} | ||
|
||
subscriptionList = paginatedSubscriptions | ||
p.writeJSON(w, paginatedSubscriptions) | ||
} | ||
|
||
p.writeJSON(w, subscriptionList) | ||
} | ||
|
||
func (p *Plugin) getReviewersListString(reviewersList []serializers.Reviewer) string { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about using
LogWarn
instead here