Skip to content

Commit 88594b0

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

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;
@@ -659,8 +660,9 @@ export class LaunchpadProvider implements Disposable {
659660
cancellation?: CancellationToken,
660661
): Promise<LaunchpadCategorizedResult> {
661662
const scope = getLogScope();
663+
const isSearching = ((o?: { search?: string }): o is { search: string } => Boolean(o?.search))(options);
662664

663-
const fireRefresh = !options?.search && (options?.force || this._prs == null);
665+
const fireRefresh = !isSearching && (options?.force || this._prs == null);
664666

665667
const ignoredRepositories = new Set(
666668
(configuration.get('launchpad.ignoredRepositories') ?? []).map(r => r.toLowerCase()),
@@ -681,7 +683,7 @@ export class LaunchpadProvider implements Disposable {
681683
const [_, enrichedItemsResult, prsWithCountsResult] = await Promise.allSettled([
682684
this.container.git.isDiscoveringRepositories,
683685
this.getEnrichedItems({ force: options?.force, cancellation: cancellation }),
684-
options?.search
686+
isSearching
685687
? this.getSearchedPullRequests(options.search, cancellation)
686688
: this.getPullRequestsWithSuggestionCounts({ force: options?.force, cancellation: cancellation }),
687689
]);
@@ -815,6 +817,7 @@ export class LaunchpadProvider implements Disposable {
815817
currentViewer: myAccounts.get(item.provider.id)!,
816818
codeSuggestionsCount: codeSuggestionsCount,
817819
isNew: this.isItemNewInGroup(item, actionableCategory),
820+
isSearched: isSearching,
818821
actionableCategory: actionableCategory,
819822
suggestedActions: suggestedActions,
820823
openRepository: openRepository,

0 commit comments

Comments
 (0)