-
Notifications
You must be signed in to change notification settings - Fork 56
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
Fixing Redirect on Successful License Submission #450
Changes from all commits
cb1c711
9e65600
bab4db8
8a771be
1092f16
7dd8ef3
e541769
fa33d71
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 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -313,7 +313,7 @@ def submit_license(request): | |||||||||||||||||
if 'urlType' in request.POST: | ||||||||||||||||||
# This is present only when executing submit license via tests | ||||||||||||||||||
urlType = request.POST["urlType"] | ||||||||||||||||||
statusCode = createIssue(licenseAuthorName, licenseName, licenseIdentifier, licenseComments, licenseSourceUrls, licenseHeader, licenseOsi, licenseRequestUrl, token, urlType) | ||||||||||||||||||
statusCode, githubIssueId = createIssue(licenseAuthorName, licenseName, licenseIdentifier, licenseComments, licenseSourceUrls, licenseHeader, licenseOsi, licenseRequestUrl, token, urlType) | ||||||||||||||||||
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. E1120: No value for argument 'urlType' in function call ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. 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. @sonatype-lift ignoreall 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 ignoreall command is active on this PR, all the existing Lift issues are ignored. 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. reportGeneralTypeIssues: Argument missing for parameter "urlType" ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
if str(statusCode) == '201': | ||||||||||||||||||
result = "Success! The license request has been successfully submitted." | ||||||||||||||||||
query.result = result | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,12 +352,15 @@ | |
data: form, | ||
success: function (data) { | ||
var githubCode = data.statusCode; | ||
var githubIssueId = data.issueId; | ||
var githubUrl = "https://github.com/spdx/licnse-list-xml/issues/"; | ||
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. Note that there is a typo here resulting in a 404 on redirect: 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. Thanks @whot for pointing out the error, I will crate a PR to solve this |
||
if(githubCode == '201'){ | ||
var successMessage = "The license request has been successfully submitted."; | ||
$("#messages").html('<div class="alert alert-success alert-dismissable fade in"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a><strong>Success! </strong>'+ successMessage +'</div>'); | ||
setTimeout(function() { | ||
$("#messages").html(""); | ||
}, 7000); | ||
setTimeout(function() { | ||
$("#messages").html(""); | ||
}, 7000); | ||
window.open(githubUrl + githubIssueId, "_blank"); | ||
} | ||
else if(githubCode == '409'){ | ||
var matchType = data.matchType; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -352,7 +352,24 @@ def createIssue(licenseAuthorName, licenseName, licenseIdentifier, licenseCommen | |||||||||
headers = {'Authorization': 'token ' + token} | ||||||||||
url = "{0}/issues".format(TYPE_TO_URL_LICENSE[urlType]) | ||||||||||
r = requests.post(url, data=json.dumps(payload), headers=headers) | ||||||||||
return r.status_code | ||||||||||
status_code = r.status_code | ||||||||||
response_json = {} | ||||||||||
issue_id = "" | ||||||||||
|
||||||||||
if status_code in [200, 201]: | ||||||||||
try: | ||||||||||
response_json = r.json() | ||||||||||
except ValueError: | ||||||||||
# Handle JSON parsing error | ||||||||||
return None, None | ||||||||||
|
||||||||||
|
||||||||||
if status_code in [200, 201] and "number" in response_json: | ||||||||||
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. E303: too many blank lines (2) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
issue_id = response_json["number"] | ||||||||||
else: | ||||||||||
issue_id = None | ||||||||||
|
||||||||||
return status_code, issue_id | ||||||||||
|
||||||||||
|
||||||||||
def postToGithub(message, encodedContent, filename): | ||||||||||
|
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.
E501: line too long (200 > 79 characters)
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore
@sonatype-lift ignoreall
@sonatype-lift exclude <file|issue|path|tool>
file|issue|path|tool
from Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.