Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/features/bugs-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as pageDetect from 'github-url-detection';

import features from '.';
import * as api from '../github-helpers/api';
import SearchQuery from '../github-helpers/search-query';
import {getRepo} from '../github-helpers';
import SearchQuery from '../github-helpers/search-query';

const numberFormatter = new Intl.NumberFormat();
const countBugs = cache.function(async (): Promise<number> => {
Expand Down
8 changes: 6 additions & 2 deletions source/github-helpers/search-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,20 @@ export default class SearchQuery {
return currentQuery;
}

if (!this.link) {
return '';
}

// Query-less URLs imply some queries.
// When we explicitly set ?q=* they're overridden, so they need to be manually added again.
const queries = [];

// Repo example: is:issue is:open
queries.push(/\/pulls\/?$/.test(this.link!.pathname) ? 'is:pr' : 'is:issue');
queries.push(/\/pulls\/?$/.test(this.link.pathname) ? 'is:pr' : 'is:issue');
queries.push('is:open');

// Header nav example: is:open is:issue author:you archived:false
if (this.link!.pathname === '/issues' || this.link!.pathname === '/pulls') {
if (this.link.pathname === '/issues' || this.link.pathname === '/pulls') {
if (this.searchParams.has('user')) { // #1211
queries.push(`user:${this.searchParams.get('user')!}`);
} else {
Expand Down