Wordpress-ios: Editor: Contributors should not see the option to publish posts

Created on 13 Feb 2017  路  11Comments  路  Source: wordpress-mobile/WordPress-iOS

Expected behavior

If my role on a site is Contributor, I shouldn't see an option to Publish in the editor. Instead of Post (or Publish), the primary action I see should be "Submit for Review."

Actual behavior

When I use the app as a Contributor, and write a post, I see a big Post button. If I click on it, I get the post-post screen telling me the post has been published. But when I go back to my posts list, it's not there. If I open Drafts, _then_ I find it. But the post is only saved locally; I can't find it in Calypso.

Steps to reproduce the behavior

  • Add a contributor to a site
  • Login to the app as that user
  • Open the editor
  • Write a post and click Post.

Current flow:
flow

PostinEditing [Pri] Medium [Type] Broken Window [Type] Bug

All 11 comments

Also referencing #4427 here for more Contributor fun!

Related: #6636 - we're going to add support for it in Aztec

Related: #6479 - Post-post shouldn't be that optimistic in general, and only say the post is published if it really is

While working on something else I saw the code that handles this for Aztec, I properly test it and close this issue if that's the case.

It's not wired up yet in Aztec @elibud but the framework is there for it in the post editor state context. #6636 remains not done but it is prioritized by @diegoreymendez I believe.

Thanks @astralbodies I saw the TODO on the code shortly after updating this.

Just to add more context to the conversation, most of the focus is still in ironing out issues we have with the core Aztec framework.

We'll soon be switching some of the effort back to the WPiOS integration.

Thanks for the extra info @diegoreymendez
If the condition used on WPPostViewController is correct this is a simple change I can make in the context of BrokenWindows:

// Self-hosted non-Jetpack blogs have no capabilities, so we'll default
// to showing Publish Now instead of Submit for Review.
let userCanPublish = self.post.blog.capabilities != nil ? self.post.blog.isPublishingPostsAllowed() : true
let context = PostEditorStateContext(originalPostStatus: originalPostStatus, userCanPublish: userCanPublish, delegate: self)

What do you think?

@elibud - Unfortunately, I don't know enough about these conditions to be able to answer whether that's right or not. I suspect @frosty may know a bit more about it, since he wrote the lines you're mentioning.

Maybe @astralbodies?

As a side note, and not related to your broken windows fix, all of these conditions should / could live inside of the class in charge of introspecting our Post objects (right now they're scattered all around our VCs). Right know, introspecting a Post feels a bit like dark magic to me.

PS: My (limited) understanding is that the condition should be fine.

Cool, thanks, I think I'll do a PR and will add them both as reviewers. We definitely need to refactor how we handle permissions, but not in the context of BW.

Was this page helpful?
0 / 5 - 0 ratings