-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
Profile tab and UI for setting away status #3267
Conversation
bb2c4cc
to
53b80c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @borisyankov !
I just merged one of these commits, as 6ac0bf2.
Some comments below on the other changes. One meta-comment:
- The urgent part is to have some way of setting the away status, as well as to consume it.
- This PR looks like it's going in a direction that may involve a more complicated restructuring of a part of our UI and navigation.
- I worry that the more complex restructuring may not get to something we can merge this week. I'd recommend focusing on the parts that are required for a v1 of away status, keeping that as simple as possible, and getting it to the point it can be merged.
src/users/userSelectors.js
Outdated
getAllUsersByEmail, | ||
getOwnEmail, | ||
(usersByEmail, ownEmail) => usersByEmail[ownEmail], | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those selectors that we get no material benefit from caching, because its body does so little work (in fact it's probably more work to check and maintain the cache than to just execute the body). So I'd much rather simplify by leaving out createSelector
:
export const getOwnUser = (state: GlobalState): User =>
getAllUsersByEmail(state)[getOwnEmail(state)];
src/users/userSelectors.js
Outdated
@@ -54,6 +54,12 @@ export const getUsersSansMe: Selector<User[]> = createSelector( | |||
(users, ownEmail) => users.filter(user => user.email !== ownEmail), | |||
); | |||
|
|||
export const getOwnUser: Selector<User[]> = createSelector( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type is bogus -- this returns a User
, not a User[]
.
Note that Flow says the body of this selector is uncovered, which is why that was possible. You can fix that by putting an appropriate type on getAllUsersByEmail
.
src/account-info/OwnAccountCard.js
Outdated
@@ -0,0 +1,44 @@ | |||
/* @flow */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All new files should be strict-local
. (In the absence of a good reason otherwise... but I think that will almost always end up as a reason to put something like a $FlowFixMe
in a specific place. With a comment saying why, as always for fixmes.)
In this case, adding that marking causes Flow to point out the props: Object
.
src/account-info/UserStatusCard.js
Outdated
handleSetUserStatus = () => { | ||
const { dispatch } = this.props; | ||
dispatch(tryStopNotifications()); | ||
dispatch(logout()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to assume this is one of the WIP areas. 😉
642e115
to
ca5104c
Compare
ca5104c
to
bd07e62
Compare
And #3263 is merged! |
a33880d
to
cfe6cb4
Compare
The first 5 commits are ready for review (one is the same as the other PR) |
32659b3
to
226c6db
Compare
226c6db
to
bcce5c8
Compare
A component very similar to the existing `Avatar`. It is simpler and differs in these ways: * automatically extracts the currently logged user * does not render TextAvatar as it is only for group conversations * does not have `onPress`
This is a stand-alone component that: * retrieves the current user's `user status` data and presents it * allows by switching it to control the `away` status
This is very similar to `AccountDetails` but used to show the current users account. Adding `SwitchAccountButton` and `LogoutButton` buttons there as a natural place for them to be in.
Adds the new `ProfileCard` as a tab to `MainTabs`, the icon is the person's avatar. The end-goal is to replace the Settings tab completely but we will do that change after shipping the User Status feature.
They were placed there not because it made too much sense (they are not a configuration option) but because we did not have a Profile tab/screen. Now we do, so they are removed.
Move "Send private message" out of `AccountDetails`. This allows us to reuse `AccountDetails` in `ProfileCard` but not show the "Send private message" button that is not appropriate there. This will still keep the option if a user sees their own account via the (i) button that shows `AccountDetailsScreen`.
We duplicate the same trivaial code for extracting an avatar's url either from a User object or a Message object. This code extracts that into two utility functions and replaces the duplicate code with function calls. DRY.
bcce5c8
to
ee13faf
Compare
Closing as the original review was done on 4 commits that are very outdated compared to what is currently in. Opening #3344 |
Based on #3263
Includes a new Profile card, and UI for setting 'away' and 'status text'.