mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-20 16:11:46 +03:00
Ensure searches on PRs also includes the branch name
This commit is contained in:
parent
4570a82256
commit
8f0c695465
@ -85,6 +85,19 @@ export class CombinedBranch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get searchableIdentifiers() {
|
||||||
|
const identifiers = [];
|
||||||
|
|
||||||
|
if (this.vbranch) identifiers.push(this.vbranch.name);
|
||||||
|
if (this.pr) {
|
||||||
|
identifiers.push(this.pr.title);
|
||||||
|
identifiers.push(this.pr.targetBranch);
|
||||||
|
}
|
||||||
|
if (this.remoteBranch) identifiers.push(this.remoteBranch.displayName);
|
||||||
|
|
||||||
|
return identifiers.map((identifier) => identifier.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
currentState(): BranchState | undefined {
|
currentState(): BranchState | undefined {
|
||||||
if (this.vbranch) return BranchState.VirtualBranch;
|
if (this.vbranch) return BranchState.VirtualBranch;
|
||||||
if (this.pr) return BranchState.PR;
|
if (this.pr) return BranchState.PR;
|
||||||
|
@ -91,7 +91,16 @@
|
|||||||
|
|
||||||
function filterByText(branches: CombinedBranch[], search: string | undefined) {
|
function filterByText(branches: CombinedBranch[], search: string | undefined) {
|
||||||
if (search == undefined) return branches;
|
if (search == undefined) return branches;
|
||||||
return branches.filter((b) => b.displayName.includes(search));
|
|
||||||
|
return branches.filter((b) => searchMatchesAnIdentifier(search, b.searchableIdentifiers));
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchMatchesAnIdentifier(search: string, identifiers: string[]) {
|
||||||
|
for (const identifier of identifiers) {
|
||||||
|
if (identifier.includes(search.toLowerCase())) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterInactive(branches: CombinedBranch[]) {
|
function filterInactive(branches: CombinedBranch[]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user