Skip to content

Commit d2361ca

Browse files
committed
Removes Pin and Snooze action buttons from "additional" items
(#3543, #3684)
1 parent af755a9 commit d2361ca

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/plus/launchpad/launchpad.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,12 @@ export class LaunchpadCommand extends QuickCommand<State> {
430430
buttons.push(MergeQuickInputButton);
431431
}
432432

433-
buttons.push(
434-
i.viewer.pinned ? UnpinQuickInputButton : PinQuickInputButton,
435-
i.viewer.snoozed ? UnsnoozeQuickInputButton : SnoozeQuickInputButton,
436-
);
433+
if (!i.isSearched) {
434+
buttons.push(
435+
i.viewer.pinned ? UnpinQuickInputButton : PinQuickInputButton,
436+
i.viewer.snoozed ? UnsnoozeQuickInputButton : SnoozeQuickInputButton,
437+
);
438+
}
437439

438440
buttons.push(...getOpenOnGitProviderQuickInputButtons(i.provider.id));
439441

@@ -752,8 +754,12 @@ export class LaunchpadCommand extends QuickCommand<State> {
752754
state.item.author?.avatarUrl != null ? Uri.parse(state.item.author.avatarUrl) : undefined,
753755
buttons: [
754756
...gitProviderWebButtons,
755-
state.item.viewer.pinned ? UnpinQuickInputButton : PinQuickInputButton,
756-
state.item.viewer.snoozed ? UnsnoozeQuickInputButton : SnoozeQuickInputButton,
757+
...(state.item.isSearched
758+
? []
759+
: [
760+
state.item.viewer.pinned ? UnpinQuickInputButton : PinQuickInputButton,
761+
state.item.viewer.snoozed ? UnsnoozeQuickInputButton : SnoozeQuickInputButton,
762+
]),
757763
],
758764
},
759765
'soft-open',

src/plus/launchpad/launchpadProvider.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export type LaunchpadItem = LaunchpadPullRequest & {
190190
codeSuggestionsCount: number;
191191
codeSuggestions?: TimedResult<Draft[]>;
192192
isNew: boolean;
193+
isSearched: boolean;
193194
actionableCategory: LaunchpadActionCategory;
194195
suggestedActions: LaunchpadAction[];
195196
openRepository?: OpenRepository;
@@ -665,8 +666,9 @@ export class LaunchpadProvider implements Disposable {
665666
cancellation?: CancellationToken,
666667
): Promise<LaunchpadCategorizedResult> {
667668
const scope = getLogScope();
669+
const isSearching = ((o?: { search?: string }): o is { search: string } => Boolean(o?.search))(options);
668670

669-
const fireRefresh = !options?.search && (options?.force || this._prs == null);
671+
const fireRefresh = !isSearching && (options?.force || this._prs == null);
670672

671673
const ignoredRepositories = new Set(
672674
(configuration.get('launchpad.ignoredRepositories') ?? []).map(r => r.toLowerCase()),
@@ -687,7 +689,7 @@ export class LaunchpadProvider implements Disposable {
687689
const [_, enrichedItemsResult, prsWithCountsResult] = await Promise.allSettled([
688690
this.container.git.isDiscoveringRepositories,
689691
this.getEnrichedItems({ force: options?.force, cancellation: cancellation }),
690-
options?.search
692+
isSearching
691693
? this.getSearchedPullRequests(options.search, cancellation)
692694
: this.getPullRequestsWithSuggestionCounts({ force: options?.force, cancellation: cancellation }),
693695
]);
@@ -821,6 +823,7 @@ export class LaunchpadProvider implements Disposable {
821823
currentViewer: myAccounts.get(item.provider.id)!,
822824
codeSuggestionsCount: codeSuggestionsCount,
823825
isNew: this.isItemNewInGroup(item, actionableCategory),
826+
isSearched: isSearching,
824827
actionableCategory: actionableCategory,
825828
suggestedActions: suggestedActions,
826829
openRepository: openRepository,

0 commit comments

Comments
 (0)