Skip to content

Commit

Permalink
Minor refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv committed Jan 19, 2022
1 parent b8c4abd commit 26e2ee9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"yarn.lock": true,
"coverage": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"CODE_OF_CONDUCT.md": true,
"github-schema.graphql": true
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
Expand Down
8 changes: 4 additions & 4 deletions src/services/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ export function getChoicesForCommitPrompt(
if (showDetails) {
const message = stripPullNumber(c.originalMessage);
const prLink = c.pullUrl ? ` ` + getPrLink(c.pullNumber, c.pullUrl) : '';
const detailsList = getDetailedPullStatus(c);
name = `${position}${message}${prLink}${detailsList}`;
const pullStatus = getDetailedPullStatus(c);
name = `${position}${message}${prLink}${pullStatus}`;
} else {
const message = getFirstLine(c.originalMessage);
const pullStates = getSimplePullStatus(c);
name = `${position}${message} ${pullStates}`;
const pullStatus = getSimplePullStatus(c);
name = `${position}${message} ${pullStatus}`;
}

const short = c.pullNumber
Expand Down
19 changes: 7 additions & 12 deletions src/ui/getCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,14 @@ export async function getCommits(options: ValidConfigOptions) {
);
}

if (options.prFilter) {
spinner.text = 'Loading pull requests...';
const commitChoices = await fetchPullRequestBySearchQuery(options);
spinner.stop();
return promptForCommits({
commitChoices,
isMultipleChoice: options.multipleCommits,
showDetails: options.details,
});
}
spinner.text = options.prFilter
? 'Loading pull requests...'
: `Loading commits from branch "${options.sourceBranch}"...`;

const commitChoices = options.prFilter
? await fetchPullRequestBySearchQuery(options)
: await fetchCommitsByAuthor(options);

spinner.text = `Loading commits from branch "${options.sourceBranch}"...`;
const commitChoices = await fetchCommitsByAuthor(options);
spinner.stop();
return promptForCommits({
commitChoices,
Expand Down

0 comments on commit 26e2ee9

Please sign in to comment.