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(commit): view commits #258

Closed
wants to merge 19 commits into from

Conversation

Antoine38660
Copy link
Member

@Antoine38660 Antoine38660 commented Aug 15, 2017

Fix #5

  • create a commit screen
    • have the commiter name clickable (to open a profile)
  • have commits that show in the notifications screen be clickable
  • add number of commits in the repository screen - also clickable
  • have the number of commits when viewing the diff of a pull request be clickable

Copy link
Member

@andrewda andrewda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is great! Just a super minor change from my first pass through.

containerStyle={styles.listItemContainer}
title={commit.message}
titleNumberOfLines={1}
subtitle={commit.sha.substring(0, 7) + ' - ' + commit.author.name || ''} // eslint-disable-line prefer-template
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably may as well use a template here if we have to disable the eslint rule anyways.

@housseindjirdeh
Copy link
Member

This is coming together nicelyyyy, can't wait to have it included 😍

const { navigation, getCommitDetailsByDispatch } = this.props;
const commit = navigation.state.params.commit;

getCommitDetailsByDispatch(commit);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@housseindjirdeh @andrewda I call this getCommitDetailsByDispatch function in the componentDidMount(). But I have the feeling that the isPendingCommit and isPendingDiff are not to false when the render() function is called.... (And I get an error when I try to render the diff).

Do you know why this happen? I'm stuck since few hours :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm so looking through what you have it seems like your actions are changing isPendingCommit and isPendingDiff from true --> false and vice-versa just fine. Have you used logging (redux-logger or reactotron) to make sure the actions were being fired correctly? Also what error message are you seeing?

Will be happy to pull this down tomorrow and see if I can reproduce what you're experiencing 🙌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using reactotron, and the action isn't fired....
The error message is:

undefined is not an object (evaluating commit.commit.message) - commit.screen.js:124

If you try today, you have to find a push event in the EventScreen and tap on master.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found a problem, I have:

props: {
    navigation: Object,
    commit: Object,
    diff: string,
    isPendingCommit: boolean,
    isPendingDiff: boolean,
    getCommitDetailsByDispatch: Function,
    language: string,
};

The diff props is affected as {} instead of '' (empty string)!
It's linked to state.repository.diff(in the mapStateToProps function) which is, initially, an empty string.

My question is now: Why this diff props isn't an empty string at the initialization of my screen?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So sorry for not getting on this sooner to help you with debugging 😞 Will make sure to do it within this week, apologies again mate!

import { ListItem } from 'react-native-elements';
import { colors, fonts } from 'config';

type Props = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should not go here since we're not using @flow. Thoughts @Antoine38660 @housseindjirdeh ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope quite a few components are using flow types :) I think it's definitely nice to have and hopefully we can increase type coverage throughout the app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, we don't have @flow on top...so flow should not be checking anything. Or am I just missing something here?


export const CommitListItem = ({ commit, navigation }: Props) =>
<TouchableHighlight
onPress={() =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this arrow function out of this prop? Maybe you can create a function outside of the component and call it here instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice I'm fine either way honestly, but I do see the benefit of having methods separate 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having an arrow function inside a prop may become a perf issue.


export const getCommitDetails = commit => {
// eslint-disable-next-line no-unused-vars
return (dispatch, getState) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can omit getState here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alejandronanez for your review 😃

@lex111
Copy link
Member

lex111 commented Sep 22, 2017

@Antoine38660 I tried to look, there is an error when clicking on the branch in the event push event:

@Antoine38660
Copy link
Member Author

@lex111 I just tried with your last commit on gitpoint:
simulator screen shot 22 sept 2017 at 14 51 54

And it worked:
simulator screen shot 22 sept 2017 at 14 52 08

Do you remember on which commit you clicked? Maybe it's a non-tested commit content 😄

@lex111
Copy link
Member

lex111 commented Sep 22, 2017

@Antoine38660 I now tried to open commits for two events and I got the same error.

image

And if you open push events not for the GitPoint repository, can this be the case?

@Antoine38660
Copy link
Member Author

Atm my events list is flooded by GitPoint events 😅
I'm now watching Webiny/Webiny so I will test ASAP !

Thanks for reporting this error. Did you tried to view a commits list from a Repo view?

@lex111
Copy link
Member

lex111 commented Sep 22, 2017

A list of commits is displayed:
image

But a detailed commit shows an error:
image

Repo - https://github.com/wikimedia/wikipedia-ios

* 2 new routes and screens => CommitList and Commit (WIP)
* PushEvent are clickable in the EventScreen
* Commit Screen
* Commit diff is now retrieved`and displayed
No more // eslint-disable-next-line no-unused-vars
@lex111
Copy link
Member

lex111 commented Sep 25, 2017

@Antoine38660 I looked at the new changes, commits from the feed screen are opened. If more than one commit was pushed, will the last commit be displayed? Can make mapping commits, like on GitHub?
image

<View style={styles.header}>
<Text>
{translate('repository.commit.byConnector', language, {
contributor: committer,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make a clickable committer? To open a profile.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I add it to the checklist 😃👍

@Antoine38660
Copy link
Member Author

@lex111 If there are more than one commit pushed, you'll be redirected to a "commit list screen" instead of "Commit screen".
I think it's the better way to display it without alter the feed screen : think in case there are more than 2 commits, the feed will be ugly.

@lex111
Copy link
Member

lex111 commented Sep 25, 2017

@lex111 If there are more than one commit pushed, you'll be redirected to a "commit list screen" instead of "Commit screen".

Strange then, I have opened the last commit.

@Antoine38660
Copy link
Member Author

@lex111 you were right, I was doing a bad condition : https://github.com/Antoine38660/git-point/blob/feature/commits/src/auth/screens/events.screen.js#L471 (It was > 2)

I fixed that in my last commit.

Copy link
Member

@housseindjirdeh housseindjirdeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to check in and see if you wanted to get this in as part of the next release? @Antoine38660 If not, no worries at all!

Noticed that I don't see commits list item in the repository screen:

image

Forgive me if this is something that's still being worked on however 🙌

ActivityIndicator,
TouchableHighlight,
} from 'react-native';
import { ListItem, Button } from 'react-native-elements';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I was fixing merge conflicts here and included this Button as part of the conflict fix. Shouldn't be here since we're leveraging @machour's <Button component. My apologies 😞

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Np mate, thanks for the conflict fix 😄

@Antoine38660
Copy link
Member Author

Antoine38660 commented Oct 1, 2017

Looks like some "merge from master" broke my code. I'll update it with a correct rebase, then the commit list item should reappear !

Edit: I really want to merge this one, but recent changes broke some parts of this branch.. Moreover I think it'll not be ready for monday 😞

@housseindjirdeh
Copy link
Member

@Antoine38660 No worries. Apologies are partially my fault, I should have helped you get this off the ground sooner.

But not a problem, we'll be doing more frequent releases after Monday so this shouldn't be out soon after :)

@Antoine38660
Copy link
Member Author

Antoine38660 commented Oct 5, 2017

I hope I fixed all the issues introduced by some refactor of our code during last weeks :)

Can you test and let me know your point of view about this feature (and design)?!
Thanks mates!

@lex111
Copy link
Member

lex111 commented Oct 8, 2017

@Antoine38660

  1. It's strange, for some reason I have a very very long time loading a screen with a commit

image

  1. On the commit screen, the committer and files are not clickable

image

  1. From the commits screen, if you switch to a commit, the commit hash is not displayed

image

@brandly brandly mentioned this pull request Oct 8, 2017
@housseindjirdeh
Copy link
Member

Friendly ping @Antoine38660, just wanted to see if you were stuck or anything at all we can do to help <3

@Antoine38660
Copy link
Member Author

I would like finish once and for all this PR! But I'm facing a lack of time at the moment because of my school courses and school project... I'll be on holidays at the beginning of November so I'll kill this one! 😃
Sorry for the time taken...

Thanks @lex111 for your comment and bugs you found ❤️ ❤️

@housseindjirdeh
Copy link
Member

@Antoine38660 not at all!

I only asked because I was worried if you were just stuck on something. Please take as long as you need my friend. Please don't let this take up your holiday time too :O Holidays are for relaxation time 🌴

Please don't feel rushed to get on this at anytime 🙏

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 30.487% when pulling 94cbfd4 on Antoine38660:feature/commits into 0f7accc on gitpoint:master.

@housseindjirdeh
Copy link
Member

housseindjirdeh commented Mar 27, 2018

One more friendly ping @Antoine38660. Do you think you've added most of the final functionality in your recent commits? If so, I can pull this down, finish off what's left and have this merged in :)

@machour
Copy link
Member

machour commented Apr 23, 2018

@Antoine38660 if it's okay with you, I propose we close this PR as a lot of internals changed since it was opened. We will scavenge the UI bits from this PR.

@Antoine38660
Copy link
Member Author

Yes @machour it's ok and it isn't a problem for me.
@housseindjirdeh sorry I did'nt see your comment... I'm sorry for the project, because a lack of time, I wasn't able to finish this one 😞

@machour
Copy link
Member

machour commented Apr 26, 2018

@Antoine38660 no worries at all dude! Hope you'll find some time during your next summer vacations, there's still sooo much to do 😄

Closing this PR.

@machour machour closed this Apr 26, 2018
chinesedfan added a commit that referenced this pull request Nov 16, 2018
chinesedfan added a commit that referenced this pull request Nov 18, 2018
chinesedfan added a commit that referenced this pull request Dec 1, 2018
* feat(commits): migrate #258 changes

* feat(commits): fix i18n

* fix(issue): fix issue description styles

* feat(commit): Show author and committer, both clickable

* chore(i18n): update translation files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants