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

Revisions: Wrong author shown for Jetpack/Atomic sites #11217

Open
rachelmcr opened this issue Mar 8, 2019 · 4 comments
Open

Revisions: Wrong author shown for Jetpack/Atomic sites #11217

rachelmcr opened this issue Mar 8, 2019 · 4 comments

Comments

@rachelmcr
Copy link
Member

Expected behavior

The expected behavior given how the API works now is that the app syncs all authors for a site when it syncs the site details. The revisions API includes the user ID for the author of each revision, and the app uses details from syncing the full list of authors to fill in the Gravatar and username for each revision.

Actual behavior

On Jetpack/Atomic sites, sometimes no author details or the wrong author details appear.

Case 1:

A user reported that on an Atomic site in the app, only one user (the admin/owner of the site) appeared next to all revisions on a post. However, an editor on the site had made some of those revisions, and in WP Admin the editor shows up correctly on those revisions.

In this case, the editor wasn't connected via Jetpack. This is a possible cause for all revisions being attributed to the admin user.

Case 2:

In various tests on Atomic and Jetpack sites, we have seen that no user info appears on the revision. It would be good to better understand why the author wasn't in the author list when the site was synced, and see if we can improve that experience.

cc @danielebogo
Internal ref: p4a5px-2m4-p2

@danielebogo
Copy link
Contributor

Thanks @rachelmcr 😊

@stale
Copy link

stale bot commented Mar 7, 2020

This issue has been marked as stale because:

  • It has been inactive for the past year.
  • It isn't in a project or a milestone.
  • It hasn’t been labeled [Pri] Blocker, [Pri] High, or good first issue.

Please comment with an update if you believe this issue is still valid or if it can be closed. This issue will also be reviewed for validity and priority (cc @designsimply).

@stale stale bot added the [Status] Stale label Mar 7, 2020
@wddean
Copy link

wddean commented Jul 19, 2021

We have this issue or a similar one. We recently moved a site off of WordPress.com. The old WordPress.com hosted site and the new self hosted site are both in the WordPress.com account and the new site is connected using JetPack plugin. The blogger continues to post using the WordPress app as they have done in the past but under the new site instead of the old. The problem is that posts show they were authored by the developer's account not the blogger's account. The blogger does not know and has never logged in as the developer yet their posts show they are authored by the developers account. Posting directly on the site instead of using the app works fine.

@stale stale bot removed the [Status] Stale label Jul 19, 2021
@twstokes
Copy link
Contributor

twstokes commented Aug 3, 2021

Hello all 👋, I have some information that may help with this issue. When working on #16870 recently we noticed what you're observing.

  1. Some user roles can't populate the blog.authors array because the API endpoint won't allow them to query for users. getAuthor will return nil for these roles when called in the RevisionsTableViewController.
  2. Related to Atomic / Jetpack connected sites: If the user can populate the blog.authors array, we found that the user ID attached to revisions is their WP.COM ID, but the author ID in getAuthor is their site-specific ID. In this case, we should be querying getAuthorWith(linkedID: NSNumber) instead.

An example solution could be (though I'm not sure it covers all JP cases):

    private func getAuthor(for id: NSNumber?) -> BlogAuthor? {
        guard let authorId = id, let blog = post?.blog else {
            return nil
        }
        
        if blog.isAtomic() {
            return blog.getAuthorWith(linkedID: authorId)
        }

        return blog.getAuthorWith(id: authorId)
    }

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

No branches or pull requests

4 participants