X Tutup
The Wayback Machine - https://web.archive.org/web/20201218002131/https://github.com/gitpoint/git-point/pull/802
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: clicking entity location searches for github users matching that location #802

Open
wants to merge 6 commits into
base: master
from

Conversation

@JSweet314
Copy link

@JSweet314 JSweet314 commented May 10, 2018

Question Response
Version? v1.4.1
Devices tested? iPhone 6/7, Samsung S8
Bug fix? yes/no
New feature? yes/no
Includes tests? yes/no
All Tests pass? yes/no
Related ticket? #640

Screenshots

Before After
before after

Description

Per the suggested solution, we changed the functionality of clicking on an entity's location to navigate to the search screen and initiate a search for users corresponding to the entity's location. This eliminates the need for the Communications.web method to direct the user outside of the application to google maps (deemed not very useful/interesting). Subsequently, we pass down the search query to the search screen from the navigation object's params to display the search term to the user in the RNSearchBar and MNSearchBar components. Rather than TabNavigator, an additional shared StackNavigator route was needed in order to allow for the passing of the params (upgrading the React-Navigation dependency to the current version would eliminate this need, however, that refactor would fall well outside the scope of this issue). You will note the new shared route titled 'SearchUsersByLocation' in the routes.js file. Navigating to this feature in this way also gives the user the added benefit of having a back arrow to return to the entity from which the location was derived.

JSweet314 and others added 6 commits May 8, 2018
Add shared route for SearchUsersByLocations
Add componentDidMount to Search.
Add setQueryAsLocation method to test params and search for users by location.
Remove tests referencing web communication to google maps now that
clicking location takes user to search screen rather than out of the app.
Add location to the search bar in ios and android, to show text of the location
Feature/SeeUsersByLocation
Add contributors
@coveralls
Copy link

@coveralls coveralls commented May 10, 2018

Coverage Status

Coverage decreased (-0.1%) to 41.951% when pulling 62107ef on JSweet314:master into fefccb5 on gitpoint:master.

Copy link
Member

@chinesedfan chinesedfan left a comment

Good teamwork! Left some comments for you. Feel free to tell me if you have different opinions.

@@ -206,6 +206,12 @@ const sharedRoutes = {
title: navigation.state.params.title,
}),
},
SearchUsersByLocation: {

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

In order to share this screen for other places, I suggest to define it as Search and replace the one in SearchStackNavigator with MainSearch.

@@ -96,7 +97,7 @@ export const EntityInfo = ({ entity, orgs, locale, navigation }: Props) => {
type: 'octicon',
}}
subtitle={entity.location}
onPress={() => Communications.web(getLocationLink(entity.location))}
onPress={() => getUsersByLocation(entity.location, navigation)}

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

Let's write the implementation here directly. getUsersByLocation sounds like returning users but it is not.


if (params) {
this.switchQueryType(1);
this.search(`location:${params.location}`, 1);

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

Please use SearchTypes.USERS, instead of 1. And you'd better check params && params.location.


if (params) {
if (params.location) {
isLocation = `location:${params.location}`;

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

isLocation usually means a boolean. How about naming it as searchText? And we can check in only one if statement, if (params && params.location).

/ /g,
'+'
)}`
);

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

Try to test your new press action. Mock navigation.navigate and check whether it is called with right arguments.

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip

This comment has been minimized.

@chinesedfan

chinesedfan May 11, 2018
Member

Is it really needed? If not, please do not commit, as well as several files like Cound/Failed/project.pbxproj.

@chinesedfan
Copy link
Member

@chinesedfan chinesedfan commented May 11, 2018

upgrading the React-Navigation dependency to the current version would eliminate this need, however, that refactor would fall well outside the scope of this issue

By the way, if it didn't introduce too much changes, maybe you can upgrading the dependency.

Copy link
Member

@machour machour left a comment

Hi @JSweet314! Thank you and other contributors for this PR 🎉

Aside from what @chinesedfan already said, I left you a comment to further explain a little problem.

Also, I'm noticing two new empty files "Could" and "Failed" which shouldn't have been included in this PR. (joys of bash scripting, heh)

Don't hesitate to reach us on gitter if you need any help at all!

setQueryAsLocation = () => {
const { params } = this.props.navigation.state;

if (params) {

This comment has been minimized.

@machour

machour May 14, 2018
Member

We are already using navigation state in this screen to store/retrieve the searched keyword (see line 38 for example).
Here, it seems that as soon as there's a parameter, you assume that it's related to location, which seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.
X Tutup