Skip to content

Commit 7802d36

Browse files
authored
Merge branch 'master' into tests
2 parents 6946228 + dd14bcd commit 7802d36

23 files changed

+385
-280
lines changed

.all-contributorsrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@
182182
"contributions": [
183183
"code"
184184
]
185+
},
186+
{
187+
"login": "RogerAbyss",
188+
"name": "Chao Ren",
189+
"avatar_url": "https://avatars1.githubusercontent.com/u/8122587?v=4",
190+
"profile": "https://github.com/RogerAbyss",
191+
"contributions": [
192+
"bug",
193+
"code"
194+
]
185195
}
186196
]
187197
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# GitPoint
1717

1818
[![Build Status](https://img.shields.io/travis/gitpoint/git-point.svg?style=flat-square)](https://travis-ci.org/gitpoint/git-point)
19-
[![All Contributors](https://img.shields.io/badge/all_contributors-18-orange.svg?style=flat-square)](#contributors)
19+
[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors)
2020
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
2121
[![Gitter chat](https://img.shields.io/badge/chat-on_gitter-008080.svg?style=flat-square)](https://gitter.im/git-point)
2222

@@ -69,5 +69,5 @@ Please take a look at the [contributing guidelines](./CONTRIBUTING.md) for a det
6969
| [<img src="https://avatars0.githubusercontent.com/u/12476932?v=3" width="100px;"/><br /><sub>Houssein Djirdeh</sub>](https://houssein.me)<br />[💬](#question-housseindjirdeh "Answering Questions") [💻](https://github.com/gitpoint/git-point/commits?author=housseindjirdeh "Code") [🎨](#design-housseindjirdeh "Design") [📖](https://github.com/gitpoint/git-point/commits?author=housseindjirdeh "Documentation") [👀](#review-housseindjirdeh "Reviewed Pull Requests") | [<img src="https://avatars2.githubusercontent.com/u/16705071?v=3" width="100px;"/><br /><sub>gejose</sub>](https://github.com/gejose)<br />[💻](https://github.com/gitpoint/git-point/commits?author=gejose "Code") | [<img src="https://avatars3.githubusercontent.com/u/14151327?v=3" width="100px;"/><br /><sub>rmevans9</sub>](https://github.com/rmevans9)<br />[💻](https://github.com/gitpoint/git-point/commits?author=rmevans9 "Code") | [<img src="https://avatars1.githubusercontent.com/u/4408379?v=3" width="100px;"/><br /><sub>Alexey Pyltsyn</sub>](http://lex111.ru)<br />[💻](https://github.com/gitpoint/git-point/commits?author=lex111 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Alex111 "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/10660468?v=3" width="100px;"/><br /><sub>Jason Etcovitch</sub>](https://jasonet.co)<br />[💻](https://github.com/gitpoint/git-point/commits?author=JasonEtco "Code") | [<img src="https://avatars1.githubusercontent.com/u/1166143?v=3" width="100px;"/><br /><sub>Hosmel Quintana</sub>](http://hosmelq.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=hosmelq "Code") | [<img src="https://avatars0.githubusercontent.com/u/464978?v=3" width="100px;"/><br /><sub>Alejandro Ñáñez Ortiz</sub>](http://co.linkedin.com/in/alejandronanez/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=alejandronanez "Code") [👀](#review-alejandronanez "Reviewed Pull Requests") |
7070
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
7171
| [<img src="https://avatars3.githubusercontent.com/u/3055294?v=3" width="100px;"/><br /><sub>Patrick Wang</sub>](https://patw.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=patw0929 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Apatw0929 "Bug reports") | [<img src="https://avatars5.githubusercontent.com/u/627794?v=4" width="100px;"/><br /><sub>Mike Kavouras</sub>](https://github.com/mikekavouras)<br />[💻](https://github.com/gitpoint/git-point/commits?author=mikekavouras "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Amikekavouras "Bug reports") | [<img src="https://avatars4.githubusercontent.com/u/4848554?v=4" width="100px;"/><br /><sub>Peter Lazar</sub>](https://github.com/peterlazar1993)<br />[💻](https://github.com/gitpoint/git-point/commits?author=peterlazar1993 "Code") | [<img src="https://avatars6.githubusercontent.com/u/5106887?v=4" width="100px;"/><br /><sub>June Domingo</sub>](https://github.com/junedomingo)<br />[💻](https://github.com/gitpoint/git-point/commits?author=junedomingo "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Ajunedomingo "Bug reports") | [<img src="https://avatars7.githubusercontent.com/u/9287184?v=4" width="100px;"/><br /><sub>Antoine</sub>](http://www.jaaccelere.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antoine38660 "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3AAntoine38660 "Bug reports") | [<img src="https://avatars6.githubusercontent.com/u/13142418?v=4" width="100px;"/><br /><sub>Wang Shidong</sub>](https://wsdjeg.github.io)<br />[💻](https://github.com/gitpoint/git-point/commits?author=wsdjeg "Code") | [<img src="https://avatars4.githubusercontent.com/u/2190589?v=4" width="100px;"/><br /><sub>Swapnil Joshi</sub>](http://swapnilmj.users.sourceforge.net/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=swapnilmj "Code") |
72-
| [<img src="https://avatars5.githubusercontent.com/u/408959?v=4" width="100px;"/><br /><sub>Rolf Koenders</sub>](https://github.com/RolfKoenders)<br />[💻](https://github.com/gitpoint/git-point/commits?author=RolfKoenders "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARolfKoenders "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/10191084?v=4" width="100px;"/><br /><sub>Andrew Dassonville</sub>](https://andrewda.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=andrewda "Code") [💬](#question-andrewda "Answering Questions") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/2076088?v=4" width="100px;"/><br /><sub>Anton</sub>](https://medium.com/@antondomashnev)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antondomashnev "Code") | [<img src="https://avatars0.githubusercontent.com/u/14795799?v=4" width="100px;"/><br /><sub>Xuezheng Ma</sub>](https://github.com/xuezhma)<br />[💻](https://github.com/gitpoint/git-point/commits?author=xuezhma "Code") |
72+
| [<img src="https://avatars5.githubusercontent.com/u/408959?v=4" width="100px;"/><br /><sub>Rolf Koenders</sub>](https://github.com/RolfKoenders)<br />[💻](https://github.com/gitpoint/git-point/commits?author=RolfKoenders "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARolfKoenders "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/10191084?v=4" width="100px;"/><br /><sub>Andrew Dassonville</sub>](https://andrewda.me)<br />[💻](https://github.com/gitpoint/git-point/commits?author=andrewda "Code") [💬](#question-andrewda "Answering Questions") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [<img src="https://avatars0.githubusercontent.com/u/2076088?v=4" width="100px;"/><br /><sub>Anton</sub>](https://medium.com/@antondomashnev)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Antondomashnev "Code") | [<img src="https://avatars0.githubusercontent.com/u/14795799?v=4" width="100px;"/><br /><sub>Xuezheng Ma</sub>](https://github.com/xuezhma)<br />[💻](https://github.com/gitpoint/git-point/commits?author=xuezhma "Code") | [<img src="https://avatars1.githubusercontent.com/u/8122587?v=4" width="100px;"/><br /><sub>Chao Ren</sub>](https://github.com/RogerAbyss)<br />[🐛](https://github.com/gitpoint/git-point/issues?q=author%3ARogerAbyss "Bug reports") [💻](https://github.com/gitpoint/git-point/commits?author=RogerAbyss "Code") |
7373
<!-- ALL-CONTRIBUTORS-LIST:END -->

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"lint-pass"
4343
],
4444
"dependencies": {
45+
"fuzzy-search": "^1.4.0",
4546
"lodash.uniqby": "^4.7.0",
4647
"lowlight": "^1.5.0",
4748
"md5": "^2.2.1",

src/auth/screens/events.screen.js

Lines changed: 48 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Events extends Component {
132132
case 'IssuesEvent':
133133
return `${userEvent.payload.action} issue`;
134134
case 'MemberEvent':
135-
return `${userEvent.payload.action} user`;
135+
return `${userEvent.payload.action}`;
136136
case 'PublicEvent':
137137
return 'open sourced';
138138
case 'PullRequestEvent':
@@ -181,15 +181,7 @@ class Events extends Component {
181181
return (
182182
<Text
183183
style={styles.linkDescription}
184-
onPress={() =>
185-
this.props.navigation.navigate('Repository', {
186-
repository: {
187-
...userEvent.repo,
188-
name: userEvent.repo.name.substring(
189-
userEvent.repo.name.indexOf('/') + 1
190-
),
191-
},
192-
})}
184+
onPress={() => this.navigateToRepository(userEvent)}
193185
>
194186
{userEvent.repo.name}
195187
</Text>
@@ -205,18 +197,12 @@ class Events extends Component {
205197
</Text>
206198
); // can only be branch or tag
207199
case 'ForkEvent':
200+
case 'WatchEvent':
201+
case 'PublicEvent':
208202
return (
209203
<Text
210204
style={styles.linkDescription}
211-
onPress={() =>
212-
this.props.navigation.navigate('Repository', {
213-
repository: {
214-
...userEvent.repo,
215-
name: userEvent.repo.name.substring(
216-
userEvent.repo.name.indexOf('/') + 1
217-
),
218-
},
219-
})}
205+
onPress={() => this.navigateToRepository(userEvent)}
220206
>
221207
{userEvent.repo.name}
222208
</Text>
@@ -227,41 +213,19 @@ class Events extends Component {
227213
the{' '}
228214
<Text
229215
style={styles.linkDescription}
230-
onPress={() =>
231-
this.props.navigation.navigate('Repository', {
232-
repository: {
233-
...userEvent.repo,
234-
name: userEvent.repo.name.substring(
235-
userEvent.repo.name.indexOf('/') + 1
236-
),
237-
},
238-
})}
216+
onPress={() => this.navigateToRepository(userEvent)}
239217
>
240218
{userEvent.repo.name}
241219
</Text>{' '}
242220
wiki
243221
</Text>
244222
);
245223
case 'IssueCommentEvent':
246-
return (
247-
<Text
248-
style={styles.linkDescription}
249-
onPress={() =>
250-
this.props.navigation.navigate('Issue', {
251-
issue: userEvent.payload.issue,
252-
})}
253-
>
254-
{userEvent.payload.issue.title}
255-
</Text>
256-
);
257224
case 'IssuesEvent':
258225
return (
259226
<Text
227+
onPress={() => this.navigateToIssue(userEvent)}
260228
style={styles.linkDescription}
261-
onPress={() =>
262-
this.props.navigation.navigate('Issue', {
263-
issue: userEvent.payload.issue,
264-
})}
265229
>
266230
{userEvent.payload.issue.title}
267231
</Text>
@@ -270,43 +234,13 @@ class Events extends Component {
270234
return (
271235
<Text
272236
style={styles.linkDescription}
273-
onPress={() =>
274-
this.props.navigation.navigate('Profile', {
275-
user: userEvent.payload.member,
276-
})}
237+
onPress={() => this.navigateToProfile(userEvent)}
277238
>
278239
{userEvent.payload.member.login}
279240
</Text>
280241
);
281-
case 'PublicEvent':
282-
return (
283-
<Text
284-
style={styles.linkDescription}
285-
onPress={() =>
286-
this.props.navigation.navigate('Repository', {
287-
repository: {
288-
...userEvent.repo,
289-
name: userEvent.repo.name.substring(
290-
userEvent.repo.name.indexOf('/') + 1
291-
),
292-
},
293-
})}
294-
>
295-
{userEvent.repo.name}
296-
</Text>
297-
);
298242
case 'PullRequestEvent':
299-
return (
300-
<Text style={styles.linkDescription}>
301-
{userEvent.payload.pull_request.title}
302-
</Text>
303-
);
304243
case 'PullRequestReviewEvent':
305-
return (
306-
<Text style={styles.linkDescription}>
307-
{userEvent.payload.pull_request.title}
308-
</Text>
309-
);
310244
case 'PullRequestReviewCommentEvent':
311245
return (
312246
<Text style={styles.linkDescription}>
@@ -327,37 +261,13 @@ class Events extends Component {
327261
style={styles.linkDescription}
328262
onPress={() => {
329263
if (userEvent.action !== 'deleted') {
330-
this.props.navigation.navigate('Repository', {
331-
repository: {
332-
...userEvent.repo,
333-
name: userEvent.repo.name.substring(
334-
userEvent.repo.name.indexOf('/') + 1
335-
),
336-
},
337-
});
264+
this.navigateToRepository(userEvent);
338265
}
339266
}}
340267
>
341268
{userEvent.repo.name}
342269
</Text>
343270
);
344-
case 'WatchEvent':
345-
return (
346-
<Text
347-
style={styles.linkDescription}
348-
onPress={() =>
349-
this.props.navigation.navigate('Repository', {
350-
repository: {
351-
...userEvent.repo,
352-
name: userEvent.repo.name.substring(
353-
userEvent.repo.name.indexOf('/') + 1
354-
),
355-
},
356-
})}
357-
>
358-
{userEvent.repo.name}
359-
</Text>
360-
);
361271
default:
362272
return null;
363273
}
@@ -377,15 +287,15 @@ class Events extends Component {
377287

378288
return null;
379289
}
380-
case 'DeleteEvent':
381-
return 'at';
382290
case 'ForkEvent':
291+
case 'MemberEvent':
383292
return 'to';
293+
case 'DeleteEvent':
384294
case 'IssueCommentEvent':
385-
return 'at';
386295
case 'IssuesEvent':
387-
return 'at';
388296
case 'PushEvent':
297+
case 'PullRequestEvent':
298+
case 'PullRequestReviewCommentEvent':
389299
return 'at';
390300
default:
391301
return null;
@@ -404,15 +314,7 @@ class Events extends Component {
404314
return (
405315
<Text
406316
style={styles.linkDescription}
407-
onPress={() =>
408-
this.props.navigation.navigate('Repository', {
409-
repository: {
410-
...userEvent.repo,
411-
name: userEvent.repo.name.substring(
412-
userEvent.repo.name.indexOf('/') + 1
413-
),
414-
},
415-
})}
317+
onPress={() => this.navigateToRepository(userEvent)}
416318
>
417319
{userEvent.repo.name}
418320
</Text>
@@ -422,86 +324,29 @@ class Events extends Component {
422324
return null;
423325
}
424326
case 'DeleteEvent':
425-
return (
426-
<Text
427-
style={styles.linkDescription}
428-
onPress={() =>
429-
this.props.navigation.navigate('Repository', {
430-
repository: {
431-
...userEvent.repo,
432-
name: userEvent.repo.name.substring(
433-
userEvent.repo.name.indexOf('/') + 1
434-
),
435-
},
436-
})}
437-
>
438-
{userEvent.repo.name}
439-
</Text>
440-
);
441-
case 'ForkEvent':
442-
return (
443-
<Text
444-
style={styles.linkDescription}
445-
onPress={() =>
446-
this.props.navigation.navigate('Repository', {
447-
repository: userEvent.payload.forkee,
448-
})}
449-
>
450-
{userEvent.payload.forkee.full_name}
451-
</Text>
452-
);
453327
case 'IssueCommentEvent':
454-
return (
455-
<Text
456-
style={styles.linkDescription}
457-
onPress={() =>
458-
this.props.navigation.navigate('Repository', {
459-
repository: {
460-
...userEvent.repo,
461-
name: userEvent.repo.name.substring(
462-
userEvent.repo.name.indexOf('/') + 1
463-
),
464-
},
465-
})}
466-
>
467-
{userEvent.repo.name}
468-
</Text>
469-
);
470328
case 'IssuesEvent':
329+
case 'PushEvent':
330+
case 'PullRequestEvent':
331+
case 'MemberEvent':
332+
case 'PullRequestReviewCommentEvent':
471333
return (
472334
<Text
473335
style={styles.linkDescription}
474-
onPress={() =>
475-
this.props.navigation.navigate('Repository', {
476-
repository: {
477-
...userEvent.repo,
478-
name: userEvent.repo.name.substring(
479-
userEvent.repo.name.indexOf('/') + 1
480-
),
481-
},
482-
})}
336+
onPress={() => this.navigateToRepository(userEvent)}
483337
>
484338
{userEvent.repo.name}
485339
</Text>
486340
);
487-
case 'PushEvent':
341+
case 'ForkEvent':
488342
return (
489343
<Text
490344
style={styles.linkDescription}
491-
onPress={() =>
492-
this.props.navigation.navigate('Repository', {
493-
repository: {
494-
...userEvent.repo,
495-
name: userEvent.repo.name.substring(
496-
userEvent.repo.name.indexOf('/') + 1
497-
),
498-
},
499-
})}
345+
onPress={() => this.navigateToRepository(userEvent, true)}
500346
>
501-
{userEvent.repo.name}
347+
{userEvent.payload.forkee.full_name}
502348
</Text>
503349
);
504-
505350
default:
506351
return null;
507352
}
@@ -554,6 +399,31 @@ class Events extends Component {
554399
}
555400
};
556401

402+
navigateToRepository = (userEvent, isForkEvent) => {
403+
this.props.navigation.navigate('Repository', {
404+
repository: !isForkEvent
405+
? {
406+
...userEvent.repo,
407+
name: userEvent.repo.name.substring(
408+
userEvent.repo.name.indexOf('/') + 1
409+
),
410+
}
411+
: userEvent.payload.forkee,
412+
});
413+
}
414+
415+
navigateToIssue = userEvent => {
416+
this.props.navigation.navigate('Issue', {
417+
issue: userEvent.payload.issue,
418+
});
419+
}
420+
421+
navigateToProfile = userEvent => {
422+
this.props.navigation.navigate('Profile', {
423+
user: userEvent.payload.member,
424+
});
425+
}
426+
557427
keyExtractor = item => {
558428
return item.id;
559429
};
@@ -563,10 +433,7 @@ class Events extends Component {
563433
<Text style={styles.descriptionContainer}>
564434
<Text
565435
style={styles.linkDescription}
566-
onPress={() =>
567-
this.props.navigation.navigate('Profile', {
568-
user: userEvent.actor,
569-
})}
436+
onPress={() => this.navigateToProfile(userEvent)}
570437
>
571438
{userEvent.actor.login}{' '}
572439
</Text>

0 commit comments

Comments
 (0)