Skip to content

Commit

Permalink
Add upload button to the issue creation page (refined-github#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo-Silva91 authored and fregante committed Jan 11, 2018
1 parent cac5536 commit b6687be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ function ajaxedPagesHandler() {
});
}

if (pageDetect.isNewIssue()) {
enableFeature(addUploadBtn);
}

if (pageDetect.isIssue() || pageDetect.isPRConversation()) {
enableFeature(addJumpToBottomLink);
}
Expand Down
2 changes: 2 additions & 0 deletions source/libs/page-detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export const isMilestone = () => /^milestone\/\d+/.test(getRepoPath());

export const isMilestoneList = () => /^milestones\/?$/.test(getRepoPath());

export const isNewIssue = () => /^issues\/new/.test(getRepoPath());

export const isNotifications = () => /^([^/]+[/][^/]+\/)?notifications/.test(getCleanPathname());

export const isPR = () => /^pull\/\d+/.test(getRepoPath());
Expand Down
8 changes: 8 additions & 0 deletions test/page-detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ test('isMilestone', urlMatcherMacro, pageDetect.isMilestone, [
'https://github.com/sindresorhus/refined-github/milestones'
]);

test('isNewIssue', urlMatcherMacro, pageDetect.isNewIssue, [
'https://github.com/sindresorhus/refined-github/issues/new'
], [
'http://github.com/sindresorhus/ava',
'https://github.com',
'https://github.com/sindresorhus/refined-github/issues'
]);

test('isNotifications', urlMatcherMacro, pageDetect.isNotifications, [
'https://github.com/notifications',
'https://github.com/notifications/participating',
Expand Down

0 comments on commit b6687be

Please sign in to comment.