Skip to content

People Management: user list#4384

Merged
sendhil merged 39 commits intodevelopfrom
feature/people-list
Nov 3, 2015
Merged

People Management: user list#4384
sendhil merged 39 commits intodevelopfrom
feature/people-list

Conversation

@koke
Copy link
Copy Markdown
Member

@koke koke commented Oct 28, 2015

First PR for People management

Note that there's also some work done on viewing and editing users in #4309, but since we're putting the feature on hold for a bit, I'm trying to get what's working merged into develop.

For the feature flag, I went with a #define on Constants.h. Usually it'd be my least preferred method, but it felt like the simplest way to enable this on Debug builds only without adding a lot of logic to the Blog Details table view sections/rows.

I decided to keep this enabled in Debug so it's easy to test if we need to change code. I remember some code not accessible from the UI (themes, media browser) that got left out of refactors because it wasn't visible.

Known issues

  • No infinite scroll: the list will just load 50 users from the API, and there's no way to see more
  • There's a blank screen when the list firs loads until the data is retrieved from the server, and no indication of progress other than the system's network activity indicator
  • My user should appear at the top of the list, but it's not implemented yet
  • No error message gets displayed when a user tries to view a people list of a site they don't have permission to
  • 'Super Admin' gets the wrong background when the cell is highlighted
    simulator screen shot 28 oct 2015 18 17 36

Needs Review: @sendhil

koke added 30 commits September 21, 2015 18:17
JSON parsing is still quite unstable and can crash on self hosted sites
with older Jetpack versions.
Moved storage to core data and use a NSFetchedResultsController for
change notification
I wanted to move networking code out of the view layer, but let's start
with something that works and build from there.
@koke koke added this to the 5.7 milestone Oct 28, 2015
@koke koke mentioned this pull request Oct 28, 2015
18 tasks
@oguzkocer
Copy link
Copy Markdown
Contributor

I've had a look at the PR, unfortunately I haven't done swift for a very long time, so I wasn't sure about a lot of stuff. I just wanted to expose myself a little bit at the swift code and also take a look at what you have done in iOS side since I am working on Android version myself. I don't really have much to contribute review-wise.

Having said that, I've tested the branch a bit and found an issue with a Jetpack blog I have. In wp-admin my user is set as "Administrator" whereas the app shows me in "Unsupported" role. You can find screenshots for it below.

Let me know if I can help with the testing phase any further and I'll be looking for Sendhil's comments for the code review!

screen shot 2015-10-30 at 13 59 54

![simulator screen shot oct 30 2015 14 00 08](https://cloud.githubusercontent.com/assets/662023/10844292/1119cd90-7f07-11e5-8030-f6923a2dab45.png)

@oguzkocer
Copy link
Copy Markdown
Contributor

After chatting with @koke on Slack, we found out that the issue with the Role not showing up was that my Jetpack was not up to date, so no problems with the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a little nit picky so feel free to ignore it, but the _ in naming doesn't feel very sSwiftish. Perhaps rename to firstName, lastName, etc.?

@sendhil
Copy link
Copy Markdown
Contributor

sendhil commented Oct 31, 2015

You probably know this but right now no error message gets displayed when a user tries to view a people list of a site they don't have permission to. That being said I do see the error being logged to the console.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be unowned?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Er I should say weak.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure about this one. If we're at the point where we're ready to call the success block, I really want to call mergeTeam so we don't waste the downloaded data.

When I run Instruments I don't see any leaks or retain cycles

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I took a different approach and made PeopleService a struct. I'm not 100% sure, but from what I understand, it is now a value type, so there are no reference cycles: the callback just gets a copy of the service.

I also think this matches what I wanted more closely. I think I changed it to a class because I planned to keep track of requests in progress, but I don't think that's happening in the short term

@sendhil
Copy link
Copy Markdown
Contributor

sendhil commented Oct 31, 2015

@koke sorry on the delay - left a few comments for you.

@koke
Copy link
Copy Markdown
Member Author

koke commented Nov 2, 2015

You probably know this but right now no error message gets displayed when a user tries to view a people list of a site they don't have permission to.

I didn't 😄 Added it to the PR known issues list for reference when we resume development.

Also merged develop and resolved conflicts. Ready for the next round

@sendhil
Copy link
Copy Markdown
Contributor

sendhil commented Nov 2, 2015

Looks good to me @koke

sendhil added a commit that referenced this pull request Nov 3, 2015
@sendhil sendhil merged commit 25027c2 into develop Nov 3, 2015
@sendhil sendhil deleted the feature/people-list branch November 3, 2015 02:11
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.

3 participants