Merge pull request #14979 from padulam/feature/bug-modal-issue-link

Updates create issue button in bug modal to direct user to forum
This commit is contained in:
Berkeley Martinez
2017-06-21 15:43:40 -07:00
committed by GitHub
2 changed files with 37 additions and 26 deletions

View File

@ -68,7 +68,7 @@ export class BugModal extends PureComponent {
bsStyle='primary' bsStyle='primary'
onClick={ createIssue } onClick={ createIssue }
> >
Create my GitHub issue Create topic for issue in community forum
</Button> </Button>
<Button <Button
block={ true } block={ true }

View File

@ -31,7 +31,7 @@ export default function bugSaga(actions$, getState, { window }) {
.map(({ type }) => { .map(({ type }) => {
const { const {
challengesApp: { challengesApp: {
challenge: challengeName, legacyKey: challengeName,
files files
} }
} = getState(); } = getState();
@ -39,34 +39,45 @@ export default function bugSaga(actions$, getState, { window }) {
navigator: { userAgent }, navigator: { userAgent },
location: { href } location: { href }
} = window; } = window;
let titleText = challengeName;
if (type === types.openIssueSearch) { if (type === types.openIssueSearch) {
window.open( window.open(
'https://github.com/freeCodeCamp/freeCodeCamp/issues?q=' + 'https://forum.freecodecamp.com/search?q=' +
'is:issue is:all ' + window.encodeURIComponent(titleText)
challengeName
); );
} } else {
titleText = 'Need assistance in ' + challengeName;
let textMessage = [ let textMessage = [
'Challenge [', '#### Challenge Name\n',
'[',
challengeName, challengeName,
'](', '](',
href, href,
') has an issue.\n', ') has an issue.\n',
'#### Issue Description\n',
'<!-- Describe below when the issue happens and how to ',
'reproduce it -->\n\n\n',
'#### Browser Information\n',
'<!-- Describe your workspace in which you are having issues-->\n',
'User Agent is: <code>', 'User Agent is: <code>',
userAgent, userAgent,
'</code>.\n', '</code>.\n\n',
'Please describe how to reproduce this issue, and include ', '#### Screenshot\n',
'links to screenshots if possible.\n\n' '<!-- Add a screenshot of your issue -->\n\n\n',
'#### Your Code'
].join(''); ].join('');
const body = filesToMarkdown(files); const body = filesToMarkdown(files);
if (body.length > 10) { if (body.length > 10) {
textMessage = textMessage + body; textMessage = textMessage + body;
} }
window.open( window.open(
'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' + 'https://forum.freecodecamp.com/new-topic?category=General&title=' +
window.encodeURIComponent(titleText) + '&body=' +
window.encodeURIComponent(textMessage), window.encodeURIComponent(textMessage),
'_blank' '_blank'
); );
}
return closeBugModal(); return closeBugModal();
}); });
} }