Skip to content

Commit

Permalink
Merge pull request #90 from atlassian/main
Browse files Browse the repository at this point in the history
[pull] main from atlassian:main
  • Loading branch information
ammar-ahmed-butt authored Oct 13, 2023
2 parents 28b5c22 + 3a9f122 commit 7266ee3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/transforms/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const processPush = async (github: GitHubInstallationClient, payload: Pus
const message = commitResponse.data.commit?.message;

// Jira only accepts a max of 10 files for each commit, so don't send all of them
const filesToSend = files.slice(0, 10) as GithubCommitFile[];
const filesToSend = Array.isArray(files) ? files.slice(0, 10) as GithubCommitFile[] : [];

// merge commits will have 2 or more parents, depending on how many are in the sequence
const isMergeCommit = parents?.length > 1;
Expand All @@ -165,12 +165,12 @@ export const processPush = async (github: GitHubInstallationClient, payload: Pus
hash: commitSha,
message: limitCommitMessage(message),
author: getJiraAuthor(author, githubCommitAuthor),
authorTimestamp: githubCommitAuthor.date,
authorTimestamp: githubCommitAuthor?.date,
displayId: commitSha.substring(0, 6),
fileCount: files.length, // Send the total count for all files
files: compact(filesToSend.map((file) => mapFile(file, repo, sha.id, owner.name))),
id: commitSha,
issueKeys: sha.issueKeys,
issueKeys: sha?.issueKeys || [],
url: html_url,
updateSequenceId: Date.now(),
flags: isMergeCommit ? ["MERGE_COMMIT"] : undefined
Expand All @@ -186,7 +186,7 @@ export const processPush = async (github: GitHubInstallationClient, payload: Pus
// break the array up into chunks of 400
const chunks: JiraCommit[][] = [];

while (commits.length) {
while (commits?.length) {
chunks.push(commits.splice(0, 400));
}

Expand Down
6 changes: 3 additions & 3 deletions views/jira-configuration.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
<span class="jiraConfiguration__table__cell__settings__headerItem">Application</span>
</h6>
<aui-section class="jiraConfiguration__table__cell__settings__dropdownItems">
<input type="hidden" id="_csrf" name="_csrf" value="{{../csrfToken}}">
<input type="hidden" id="_csrf" name="_csrf" value="{{../../csrfToken}}">
<div class="jiraConfiguration__table__cell__gitHubAppItem">
<button
class="jiraConfiguration__editGitHubApp"
Expand Down Expand Up @@ -267,12 +267,12 @@
hideAvatar=true
elementIdPrefix="gheServer-"
html_url=html_url
csrfToken=csrfToken
csrfToken=../../csrfToken
gitHubAppId=app.id
successfulConnections=app.successfulConnections
failedConnections=app.failedConnections
gitHubAppId=app.id
enableRepoConnectedPage=enableRepoConnectedPage
enableRepoConnectedPage=../../enableRepoConnectedPage
}}
{{else}}
<div class="jiraConfiguration__collapsibleBody">
Expand Down
2 changes: 1 addition & 1 deletion views/partials/jira-configuration-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
host=host
html_url=html_url
syncErrors=connection.failedSyncErrors
csrfToken=csrfToken
csrfToken=../csrfToken
}}

{{/each}}
Expand Down

0 comments on commit 7266ee3

Please sign in to comment.